diff --git a/sw/airborne/mcu_periph/sys_time.c b/sw/airborne/mcu_periph/sys_time.c index 6cf939a7993..813461d5415 100644 --- a/sw/airborne/mcu_periph/sys_time.c +++ b/sw/airborne/mcu_periph/sys_time.c @@ -32,6 +32,8 @@ struct sys_time sys_time; +PRINT_CONFIG_VAR(SYS_TIME_RESOLUTION) + int sys_time_register_timer(float duration, sys_time_cb cb) { uint32_t start_time = sys_time.nb_tick; diff --git a/sw/airborne/mcu_periph/sys_time.h b/sw/airborne/mcu_periph/sys_time.h index ae44b683442..96b1f7be122 100644 --- a/sw/airborne/mcu_periph/sys_time.h +++ b/sw/airborne/mcu_periph/sys_time.h @@ -103,8 +103,12 @@ static inline bool_t sys_time_check_and_ack_timer(tid_t id) { /** system time resolution in seconds */ #ifndef SYS_TIME_RESOLUTION +#if defined PERIODIC_FREQUENCY +#define SYS_TIME_RESOLUTION ( 1./(2*PERIODIC_FREQUENCY) ) +#else #define SYS_TIME_RESOLUTION ( 1./1024. ) #endif +#endif #define SYS_TIME_RESOLUTION_CPU_TICKS CPU_TICKS_OF_SEC(SYS_TIME_RESOLUTION) #define SYS_TIME_TICKS_OF_SEC(s) (uint32_t)((s) / SYS_TIME_RESOLUTION + 0.5)