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

ESP IDF < 5.2 Compatibility #79

Open
jeroenveer opened this issue Feb 1, 2025 · 0 comments
Open

ESP IDF < 5.2 Compatibility #79

jeroenveer opened this issue Feb 1, 2025 · 0 comments

Comments

@jeroenveer
Copy link

bus_handle = nullptr; gives a build error if the IDF is lower than 5.2.
To fix it, check the IDF version:

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
    bus_handle = nullptr;
#endif

esp32_can_buildin.cpp:

ESP32CAN::ESP32CAN(gpio_num_t rxPin, gpio_num_t txPin, uint8_t busNumber) : CAN_COMMON(32)
{
    twai_general_cfg.rx_io = rxPin;
    twai_general_cfg.tx_io = txPin;
    cyclesSinceTraffic = 0;
    readyForTraffic = false;
    twai_general_cfg.tx_queue_len = BI_TX_BUFFER_SIZE;
    twai_general_cfg.rx_queue_len = 6;
    rxBufferSize = BI_RX_BUFFER_SIZE;
    
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
    bus_handle = nullptr;
    twai_general_cfg.controller_id = busNumber;
#endif
}

ESP32CAN::ESP32CAN() : CAN_COMMON(BI_NUM_FILTERS) 
{
    twai_general_cfg.tx_queue_len = BI_TX_BUFFER_SIZE;
    twai_general_cfg.rx_queue_len = 6;
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 2, 0)
    bus_handle = nullptr;
#endif
@jeroenveer jeroenveer changed the title ESP IDF < 5.2 Compatability ESP IDF < 5.2 Compatibility Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant