Browse Source

Add keyboard LED control via Bluetooth

ledmap
tmk 9 years ago
parent
commit
bfd2d969b4

+ 4
- 2
keyboard/hhkb_rn42/rn42/rn42.c View File

} }




static uint8_t keyboard_leds(void) { return 0; }
static uint8_t leds = 0;
static uint8_t keyboard_leds(void) { return leds; }
void rn42_set_leds(uint8_t l) { leds = l; }


static void send_keyboard(report_keyboard_t *report) static void send_keyboard(report_keyboard_t *report)
{ {
config_send_consumer config_send_consumer
}; };


static uint8_t config_keyboard_leds(void) { return 0; }
static uint8_t config_keyboard_leds(void) { return leds; }
static void config_send_keyboard(report_keyboard_t *report) {} static void config_send_keyboard(report_keyboard_t *report) {}
static void config_send_mouse(report_mouse_t *report) {} static void config_send_mouse(report_mouse_t *report) {}
static void config_send_system(uint16_t data) {} static void config_send_system(uint16_t data) {}

+ 1
- 0
keyboard/hhkb_rn42/rn42/rn42.h View File

void rn42_cts_hi(void); void rn42_cts_hi(void);
void rn42_cts_lo(void); void rn42_cts_lo(void);
bool rn42_linked(void); bool rn42_linked(void);
void rn42_set_leds(uint8_t l);


#endif #endif

+ 3
- 3
keyboard/hhkb_rn42/rn42/rn42_task.c View File

#include "lufa.h" #include "lufa.h"
#include "rn42_task.h" #include "rn42_task.h"
#include "print.h" #include "print.h"
#include "debug.h"
#include "timer.h" #include "timer.h"
#include "command.h" #include "command.h"
#include "battery.h" #include "battery.h"
// LED Out report: 0xFE, 0x02, 0x01, <leds> // LED Out report: 0xFE, 0x02, 0x01, <leds>
// To get the report over UART set bit3 with SH, command. // To get the report over UART set bit3 with SH, command.
static enum {LED_INIT, LED_FE, LED_02, LED_01} state = LED_INIT; static enum {LED_INIT, LED_FE, LED_02, LED_01} state = LED_INIT;
xprintf("%02X\n", c);
switch (state) { switch (state) {
case LED_INIT: case LED_INIT:
if (c == 0xFE) state = LED_FE; if (c == 0xFE) state = LED_FE;
else state = LED_INIT; else state = LED_INIT;
break; break;
case LED_01: case LED_01:
// TODO: move to rn42.c and make accessible with keyboard_leds()
xprintf("LED status: %02X\n", c);
dprintf("LED status: %02X\n", c);
rn42_set_leds(c);
state = LED_INIT; state = LED_INIT;
break; break;
default: default: