summaryrefslogtreecommitdiffstats
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/infinity60/keymaps/jpetermans/keymap.c80
-rw-r--r--keyboards/infinity60/keymaps/jpetermans/keymap_jpetermans.h78
-rw-r--r--keyboards/infinity60/led_controller.c51
3 files changed, 152 insertions, 57 deletions
diff --git a/keyboards/infinity60/keymaps/jpetermans/keymap.c b/keyboards/infinity60/keymaps/jpetermans/keymap.c
index 2c38068fef..7b90bc8ede 100644
--- a/keyboards/infinity60/keymaps/jpetermans/keymap.c
+++ b/keyboards/infinity60/keymaps/jpetermans/keymap.c
@@ -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.
diff --git a/keyboards/infinity60/keymaps/jpetermans/keymap_jpetermans.h b/keyboards/infinity60/keymaps/jpetermans/keymap_jpetermans.h
new file mode 100644
index 0000000000..240374423c
--- /dev/null
+++ b/keyboards/infinity60/keymaps/jpetermans/keymap_jpetermans.h
@@ -0,0 +1,78 @@
+/* LED layout mainly based on default Standard configuration
+ * ,-----------------------------------------------------------.
+ * |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \ | ` |
+ * |-----------------------------------------------------------|
+ * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Bksp|
+ * |-----------------------------------------------------------|
+ * |Caps | A| S| D| F| G| H| J| K| L| ;| '|Enter |
+ * |-----------------------------------------------------------|
+ * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn0|
+ * |-----------------------------------------------------------'
+ * | LCtl|LGui|LAlt | Space | RAlt|RGui|RMenu|RCtl|
+ * `-----------------------------------------------------------'
+*/
+
+
+#define ADDR_LED_ESC 0x24
+#define ADDR_LED_1 0x25
+#define ADDR_LED_2 0x26
+#define ADDR_LED_3 0x27
+#define ADDR_LED_4 0x28
+#define ADDR_LED_5 0x29
+#define ADDR_LED_6 0x2A
+#define ADDR_LED_7 0x2B
+#define ADDR_LED_8 0x34
+#define ADDR_LED_9 0x35
+#define ADDR_LED_0 0x36
+#define ADDR_LED_MINS 0x37
+#define ADDR_LED_EQL 0x38
+#define ADDR_LED_BSLS 0x39
+//#define ADDR_LED_GRV 0x3A //not used by Alphabet layout
+#define ADDR_LED_TAB 0x3B
+#define ADDR_LED_Q 0x44
+#define ADDR_LED_W 0x45
+#define ADDR_LED_E 0x46
+#define ADDR_LED_R 0x47
+#define ADDR_LED_T 0x48
+#define ADDR_LED_Y 0x49
+#define ADDR_LED_U 0x4A
+#define ADDR_LED_I 0x4B
+#define ADDR_LED_O 0x54
+#define ADDR_LED_P 0x55
+#define ADDR_LED_LBRC 0x56
+#define ADDR_LED_RBRC 0x57
+#define ADDR_LED_BSPC 0x58
+#define ADDR_LED_CAPS 0x59
+#define ADDR_LED_A 0x5A
+#define ADDR_LED_S 0x5B
+#define ADDR_LED_D 0x64
+#define ADDR_LED_F 0x65
+#define ADDR_LED_G 0x66
+#define ADDR_LED_H 0x67
+#define ADDR_LED_J 0x68
+#define ADDR_LED_K 0x69
+#define ADDR_LED_L 0x6A
+#define ADDR_LED_SCLN 0x6B
+#define ADDR_LED_QUOT 0x74
+#define ADDR_LED_ENT 0x75
+#define ADDR_LED_LSFT 0x76
+#define ADDR_LED_Z 0x77
+#define ADDR_LED_X 0x78
+#define ADDR_LED_C 0x79
+#define ADDR_LED_V 0x7A
+#define ADDR_LED_B 0x7B
+#define ADDR_LED_N 0x84
+#define ADDR_LED_M 0x85
+#define ADDR_LED_COMM 0x86
+#define ADDR_LED_DOT 0x87
+#define ADDR_LED_SLSH 0x88
+#define ADDR_LED_RSFT 0x89
+//#define ADDR_LED_FN0 0x8A //not used by Alphabet layout
+#define ADDR_LED_LCTL 0x8B
+#define ADDR_LED_LGUI 0x94
+#define ADDR_LED_LALT 0x95
+#define ADDR_LED_SPC 0x96
+#define ADDR_LED_RALT 0x97
+#define ADDR_LED_RGUI 0x98
+#define ADDR_LED_MENU 0x99
+#define ADDR_LED_RCTL 0x9A
diff --git a/keyboards/infinity60/led_controller.c b/keyboards/infinity60/led_controller.c
index c5303a3e70..9579bc08b4 100644
--- a/keyboards/infinity60/led_controller.c
+++ b/keyboards/infinity60/led_controller.c
@@ -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);