diff options
| author | Fred Sundvik <fsundvik@gmail.com> | 2017-07-01 22:25:06 +0300 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-07-08 21:59:51 -0400 |
| commit | 4e69a8bda6c4003c6b9e33de7db89fe073c970f5 (patch) | |
| tree | 8a01b6dde0195d574686fdd2f9cd1da61b3aa8dc /tmk_core | |
| parent | a62f4496599d4a1880adc5f272f97f81be0586cb (diff) | |
| download | qmk_firmware-4e69a8bda6c4003c6b9e33de7db89fe073c970f5.tar.gz qmk_firmware-4e69a8bda6c4003c6b9e33de7db89fe073c970f5.zip | |
Add basic timing support, and SFT_T tests
Also expose some bugs...
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/common/test/timer.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tmk_core/common/test/timer.c b/tmk_core/common/test/timer.c index 09ea91a89..49efc1c1e 100644 --- a/tmk_core/common/test/timer.c +++ b/tmk_core/common/test/timer.c | |||
| @@ -16,15 +16,16 @@ | |||
| 16 | 16 | ||
| 17 | #include "timer.h" | 17 | #include "timer.h" |
| 18 | 18 | ||
| 19 | // TODO: the timer should work, but at a much faster rate than realtime | 19 | static uint32_t current_time = 0; |
| 20 | // It should also have some kind of integration with the testing system | ||
| 21 | 20 | ||
| 22 | void timer_init(void) {} | 21 | void timer_init(void) {current_time = 0;} |
| 23 | 22 | ||
| 24 | void timer_clear(void) {} | 23 | void timer_clear(void) {current_time = 0;} |
| 25 | 24 | ||
| 26 | uint16_t timer_read(void) { return 0; } | 25 | uint16_t timer_read(void) { return current_time & 0xFFFF; } |
| 27 | uint32_t timer_read32(void) { return 0; } | 26 | uint32_t timer_read32(void) { return current_time; } |
| 28 | uint16_t timer_elapsed(uint16_t last) { return 0; } | 27 | uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); } |
| 29 | uint32_t timer_elapsed32(uint32_t last) { return 0; } | 28 | uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); } |
| 30 | 29 | ||
| 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 | ||
