diff --git a/components/driver/twai/twai.c b/components/driver/twai/twai.c index bf37c15761..ea84a41db4 100644 --- a/components/driver/twai/twai.c +++ b/components/driver/twai/twai.c @@ -100,8 +100,10 @@ typedef struct twai_obj_t { SemaphoreHandle_t alert_semphr; uint32_t alerts_enabled; uint32_t alerts_triggered; +#ifdef CONFIG_PM_ENABLE //Power Management Lock esp_pm_lock_handle_t pm_lock; +#endif portMUX_TYPE spinlock; } twai_obj_t; diff --git a/components/esp_driver_twai/esp_twai_onchip.c b/components/esp_driver_twai/esp_twai_onchip.c index c2676dd403..2fe116d8ef 100644 --- a/components/esp_driver_twai/esp_twai_onchip.c +++ b/components/esp_driver_twai/esp_twai_onchip.c @@ -71,7 +71,9 @@ typedef struct { uint32_t valid_fd_timing; twai_event_callbacks_t cbs; void *user_data; +#ifdef CONFIG_PM_ENABLE esp_pm_lock_handle_t pm_lock; +#endif _Atomic twai_error_state_t state; uint16_t tx_error_count; @@ -285,9 +287,11 @@ static void _node_isr_main(void *arg) static void _node_destroy(twai_onchip_ctx_t *twai_ctx) { +#ifdef CONFIG_PM_ENABLE if (twai_ctx->pm_lock) { esp_pm_lock_delete(twai_ctx->pm_lock); } +#endif if (twai_ctx->intr_hdl) { esp_intr_free(twai_ctx->intr_hdl); }