aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/mbed
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/mbed')
-rw-r--r--tmk_core/common/mbed/bootloader.c3
-rw-r--r--tmk_core/common/mbed/suspend.c5
-rw-r--r--tmk_core/common/mbed/timer.c23
-rw-r--r--tmk_core/common/mbed/xprintf.cpp50
-rw-r--r--tmk_core/common/mbed/xprintf.h16
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
3void 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
3void suspend_power_down(void) {}
4bool suspend_wakeup_condition(void) { return true; }
5void 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 */
5volatile uint32_t timer_count = 0;
6
7/* Timer interrupt handler */
8void SysTick_Handler(void) { timer_count++; }
9
10void timer_init(void) {
11 timer_count = 0;
12 SysTick_Config(SystemCoreClock / 1000); /* 1ms tick */
13}
14
15void timer_clear(void) { timer_count = 0; }
16
17uint16_t timer_read(void) { return (uint16_t)(timer_count & 0xFFFF); }
18
19uint32_t timer_read32(void) { return timer_count; }
20
21uint16_t timer_elapsed(uint16_t last) { return TIMER_DIFF_16(timer_read(), last); }
22
23uint32_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
9int __xprintf(const char* format, ...) { return 0; }
10
11#if 0
12/* mbed Serial */
13Serial ser(UART_TX, UART_RX);
14
15/* TODO: Need small implementation for embedded */
16int 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
7extern "C" {
8#endif
9
10int __xprintf(const char *format, ...);
11
12#ifdef __cplusplus
13}
14#endif
15
16#endif