Compiler thinks I'm giving an int to the CAN_GENERAL_CONFIG_DEFAULT macro
Posted: Mon Jan 18, 2021 10:36 am
I've used CAN in the ESP-IDF succesfully and am currently porting my CAN tester program for use in the ESP32 Arduino environment.
I'm having issues with the CAN_GENERAL_CONFIG_DEFAULT() macro that don't make any sense to me. See the below function (which simply wraps up a default can_driver_install().
My compiler (I'm using PlatformIO) takes issue with the config macro, saying " a value of type "int" cannot be used to initialize an entity of type "gpio_num_t" ". The function ensures that I could only possibly be passing gpio_num_ts rather than ints.
I'm having issues with the CAN_GENERAL_CONFIG_DEFAULT() macro that don't make any sense to me. See the below function (which simply wraps up a default can_driver_install().
Code: Select all
esp_err_t InstallCAN(gpio_num_t canTxPin, gpio_num_t canRxPin, can_mode_t canMode)
{
// Initialise config structures using macro inits
can_general_config_t gConfig = CAN_GENERAL_CONFIG_DEFAULT(canTxPin, canRxPin, canMode);
can_timing_config_t tConfig = CAN_TIMING_CONFIG_25KBITS();
can_filter_config_t fConfig = CAN_FILTER_CONFIG_ACCEPT_ALL();
// Install CAN driver and return error code
return can_driver_install(&gConfig, &tConfig, &fConfig);
}