|
|
@@ -28,6 +28,7 @@ extern "C" {
|
|
|
|
|
|
#include <stdint.h>
|
|
|
#include <stdbool.h>
|
|
|
+#include "sdkconfig.h"
|
|
|
#include "hal/twai_types.h"
|
|
|
#include "soc/twai_periph.h"
|
|
|
|
|
|
@@ -336,8 +337,8 @@ static inline uint32_t twai_ll_get_and_clear_intrs(twai_dev_t *hw)
|
|
|
*/
|
|
|
static inline void twai_ll_set_enabled_intrs(twai_dev_t *hw, uint32_t intr_mask)
|
|
|
{
|
|
|
-#ifdef TWAI_BRP_DIV_SUPPORTED
|
|
|
- //ESP32 Rev 2 has brp div. Need to mask when setting
|
|
|
+#if (CONFIG_ESP32_REV_MIN >= 2)
|
|
|
+ //ESP32 Rev 2 or later has brp div field. Need to mask it out
|
|
|
hw->interrupt_enable_reg.val = (hw->interrupt_enable_reg.val & 0x10) | intr_mask;
|
|
|
#else
|
|
|
hw->interrupt_enable_reg.val = intr_mask;
|
|
|
@@ -362,7 +363,7 @@ static inline void twai_ll_set_enabled_intrs(twai_dev_t *hw, uint32_t intr_mask)
|
|
|
*/
|
|
|
static inline void twai_ll_set_bus_timing(twai_dev_t *hw, uint32_t brp, uint32_t sjw, uint32_t tseg1, uint32_t tseg2, bool triple_sampling)
|
|
|
{
|
|
|
-#ifdef TWAI_BRP_DIV_SUPPORTED
|
|
|
+#if (CONFIG_ESP32_REV_MIN >= 2)
|
|
|
if (brp > TWAI_BRP_DIV_THRESH) {
|
|
|
//Need to set brp_div bit
|
|
|
hw->interrupt_enable_reg.brp_div = 1;
|