aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-12-11 19:36:00 +0000
committerDrashna Jaelre <drashna@live.com>2019-12-11 11:36:00 -0800
commit071eb2478f039e21effb981a8a98e6181238b53b (patch)
tree061ba39b3de6080bac9adb2a3a0922624d8d047c /tmk_core/common
parent770a4ee7291095aaa6548d3e988633bf2ae6e6c0 (diff)
downloadqmk_firmware-071eb2478f039e21effb981a8a98e6181238b53b.tar.gz
qmk_firmware-071eb2478f039e21effb981a8a98e6181238b53b.zip
Remove mbed files (#7605)
* Remove mbed files * Remove mbed files - fix comment * Remove mbed logic blocks
Diffstat (limited to 'tmk_core/common')
-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
-rw-r--r--tmk_core/common/print.h33
-rw-r--r--tmk_core/common/wait.h2
7 files changed, 1 insertions, 131 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
diff --git a/tmk_core/common/print.h b/tmk_core/common/print.h
index 20189838f..04ca55810 100644
--- a/tmk_core/common/print.h
+++ b/tmk_core/common/print.h
@@ -128,38 +128,7 @@ extern "C"
128 128
129# endif /* USER_PRINT / NORMAL PRINT */ 129# endif /* USER_PRINT / NORMAL PRINT */
130 130
131# elif defined(__arm__) /* __arm__ */ 131# endif /* __AVR__ / PROTOCOL_CHIBIOS / PROTOCOL_ARM_ATSAM */
132
133# include "mbed/xprintf.h"
134
135# ifdef USER_PRINT /* USER_PRINT */
136
137// Remove normal print defines
138# define print(s)
139# define println(s)
140# define xprintf(fmt, ...)
141
142// Create user print defines
143# define uprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
144# define uprint(s) xprintf(s)
145# define uprintln(s) xprintf(s "\r\n")
146
147# else /* NORMAL PRINT */
148
149// Create user & normal print defines
150# define xprintf(fmt, ...) __xprintf(fmt, ##__VA_ARGS__)
151# define print(s) xprintf(s)
152# define println(s) xprintf(s "\r\n")
153# define uprint(s) print(s)
154# define uprintln(s) println(s)
155# define uprintf(fmt, ...) xprintf(fmt, ##__VA_ARGS__)
156
157# endif /* USER_PRINT / NORMAL PRINT */
158
159/* TODO: to select output destinations: UART/USBSerial */
160# define print_set_sendchar(func)
161
162# endif /* __AVR__ / PROTOCOL_CHIBIOS / PROTOCOL_ARM_ATSAM / __arm__ */
163 132
164// User print disables the normal print messages in the body of QMK/TMK code and 133// User print disables the normal print messages in the body of QMK/TMK code and
165// is meant as a lightweight alternative to NOPRINT. Use it when you only want to do 134// is meant as a lightweight alternative to NOPRINT. Use it when you only want to do
diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h
index cb1f386a6..c82cd2d65 100644
--- a/tmk_core/common/wait.h
+++ b/tmk_core/common/wait.h
@@ -33,8 +33,6 @@ extern "C" {
33# include "clks.h" 33# include "clks.h"
34# define wait_ms(ms) CLK_delay_ms(ms) 34# define wait_ms(ms) CLK_delay_ms(ms)
35# define wait_us(us) CLK_delay_us(us) 35# define wait_us(us) CLK_delay_us(us)
36#elif defined(__arm__)
37# include "wait_api.h"
38#else // Unit tests 36#else // Unit tests
39void wait_ms(uint32_t ms); 37void wait_ms(uint32_t ms);
40# define wait_us(us) wait_ms(us / 1000) 38# define wait_us(us) wait_ms(us / 1000)