Bluetooth: controller: ull/lll: Increase adv random delay resolution

Increase the resolution of advertising random delay from
1 ms unit to 1 ticker unit.

Relates to #10289, #10391, and #10398.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2018-09-28 15:09:35 +02:00 committed by Anas Nashif
commit b8c2c7e71a

View file

@ -1011,18 +1011,18 @@ static void ticker_cb(u32_t ticks_at_expire, u32_t remainder, u16_t lazy,
if (!lll->is_hdcd) if (!lll->is_hdcd)
#endif /* CONFIG_BT_PERIPHERAL */ #endif /* CONFIG_BT_PERIPHERAL */
{ {
u8_t random_delay; u32_t random_delay;
u32_t ret; u32_t ret;
ull_entropy_get(sizeof(random_delay), &random_delay); ull_entropy_get(sizeof(random_delay), &random_delay);
random_delay %= 10; random_delay %= HAL_TICKER_US_TO_TICKS(10000);
random_delay += 1U; random_delay += 1;
ret = ticker_update(TICKER_INSTANCE_ID_CTLR, ret = ticker_update(TICKER_INSTANCE_ID_CTLR,
TICKER_USER_ID_ULL_HIGH, TICKER_USER_ID_ULL_HIGH,
(TICKER_ID_ADV_BASE + (TICKER_ID_ADV_BASE +
ull_adv_handle_get(adv)), ull_adv_handle_get(adv)),
HAL_TICKER_US_TO_TICKS(random_delay * 1000U), random_delay,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
ticker_op_update_cb, adv); ticker_op_update_cb, adv);
LL_ASSERT((ret == TICKER_STATUS_SUCCESS) || LL_ASSERT((ret == TICKER_STATUS_SUCCESS) ||