mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
Merge branch 'feat/set_get_ack_timeout_v5.3' into 'release/v5.3'
feat(802.15.4): add api for set/get ack timeout (v5.3) See merge request espressif/esp-idf!36086
This commit is contained in:
@ -277,6 +277,16 @@ static inline void ieee802154_ll_set_power(uint8_t power)
|
|||||||
IEEE802154.txpower.power = power;
|
IEEE802154.txpower.power = power;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void ieee802154_ll_set_ack_timeout(uint32_t timeout)
|
||||||
|
{
|
||||||
|
IEEE802154.ack_timeout.timeout = timeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t ieee802154_ll_get_ack_timeout(void)
|
||||||
|
{
|
||||||
|
return IEEE802154.ack_timeout.timeout;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void ieee802154_ll_set_multipan_panid(ieee802154_ll_multipan_index_t index, uint16_t panid)
|
static inline void ieee802154_ll_set_multipan_panid(ieee802154_ll_multipan_index_t index, uint16_t panid)
|
||||||
{
|
{
|
||||||
IEEE802154.conf.multipan_mask |= BIT(index);
|
IEEE802154.conf.multipan_mask |= BIT(index);
|
||||||
|
@ -184,6 +184,22 @@ esp_err_t esp_ieee802154_set_multipan_enable(uint8_t mask)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
esp_err_t esp_ieee802154_set_ack_timeout(uint32_t timeout)
|
||||||
|
{
|
||||||
|
// Divide by 16 and round it up.
|
||||||
|
uint32_t target_reg_value = (timeout + 15) / 16;
|
||||||
|
if((timeout % 16) != 0) {
|
||||||
|
ESP_LOGW(IEEE802154_TAG, "Ack timeout should be a multiple of 16, input %"PRIu32", will be replaced by %"PRIu32"", timeout, (target_reg_value * 16));
|
||||||
|
}
|
||||||
|
ieee802154_ll_set_ack_timeout(target_reg_value);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t esp_ieee802154_get_ack_timeout(void)
|
||||||
|
{
|
||||||
|
return ieee802154_ll_get_ack_timeout() * 16;
|
||||||
|
}
|
||||||
|
|
||||||
uint16_t esp_ieee802154_get_panid(void)
|
uint16_t esp_ieee802154_get_panid(void)
|
||||||
{
|
{
|
||||||
return ieee802154_ll_get_multipan_panid(ESP_IEEE802154_MULTIPAN_0);
|
return ieee802154_ll_get_multipan_panid(ESP_IEEE802154_MULTIPAN_0);
|
||||||
|
@ -150,8 +150,8 @@ esp_err_t esp_ieee802154_transmit(const uint8_t *frame, bool cca);
|
|||||||
/**
|
/**
|
||||||
* @brief Set the time to wait for the ack frame.
|
* @brief Set the time to wait for the ack frame.
|
||||||
*
|
*
|
||||||
* @param[in] timeout The time to wait for the ack frame, in symbol unit (16 us).
|
* @param[in] timeout The time to wait for the ack frame, in us.
|
||||||
* Default: 0x006C, Range: 0x0000 - 0xFFFF.
|
* It Should be a multiple of 16. The default value is 1728 us (108 * 16).
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* - ESP_OK on success.
|
* - ESP_OK on success.
|
||||||
@ -159,6 +159,13 @@ esp_err_t esp_ieee802154_transmit(const uint8_t *frame, bool cca);
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_ieee802154_set_ack_timeout(uint32_t timeout);
|
esp_err_t esp_ieee802154_set_ack_timeout(uint32_t timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the time to wait for the ack frame.
|
||||||
|
*
|
||||||
|
* @return The time to wait for the ack frame, in us.
|
||||||
|
*/
|
||||||
|
uint32_t esp_ieee802154_get_ack_timeout(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the device PAN ID.
|
* @brief Get the device PAN ID.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user