Add wait support for tests
This commit is contained in:
parent
fc4bfbe580
commit
4087d6da0d
|
@ -28,4 +28,8 @@ uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last)
|
||||||
uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); }
|
uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); }
|
||||||
|
|
||||||
void set_time(uint32_t t) { current_time = t; }
|
void set_time(uint32_t t) { current_time = t; }
|
||||||
void advance_time(uint32_t ms) { current_time += ms; }
|
void advance_time(uint32_t ms) { current_time += ms; }
|
||||||
|
|
||||||
|
void wait_ms(uint32_t ms) {
|
||||||
|
advance_time(ms);
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef WAIT_H
|
#ifndef WAIT_H
|
||||||
#define WAIT_H
|
#define WAIT_H
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,8 +18,8 @@ extern "C" {
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
# include "wait_api.h"
|
# include "wait_api.h"
|
||||||
#else // Unit tests
|
#else // Unit tests
|
||||||
#define wait_ms(ms)
|
void wait_ms(uint32_t ms);
|
||||||
#define wait_us(us)
|
#define wait_us(us) wait_ms(us / 1000)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
Loading…
Reference in New Issue