Moved led page arrays to keymap.c and added keymap header to define
individual led addresses
This commit is contained in:
parent
56be300757
commit
af13e9a12d
3 changed files with 152 additions and 57 deletions
|
@ -171,6 +171,7 @@ static THD_FUNCTION(LEDthread, arg) {
|
|||
|
||||
// process 'msg' here
|
||||
switch(msg) {
|
||||
//TODO: make this generic and able to turn on/off any address and loop through all(or current) pages
|
||||
case LED_MSG_CAPS_ON:
|
||||
// turn caps on on pages 1 and 2
|
||||
is31_write_register(0, CAPS_LOCK_LED_ADDRESS, 0xFF);
|
||||
|
@ -238,48 +239,6 @@ static THD_FUNCTION(LEDthread, arg) {
|
|||
}
|
||||
}
|
||||
|
||||
//These relate to the LED map above, row and column
|
||||
//0x24 = first byte (CA1) of PWM page, 0x34 is 17th byte (CA2)
|
||||
/* LED game mode */
|
||||
const uint8_t led_game[72] = {
|
||||
0x24,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x34,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x44,
|
||||
0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x54,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
|
||||
0x64,
|
||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x74,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x84,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x94,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
|
||||
/* ALL LEDs */
|
||||
const uint8_t led_all[72] = {
|
||||
0x24,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x34,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x44,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x54,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x64,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x74,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x84,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0x94,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
/* =============
|
||||
* hook into TMK
|
||||
* ============= */
|
||||
|
@ -315,14 +274,6 @@ void led_controller_init(void) {
|
|||
is31_write_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL1, (3<<4)|3);
|
||||
is31_write_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL2, IS31_REG_BREATHCTRL2_ENABLE|3);
|
||||
|
||||
/* Write pages */
|
||||
for(i=0; i<8; i++) {
|
||||
is31_write_data(1,(uint8_t *)(led_game+(9*i)),9);
|
||||
chThdSleepMilliseconds(5);
|
||||
is31_write_data(2,(uint8_t *)(led_all+(9*i)),9);
|
||||
chThdSleepMilliseconds(5);
|
||||
}
|
||||
|
||||
// clean up the capslock LED
|
||||
is31_write_register(1, CAPS_LOCK_LED_ADDRESS, 0);
|
||||
is31_write_register(2, CAPS_LOCK_LED_ADDRESS, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue