1
0
Fork 0

Moved led page arrays to keymap.c and added keymap header to define

individual led addresses
This commit is contained in:
jpetermans 2017-04-06 16:27:51 -07:00
parent 56be300757
commit af13e9a12d
3 changed files with 152 additions and 57 deletions

View file

@ -1,5 +1,6 @@
#include "infinity60.h"
#include "led_controller.h"
#include "keymap_jpetermans.h"
//Helpful Defines
#define _______ KC_TRNS
@ -86,6 +87,66 @@ enum function_id {
enum macro_id {
ACTION_LEDS_ALL,
ACTION_LEDS_GAME
//TODO: ACTION_LED_LAYER which reads current layer and turns on appropriate LED
};
/*
Configuring led control can be done
1. full keyboard at a time - define led array, or
2. individual - send specific led address (defined in keymap.h)
The arrays relate to the mcu's LED pages (8 available) desribed in led_controller.c
0x24 (pcb row 1) is first byte of PWM portion of LED page
0x34 (pcb row 2) is 17th byte of PWM portion of LED page
array translates to row and column positions
Infinity60 LED MAP
11 12 13 14 15 16 17 18 21 22 23 24 25 26 27*
28 31 32 33 34 35 36 37 38 41 42 43 44 45
46 47 48 51 52 53 54 55 56 57 58 61 62
63 64 65 66 67 68 71 72 73 74 75 76 77*
78 81 82 83 84 85 86 87
*Unused in Alphabet Layout
*/
//"WASD"
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,
};
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,
};
const uint16_t fn_actions[] = {
@ -94,13 +155,6 @@ const uint16_t fn_actions[] = {
[2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
[3] = ACTION_FUNCTION(ACTION_LEDS_GAME)
/* [1] = ACTION_FUNCTION(ACTION_LEDS_GAME),
[4] = ACTION_USAGE_CONSUMER(0x1B4),
[5] = ACTION_USAGE_CONSUMER(0x196),
[6] = ACTION_USAGE_CONSUMER(0x1A6),
[7] = ACTION_USAGE_CONSUMER(0x1A0)
*/
};
/* custom action function */
@ -140,7 +194,19 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
uint8_t j;
led_controller_init();
//TODO: do pages need to be written at init or ok on demand?
/* Write pages */
for(j=0; j<8; j++) {
is31_write_data(1,(uint8_t *)(led_game+(9*j)),9);
chThdSleepMilliseconds(5);
is31_write_data(2,(uint8_t *)(led_all+(9*j)),9);
chThdSleepMilliseconds(5);
}
};
// Runs constantly in the background, in a loop.