diff --git a/components/esp_hal_ieee802154/esp32c5/include/hal/ieee802154_ll.h b/components/esp_hal_ieee802154/esp32c5/include/hal/ieee802154_ll.h index 4f94a5224b2..840b7de86b9 100644 --- a/components/esp_hal_ieee802154/esp32c5/include/hal/ieee802154_ll.h +++ b/components/esp_hal_ieee802154/esp32c5/include/hal/ieee802154_ll.h @@ -9,3 +9,4 @@ #include "hal/ieee802154_common_ll.h" #define IEEE802154_RSSI_COMPENSATION_VALUE 0 +#define IEEE802154_RX_SENSITIVITY -104 diff --git a/components/esp_hal_ieee802154/esp32c6/include/hal/ieee802154_ll.h b/components/esp_hal_ieee802154/esp32c6/include/hal/ieee802154_ll.h index 4f94a5224b2..840b7de86b9 100644 --- a/components/esp_hal_ieee802154/esp32c6/include/hal/ieee802154_ll.h +++ b/components/esp_hal_ieee802154/esp32c6/include/hal/ieee802154_ll.h @@ -9,3 +9,4 @@ #include "hal/ieee802154_common_ll.h" #define IEEE802154_RSSI_COMPENSATION_VALUE 0 +#define IEEE802154_RX_SENSITIVITY -104 diff --git a/components/esp_hal_ieee802154/esp32h2/include/hal/ieee802154_ll.h b/components/esp_hal_ieee802154/esp32h2/include/hal/ieee802154_ll.h index 6fc4a17ef6d..0d77c446e4f 100644 --- a/components/esp_hal_ieee802154/esp32h2/include/hal/ieee802154_ll.h +++ b/components/esp_hal_ieee802154/esp32h2/include/hal/ieee802154_ll.h @@ -12,9 +12,10 @@ extern "C" { #endif -extern uint32_t bt_bb_get_rssi_comp(void); - #define IEEE802154_RSSI_COMPENSATION_VALUE bt_bb_get_rssi_comp() +#define IEEE802154_RX_SENSITIVITY -102 + +extern uint32_t bt_bb_get_rssi_comp(void); #ifdef __cplusplus } diff --git a/components/ieee802154/driver/esp_ieee802154_ack.c b/components/ieee802154/driver/esp_ieee802154_ack.c index ce15b445974..8e1aa2c8fe1 100644 --- a/components/ieee802154/driver/esp_ieee802154_ack.c +++ b/components/ieee802154/driver/esp_ieee802154_ack.c @@ -5,7 +5,6 @@ */ #include -#include "hal/ieee802154_ll.h" #include "esp_attr.h" #include "esp_err.h" #include "esp_ieee802154_ack.h" diff --git a/components/ieee802154/driver/esp_ieee802154_debug.c b/components/ieee802154/driver/esp_ieee802154_debug.c index 5979c0483fb..baa9dba1317 100644 --- a/components/ieee802154/driver/esp_ieee802154_debug.c +++ b/components/ieee802154/driver/esp_ieee802154_debug.c @@ -6,7 +6,6 @@ #include #include -#include "hal/ieee802154_ll.h" #include "esp_ieee802154_util.h" #include "esp_log.h" diff --git a/components/ieee802154/driver/esp_ieee802154_dev.c b/components/ieee802154/driver/esp_ieee802154_dev.c index 681289419fa..44bd72e07bc 100644 --- a/components/ieee802154/driver/esp_ieee802154_dev.c +++ b/components/ieee802154/driver/esp_ieee802154_dev.c @@ -24,7 +24,6 @@ #include "esp_ieee802154_sec.h" #include "esp_ieee802154_util.h" #include "esp_ieee802154_timer.h" -#include "hal/ieee802154_ll.h" #include "esp_attr.h" #include "esp_phy_init.h" diff --git a/components/ieee802154/driver/esp_ieee802154_pib.c b/components/ieee802154/driver/esp_ieee802154_pib.c index b8a95369db4..e4f4d88f607 100644 --- a/components/ieee802154/driver/esp_ieee802154_pib.c +++ b/components/ieee802154/driver/esp_ieee802154_pib.c @@ -7,7 +7,6 @@ #include #include #include "sdkconfig.h" -#include "hal/ieee802154_ll.h" #include "esp_check.h" #include "esp_ieee802154_pib.h" #include "esp_ieee802154_util.h" diff --git a/components/ieee802154/driver/esp_ieee802154_sec.c b/components/ieee802154/driver/esp_ieee802154_sec.c index c628666b0a7..37a06918380 100644 --- a/components/ieee802154/driver/esp_ieee802154_sec.c +++ b/components/ieee802154/driver/esp_ieee802154_sec.c @@ -7,7 +7,6 @@ #include "sdkconfig.h" #include #include "esp_err.h" -#include "hal/ieee802154_ll.h" #include "esp_ieee802154_frame.h" #include "esp_ieee802154_sec.h" #include "esp_ieee802154_util.h" diff --git a/components/ieee802154/driver/esp_ieee802154_timer.c b/components/ieee802154/driver/esp_ieee802154_timer.c index cd64ea365d7..cb72bd48590 100644 --- a/components/ieee802154/driver/esp_ieee802154_timer.c +++ b/components/ieee802154/driver/esp_ieee802154_timer.c @@ -5,7 +5,6 @@ */ #include "soc/soc.h" -#include "hal/ieee802154_ll.h" #include "esp_check.h" #include "esp_ieee802154_timer.h" #include "esp_ieee802154_util.h" diff --git a/components/ieee802154/driver/esp_ieee802154_util.c b/components/ieee802154/driver/esp_ieee802154_util.c index a37cf4b6d85..f77e693a41a 100644 --- a/components/ieee802154/driver/esp_ieee802154_util.c +++ b/components/ieee802154/driver/esp_ieee802154_util.c @@ -7,7 +7,6 @@ #include "esp_private/esp_modem_clock.h" #include "soc/soc.h" #include "soc/periph_defs.h" -#include "hal/ieee802154_ll.h" #include "esp_check.h" #include "esp_coex_i154.h" #include "esp_ieee802154_util.h" diff --git a/components/ieee802154/esp_ieee802154.c b/components/ieee802154/esp_ieee802154.c index 1947c73a524..189bb002b7c 100644 --- a/components/ieee802154/esp_ieee802154.c +++ b/components/ieee802154/esp_ieee802154.c @@ -20,7 +20,6 @@ #include "esp_ieee802154_util.h" #include "esp_log.h" #include "esp_coex_i154.h" -#include "hal/ieee802154_ll.h" #include "hal/ieee802154_common_ll.h" esp_err_t esp_ieee802154_event_callback_list_register(esp_ieee802154_event_cb_list_t cb_list) @@ -49,6 +48,11 @@ esp_err_t esp_ieee802154_disable(void) return ieee802154_mac_deinit(); } +int8_t esp_ieee802154_get_receive_sensitivity(void) +{ + return IEEE802154_RX_SENSITIVITY; +} + uint8_t esp_ieee802154_get_channel(void) { return ieee802154_pib_get_channel(); diff --git a/components/ieee802154/include/esp_ieee802154.h b/components/ieee802154/include/esp_ieee802154.h index 3a22f686212..02ae67f421f 100644 --- a/components/ieee802154/include/esp_ieee802154.h +++ b/components/ieee802154/include/esp_ieee802154.h @@ -39,6 +39,14 @@ esp_err_t esp_ieee802154_enable(void); */ esp_err_t esp_ieee802154_disable(void); +/** + * @brief Get the receive sensitivity. + * + * @return The receive sensitivity in dBm. + * + */ +int8_t esp_ieee802154_get_receive_sensitivity(void); + /** * @brief Get the operational channel. * diff --git a/components/openthread/src/port/esp_openthread_radio.c b/components/openthread/src/port/esp_openthread_radio.c index 6116e8f9c3c..93d4b7ee76c 100644 --- a/components/openthread/src/port/esp_openthread_radio.c +++ b/components/openthread/src/port/esp_openthread_radio.c @@ -10,7 +10,6 @@ #include "sdkconfig.h" #include "esp_check.h" #include "esp_ieee802154.h" -#include "esp_ieee802154_types.h" #include "esp_mac.h" #include "esp_openthread_common.h" #include "esp_openthread_common_macro.h" @@ -36,7 +35,6 @@ #include "esp_coex_i154.h" #endif -#define ESP_RECEIVE_SENSITIVITY -120 #define ESP_OPENTHREAD_XTAL_ACCURACY CONFIG_OPENTHREAD_XTAL_ACCURACY #define ESP_OPENTHREAD_CSL_ACCURACY CONFIG_OPENTHREAD_CSL_ACCURACY #define ESP_OPENTHREAD_CSL_UNCERTAIN CONFIG_OPENTHREAD_CSL_UNCERTAIN @@ -459,7 +457,7 @@ otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aTh int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { - return ESP_RECEIVE_SENSITIVITY; + return esp_ieee802154_get_receive_sensitivity(); } #if CONFIG_OPENTHREAD_DIAG