diff options
Diffstat (limited to 'tmk_core/common/mbed')
-rw-r--r-- | tmk_core/common/mbed/bootloader.c | 3 | ||||
-rw-r--r-- | tmk_core/common/mbed/suspend.c | 5 | ||||
-rw-r--r-- | tmk_core/common/mbed/timer.c | 23 | ||||
-rw-r--r-- | tmk_core/common/mbed/xprintf.cpp | 50 | ||||
-rw-r--r-- | tmk_core/common/mbed/xprintf.h | 16 |
5 files changed, 0 insertions, 97 deletions
diff --git a/tmk_core/common/mbed/bootloader.c b/tmk_core/common/mbed/bootloader.c deleted file mode 100644 index 88945eb05..000000000 --- a/tmk_core/common/mbed/bootloader.c +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | #include "bootloader.h" | ||
2 | |||
3 | void bootloader_jump(void) {} | ||
diff --git a/tmk_core/common/mbed/suspend.c b/tmk_core/common/mbed/suspend.c deleted file mode 100644 index 3d0554f87..000000000 --- a/tmk_core/common/mbed/suspend.c +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | #include <stdbool.h> | ||
2 | |||
3 | void suspend_power_down(void) {} | ||
4 | bool suspend_wakeup_condition(void) { return true; } | ||
5 | void suspend_wakeup_init(void) {} | ||
diff --git a/tmk_core/common/mbed/timer.c b/tmk_core/common/mbed/timer.c deleted file mode 100644 index 7e4070af2..000000000 --- a/tmk_core/common/mbed/timer.c +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | #include "cmsis.h" | ||
2 | #include "timer.h" | ||
3 | |||
4 | /* Mill second tick count */ | ||
5 | volatile uint32_t timer_count = 0; | ||
6 | |||
7 | /* Timer interrupt handler */ | ||
8 | void SysTick_Handler(void) { timer_count++; } | ||
9 | |||
10 | void timer_init(void) { | ||
11 | timer_count = 0; | ||
12 | SysTick_Config(SystemCoreClock / 1000); /* 1ms tick */ | ||
13 | } | ||
14 | |||
15 | void timer_clear(void) { timer_count = 0; } | ||
16 | |||
17 | uint16_t timer_read(void) { return (uint16_t)(timer_count & 0xFFFF); } | ||
18 | |||
19 | uint32_t timer_read32(void) { return timer_count; } | ||
20 | |||
21 | uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); } | ||
22 | |||
23 | uint32_t timer_elapsed32(uint32_t last) { return TIMER_DIFF_32(timer_read32(), last); } | ||
diff --git a/tmk_core/common/mbed/xprintf.cpp b/tmk_core/common/mbed/xprintf.cpp deleted file mode 100644 index 184b7fa7a..000000000 --- a/tmk_core/common/mbed/xprintf.cpp +++ /dev/null | |||
@@ -1,50 +0,0 @@ | |||
1 | #include <cstdarg> | ||
2 | //#include <stdarg.h> | ||
3 | #include "mbed.h" | ||
4 | #include "mbed/xprintf.h" | ||
5 | |||
6 | #define STRING_STACK_LIMIT 120 | ||
7 | |||
8 | // TODO | ||
9 | int __xprintf(const char* format, ...) { return 0; } | ||
10 | |||
11 | #if 0 | ||
12 | /* mbed Serial */ | ||
13 | Serial ser(UART_TX, UART_RX); | ||
14 | |||
15 | /* TODO: Need small implementation for embedded */ | ||
16 | int xprintf(const char* format, ...) | ||
17 | { | ||
18 | /* copy from mbed/common/RawSerial.cpp */ | ||
19 | std::va_list arg; | ||
20 | va_start(arg, format); | ||
21 | int len = vsnprintf(NULL, 0, format, arg); | ||
22 | if (len < STRING_STACK_LIMIT) { | ||
23 | char temp[STRING_STACK_LIMIT]; | ||
24 | vsprintf(temp, format, arg); | ||
25 | ser.puts(temp); | ||
26 | } else { | ||
27 | char *temp = new char[len + 1]; | ||
28 | vsprintf(temp, format, arg); | ||
29 | ser.puts(temp); | ||
30 | delete[] temp; | ||
31 | } | ||
32 | va_end(arg); | ||
33 | return len; | ||
34 | |||
35 | /* Fail: __builtin_va_arg_pack? | ||
36 | * https://gcc.gnu.org/onlinedocs/gcc-4.3.5/gcc/Constructing-Calls.html#Constructing-Calls | ||
37 | void *arg = __builtin_apply_args(); | ||
38 | void *ret = __builtin_apply((void*)(&(ser.printf)), arg, 100); | ||
39 | __builtin_return(ret) | ||
40 | */ | ||
41 | /* Fail: varargs can not be passed to printf | ||
42 | //int r = ser.printf("test %i\r\n", 123); | ||
43 | va_list arg; | ||
44 | va_start(arg, format); | ||
45 | int r = ser.printf(format, arg); | ||
46 | va_end(arg); | ||
47 | return r; | ||
48 | */ | ||
49 | } | ||
50 | #endif | ||
diff --git a/tmk_core/common/mbed/xprintf.h b/tmk_core/common/mbed/xprintf.h deleted file mode 100644 index e27822d3a..000000000 --- a/tmk_core/common/mbed/xprintf.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #ifndef XPRINTF_H | ||
2 | #define XPRINTF_H | ||
3 | |||
4 | //#define xprintf(format, ...) __xprintf(format, ##__VA_ARGS__) | ||
5 | |||
6 | #ifdef __cplusplus | ||
7 | extern "C" { | ||
8 | #endif | ||
9 | |||
10 | int __xprintf(const char *format, ...); | ||
11 | |||
12 | #ifdef __cplusplus | ||
13 | } | ||
14 | #endif | ||
15 | |||
16 | #endif | ||