mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 15:44:32 +00:00
stm32-sx1280: replace radio_set_timer(us) by radio_set_timer_ticks
This commit is contained in:
parent
35d47c809d
commit
9943016f3b
@ -352,7 +352,7 @@ static bool ll_send_disconnected;
|
|||||||
static bool ll_send_connection_complete;
|
static bool ll_send_connection_complete;
|
||||||
|
|
||||||
// prototypes
|
// prototypes
|
||||||
static void radio_set_timer(uint32_t anchor_offset_us);
|
static void radio_set_timer_ticks(uint32_t anchor_offset_ticks);
|
||||||
|
|
||||||
|
|
||||||
// memory pool for acl-le pdus
|
// memory pool for acl-le pdus
|
||||||
@ -452,7 +452,8 @@ static void ll_advertising_statemachine(void){
|
|||||||
if (ctx.channel >= 40){
|
if (ctx.channel >= 40){
|
||||||
// Set timer
|
// Set timer
|
||||||
radio_state = RADIO_W4_TIMER;
|
radio_state = RADIO_W4_TIMER;
|
||||||
radio_set_timer(ctx.adv_interval_us);
|
uint32_t adv_interval_ticks = US_TO_TICKS(ctx.adv_interval_us);
|
||||||
|
radio_set_timer_ticks(adv_interval_ticks);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -507,11 +508,10 @@ static void radio_stop_timer(void){
|
|||||||
__HAL_LPTIM_CLEAR_FLAG(&hlptim1, LPTIM_IT_CMPM);
|
__HAL_LPTIM_CLEAR_FLAG(&hlptim1, LPTIM_IT_CMPM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void radio_set_timer(uint32_t anchor_offset_us){
|
static void radio_set_timer_ticks(uint32_t anchor_offset_ticks){
|
||||||
// stop
|
|
||||||
radio_stop_timer();
|
radio_stop_timer();
|
||||||
// set timer for next radio event relative to anchor
|
// set timer for next radio event relative to anchor
|
||||||
uint16_t timeout_ticks = ctx.anchor_ticks + US_TO_TICKS(anchor_offset_us);
|
uint16_t timeout_ticks = (uint16_t) (ctx.anchor_ticks + anchor_offset_ticks);
|
||||||
__HAL_LPTIM_COMPARE_SET(&hlptim1, timeout_ticks);
|
__HAL_LPTIM_COMPARE_SET(&hlptim1, timeout_ticks);
|
||||||
__HAL_LPTIM_ENABLE_IT(&hlptim1, LPTIM_IT_CMPM);
|
__HAL_LPTIM_ENABLE_IT(&hlptim1, LPTIM_IT_CMPM);
|
||||||
}
|
}
|
||||||
@ -582,7 +582,8 @@ static void radio_timer_handler(void){
|
|||||||
|
|
||||||
if (ctx.synced){
|
if (ctx.synced){
|
||||||
// restart radio timer (might get overwritten by first packet)
|
// restart radio timer (might get overwritten by first packet)
|
||||||
radio_set_timer(ctx.conn_interval_us - SYNC_HOP_DELAY_US);
|
uint32_t conn_interval_ticks = US_TO_TICKS(ctx.conn_interval_us);
|
||||||
|
radio_set_timer_ticks(conn_interval_ticks);
|
||||||
|
|
||||||
receive_master();
|
receive_master();
|
||||||
} else {
|
} else {
|
||||||
@ -707,7 +708,8 @@ static void radio_on_rx_done(void ){
|
|||||||
if (ctx.packet_nr_in_connection_event == 0){
|
if (ctx.packet_nr_in_connection_event == 0){
|
||||||
ctx.anchor_ticks = packet_start_ticks;
|
ctx.anchor_ticks = packet_start_ticks;
|
||||||
ctx.synced = true;
|
ctx.synced = true;
|
||||||
radio_set_timer(ctx.conn_interval_us - SYNC_HOP_DELAY_US);
|
uint32_t sync_hop_timeout_ticks = US_TO_TICKS(ctx.conn_interval_us - SYNC_HOP_DELAY_US);
|
||||||
|
radio_set_timer_ticks(sync_hop_timeout_ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.packet_nr_in_connection_event++;
|
ctx.packet_nr_in_connection_event++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user