[sys_time] if PERIODIC_FREQUENCY is defined, set default SYS_TIME_RESOLUTION to twice that

This commit is contained in:
Felix Ruess
2013-02-13 23:39:35 +01:00
parent 9bbe2da34a
commit ed28e4d697
2 changed files with 6 additions and 0 deletions
+2
View File
@@ -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;
+4
View File
@@ -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)