123456789101112131415161718192021222324252627282930313233343536373839 |
- /*
- * Time-Keeping helper
- */
-
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-parameter"
- #pragma GCC diagnostic ignored "-pedantic"
- #include "mbed.h"
- #pragma GCC diagnostic pop
-
- static Ticker t;
- static time_t systemTime = 0;
-
- static void timerISR(void) {
- systemTime += 100;
- }
-
- extern "C" {
-
- #include "timer.h"
-
- void delay_us(int x) {
- wait_us(x);
- }
-
- void delay_ms(int x) {
- wait_ms(x);
- }
-
- void timerInit(void) {
- t.attach_us(&timerISR, 100);
- }
-
- time_t timerGet(void) {
- return systemTime;
- }
-
- }
|