diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2017-07-02 01:06:39 +0300 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-07-08 21:59:51 -0400 |
| commit | 4087d6da0d60f51735f6ec2c34e5fdabcf9c4447 (patch) | |
| tree | 7607e45b2259afe96e1f31397f4db28c2060b8ec /tmk_core | |
| parent | fc4bfbe580c520caed5b6682790019658133f74e (diff) | |
| download | qmk_firmware-4087d6da0d60f51735f6ec2c34e5fdabcf9c4447.tar.gz qmk_firmware-4087d6da0d60f51735f6ec2c34e5fdabcf9c4447.zip | |
Add wait support for tests
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/common/test/timer.c | 6 | ||||
| -rw-r--r-- | tmk_core/common/wait.h | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/tmk_core/common/test/timer.c b/tmk_core/common/test/timer.c index 49efc1c1e..19e79e1f5 100644 --- a/tmk_core/common/test/timer.c +++ b/tmk_core/common/test/timer.c | |||
| @@ -28,4 +28,8 @@ uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last) | |||
| 28 | uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); } | 28 | uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); } |
| 29 | 29 | ||
| 30 | void set_time(uint32_t t) { current_time = t; } | 30 | void set_time(uint32_t t) { current_time = t; } |
| 31 | void advance_time(uint32_t ms) { current_time += ms; } \ No newline at end of file | 31 | void advance_time(uint32_t ms) { current_time += ms; } |
| 32 | |||
| 33 | void wait_ms(uint32_t ms) { | ||
| 34 | advance_time(ms); | ||
| 35 | } \ No newline at end of file | ||
diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h index 911c9ddb5..bdcb3f2a4 100644 --- a/tmk_core/common/wait.h +++ b/tmk_core/common/wait.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #ifndef WAIT_H | 1 | #ifndef WAIT_H |
| 2 | #define WAIT_H | 2 | #define WAIT_H |
| 3 | 3 | ||
| 4 | #include <inttypes.h> | ||
| 5 | |||
| 4 | #ifdef __cplusplus | 6 | #ifdef __cplusplus |
| 5 | extern "C" { | 7 | extern "C" { |
| 6 | #endif | 8 | #endif |
| @@ -16,8 +18,8 @@ extern "C" { | |||
| 16 | #elif defined(__arm__) | 18 | #elif defined(__arm__) |
| 17 | # include "wait_api.h" | 19 | # include "wait_api.h" |
| 18 | #else // Unit tests | 20 | #else // Unit tests |
| 19 | #define wait_ms(ms) | 21 | void wait_ms(uint32_t ms); |
| 20 | #define wait_us(us) | 22 | #define wait_us(us) wait_ms(us / 1000) |
| 21 | #endif | 23 | #endif |
| 22 | 24 | ||
| 23 | #ifdef __cplusplus | 25 | #ifdef __cplusplus |
