btstack_run_loop_embedded: implement poll_data_sources_from_irq

This commit is contained in:
Matthias Ringwald 2021-03-16 10:24:53 +01:00
parent 7eaf37e0f9
commit decb7d9b3d
2 changed files with 14 additions and 6 deletions

View File

@ -165,14 +165,15 @@ static uint32_t btstack_run_loop_embedded_get_time_ms(void){
#endif
}
/**
* trigger run loop iteration
*/
void btstack_run_loop_embedded_trigger(void){
static void btstack_run_loop_embedded_poll_data_sources_from_irq(void){
trigger_event_received = 1;
}
// @deprecated Use btstack_run_loop_poll_data_sources_from_irq() instead
void btstack_run_loop_embedded_trigger(void){
btstack_run_loop_embedded_poll_data_sources_from_irq();
}
static void btstack_run_loop_embedded_init(void){
btstack_run_loop_base_init();
@ -199,6 +200,7 @@ static const btstack_run_loop_t btstack_run_loop_embedded = {
&btstack_run_loop_embedded_execute,
&btstack_run_loop_base_dump_timer,
&btstack_run_loop_embedded_get_time_ms,
&btstack_run_loop_embedded_poll_data_sources_from_irq,
};
const btstack_run_loop_t * btstack_run_loop_embedded_get_instance(void){

View File

@ -75,10 +75,16 @@ uint32_t btstack_run_loop_embedded_get_ticks(void);
/**
* @brief Sets an internal flag that is checked in the critical section just before entering sleep mode. Has to be called by the interrupt handler of a data source to signal the run loop that a new data is available.
* @deprecated Please use btstack_run_loop_poll_data_sources_from_irq() instead
*/
void btstack_run_loop_embedded_trigger(void);
/**
* @brief Execute run_loop once. It can be used to integrate BTstack's timer and data source processing into a foreign run loop (it is not recommended).
* @brief Execute run_loop once. It can be used to integrate BTstack's timer and data source processing into a foreign run loop
*
* @note Not recommended. Instead, you can implement the btstack_run_loop_t interface with your own run loop and request
* - processing of timers by calling btstack_run_loop_base_process_timers and
* - poll data sources with by calling btstack_run_loop_base_poll_data_sources
*/
void btstack_run_loop_embedded_execute_once(void);