Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make library compatible with 3.0.0 ESP32 #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/CAN.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"

#include "esp_intr.h"
#include "esp_intr_alloc.h"
#include "soc/dport_reg.h"
#include <math.h>

Expand All @@ -43,6 +43,9 @@
#include "can_regdef.h"
#include "CAN_config.h"

#define TWAI_TX_IDX 123
#define TWAI_RX_IDX 94

// CAN Filter - no acceptance filter
static CAN_filter_t __filter = { Dual_Mode, 0, 0, 0, 0, 0Xff, 0Xff, 0Xff, 0Xff };

Expand Down Expand Up @@ -176,12 +179,12 @@ int CAN_init() {
// configure TX pin
gpio_set_level(CAN_cfg.tx_pin_id, 1);
gpio_set_direction(CAN_cfg.tx_pin_id, GPIO_MODE_OUTPUT);
gpio_matrix_out(CAN_cfg.tx_pin_id, CAN_TX_IDX, 0, 0);
gpio_matrix_out(CAN_cfg.tx_pin_id, TWAI_TX_IDX, 0, 0);
gpio_pad_select_gpio(CAN_cfg.tx_pin_id);

// configure RX pin
gpio_set_direction(CAN_cfg.rx_pin_id, GPIO_MODE_INPUT);
gpio_matrix_in(CAN_cfg.rx_pin_id, CAN_RX_IDX, 0);
gpio_matrix_in(CAN_cfg.rx_pin_id, TWAI_RX_IDX, 0);
gpio_pad_select_gpio(CAN_cfg.rx_pin_id);

// set to PELICAN mode
Expand Down Expand Up @@ -296,4 +299,4 @@ int CAN_config_filter(const CAN_filter_t* p_filter) {
__filter.AMR3 = p_filter->AMR3;

return 0;
}
}