From dc9fc9a7a457d44efc45f1dce51db3c5d4bc17c9 Mon Sep 17 00:00:00 2001 From: flabbergast Date: Thu, 10 Sep 2015 10:31:19 +0100 Subject: [PATCH] Add basic sleep_led for chibios. --- tmk_core/common/chibios/printf.h | 12 ++++++------ tmk_core/common/chibios/sleep_led.c | 19 +++++++++++++++++++ tmk_core/common/chibios/timer.c | 2 +- tmk_core/protocol/chibios/README.md | 13 +++++++++---- tmk_core/protocol/chibios/main.c | 25 +++++++++++++++++++++++++ tmk_core/protocol/chibios/usb_main.c | 2 ++ tmk_core/protocol/chibios/usb_main.h | 3 +++ 7 files changed, 65 insertions(+), 11 deletions(-) create mode 100644 tmk_core/common/chibios/sleep_led.c diff --git a/tmk_core/common/chibios/printf.h b/tmk_core/common/chibios/printf.h index 00813198..678a100c 100644 --- a/tmk_core/common/chibios/printf.h +++ b/tmk_core/common/chibios/printf.h @@ -55,16 +55,16 @@ many embedded systems. To use the printf you need to supply your own character output function, something like : - void putc ( void* p, char c) - { - while (!SERIAL_PORT_EMPTY) ; - SERIAL_PORT_TX_REGISTER = c; - } + void putc ( void* p, char c) + { + while (!SERIAL_PORT_EMPTY) ; + SERIAL_PORT_TX_REGISTER = c; + } Before you can call printf you need to initialize it to use your character output function with something like: - init_printf(NULL,putc); + init_printf(NULL,putc); Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc', the NULL (or any pointer) you pass into the 'init_printf' will eventually be diff --git a/tmk_core/common/chibios/sleep_led.c b/tmk_core/common/chibios/sleep_led.c new file mode 100644 index 00000000..b08c9c2a --- /dev/null +++ b/tmk_core/common/chibios/sleep_led.c @@ -0,0 +1,19 @@ +#include "ch.h" + +#include "led.h" +#include "sleep_led.h" + +void sleep_led_init(void) { +} + +void sleep_led_enable(void) { + led_set(1<