Add basic sleep_led for chibios.
This commit is contained in:
parent
7d4f3dd5a1
commit
dc9fc9a7a4
7 changed files with 65 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
19
tmk_core/common/chibios/sleep_led.c
Normal file
19
tmk_core/common/chibios/sleep_led.c
Normal file
|
|
@ -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<<USB_LED_CAPS_LOCK);
|
||||
}
|
||||
|
||||
void sleep_led_disable(void) {
|
||||
led_set(0);
|
||||
}
|
||||
|
||||
void sleep_led_toggle(void) {
|
||||
// not working yet, state not saved anywhere currently
|
||||
}
|
||||
|
|
@ -23,5 +23,5 @@ uint16_t timer_elapsed(uint16_t last)
|
|||
|
||||
uint32_t timer_elapsed32(uint32_t last)
|
||||
{
|
||||
return ST2MS(chVTTimeElapsedSinceX(MS2ST(last)));
|
||||
return ST2MS(chVTTimeElapsedSinceX(MS2ST(last)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue