mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[sys_time] if PERIODIC_FREQUENCY is defined, set default SYS_TIME_RESOLUTION to twice that
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user