btstack_run_loop: support uint64_t timer variable

btstack_run_loop: cleanup whitespaces
This commit is contained in:
Dirk Helbig 2022-06-02 21:04:02 +02:00
parent 6a3524cf57
commit e8cbad6015
2 changed files with 22 additions and 14 deletions

View File

@ -119,7 +119,7 @@ void btstack_run_loop_base_dump_timer(void){
uint16_t i = 0; uint16_t i = 0;
for (it = (btstack_linked_item_t *) btstack_run_loop_base_timers; it ; it = it->next){ for (it = (btstack_linked_item_t *) btstack_run_loop_base_timers; it ; it = it->next){
btstack_timer_source_t * timer = (btstack_timer_source_t*) it; btstack_timer_source_t * timer = (btstack_timer_source_t*) it;
log_info("timer %u (%p): timeout %" PRIu32 "u\n", i, (void *) timer, timer->timeout); log_info("timer %u (%p): timeout %" PRIbtstack_time_t "\n", i, (void *) timer, timer->timeout);
} }
#endif #endif

View File

@ -56,6 +56,14 @@
#include <stdint.h> #include <stdint.h>
#ifdef ENABLE_TESTING_SUPPORT
typedef uint64_t btstack_time_t;
#define PRIbtstack_time_t PRIu64
#else
typedef uint32_t btstack_time_t;
#define PRIbtstack_time_t PRIu32
#endif
#if defined __cplusplus #if defined __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -92,7 +100,7 @@ typedef struct btstack_data_source {
typedef struct btstack_timer_source { typedef struct btstack_timer_source {
btstack_linked_item_t item; btstack_linked_item_t item;
// timeout in system ticks (HAVE_EMBEDDED_TICK) or milliseconds (HAVE_EMBEDDED_TIME_MS) // timeout in system ticks (HAVE_EMBEDDED_TICK) or milliseconds (HAVE_EMBEDDED_TIME_MS)
uint32_t timeout; btstack_time_t timeout;
// will be called when timer fired // will be called when timer fired
void (*process)(struct btstack_timer_source *ts); void (*process)(struct btstack_timer_source *ts);
void * context; void * context;