aboutsummaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/infinity60/keymaps/jpetermans/keymap.c32
-rw-r--r--keyboards/infinity60/led_controller.c23
2 files changed, 40 insertions, 15 deletions
diff --git a/keyboards/infinity60/keymaps/jpetermans/keymap.c b/keyboards/infinity60/keymaps/jpetermans/keymap.c
index cfc288916..87a1afc3e 100644
--- a/keyboards/infinity60/keymaps/jpetermans/keymap.c
+++ b/keyboards/infinity60/keymaps/jpetermans/keymap.c
@@ -62,7 +62,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
62 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,KC_MUTE, KC_VOLD, KC_VOLU,_______,KC_NO,\ 62 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,KC_MUTE, KC_VOLD, KC_VOLU,_______,KC_NO,\
63 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______,_______,\ 63 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______,_______,\
64 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______, \ 64 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______, \
65 _______,_______,F(2),F(3),F(4),_______,_______, _______, KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \ 65 _______,_______,F(2),F(3),F(4),F(5),F(6),F(7), KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \
66 _______,_______,_______, KC_MPLY, _______,_______, _______,_______ \ 66 _______,_______,_______, KC_MPLY, _______,_______, _______,_______ \
67 ), 67 ),
68 /* ~ */ 68 /* ~ */
@@ -91,7 +91,9 @@ enum function_id {
91enum macro_id { 91enum macro_id {
92 ACTION_LEDS_ALL, 92 ACTION_LEDS_ALL,
93 ACTION_LEDS_GAME, 93 ACTION_LEDS_GAME,
94 ACTION_LED_1 94 ACTION_LEDS_NAV,
95 ACTION_LEDS_MEDIA,
96 ACTION_LEDS_NUMPAD
95}; 97};
96 98
97/* ================================== 99/* ==================================
@@ -170,7 +172,9 @@ const uint16_t fn_actions[] = {
170 [1] = ACTION_LAYER_MODS(_TILDE, MOD_LSFT), 172 [1] = ACTION_LAYER_MODS(_TILDE, MOD_LSFT),
171 [2] = ACTION_FUNCTION(ACTION_LEDS_ALL), 173 [2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
172 [3] = ACTION_FUNCTION(ACTION_LEDS_GAME), 174 [3] = ACTION_FUNCTION(ACTION_LEDS_GAME),
173 [4] = ACTION_FUNCTION(ACTION_LED_1) 175 [4] = ACTION_FUNCTION(ACTION_LEDS_MEDIA),
176 [5] = ACTION_FUNCTION(ACTION_LEDS_NAV),
177 [6] = ACTION_FUNCTION(ACTION_LEDS_NUMPAD)
174 178
175}; 179};
176 180
@@ -182,23 +186,35 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
182 case ACTION_LEDS_ALL: 186 case ACTION_LEDS_ALL:
183 if(record->event.pressed) { 187 if(record->event.pressed) {
184 // signal the LED controller thread 188 // signal the LED controller thread
185 msg=(TOGGLE_LED << 8) | 12; 189 msg=(TOGGLE_ALL << 8) | 0;
186 chMBPost(&led_mailbox, msg, TIME_IMMEDIATE); 190 chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
187 } 191 }
188 break; 192 break;
189 case ACTION_LEDS_GAME: 193 case ACTION_LEDS_GAME:
190 if(record->event.pressed) { 194 if(record->event.pressed) {
191 // signal the LED controller thread 195 // signal the LED controller thread
192 msg=(TOGGLE_LAYER_LEDS << 8) | 5; 196 msg=(TOGGLE_LED << 8) | 11;
193 chMBPost(&led_mailbox, msg, TIME_IMMEDIATE); 197 chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
194 } 198 }
195 break; 199 break;
196 case ACTION_LED_1: 200 case ACTION_LEDS_NAV:
197 if(record->event.pressed) { 201 if(record->event.pressed) {
198 // signal the LED controller thread 202 // signal the LED controller thread
199 chMBPost(&led_mailbox, ADDR_LED_1, TIME_IMMEDIATE); 203 msg=(TOGGLE_LAYER_LEDS << 8) | 3;
204 chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
205 }
206 case ACTION_LEDS_NUMPAD:
207 if(record->event.pressed) {
208 // signal the LED controller thread
209 msg=(TOGGLE_LAYER_LEDS << 8) | 4;
210 chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
211 }
212 case ACTION_LEDS_MEDIA:
213 if(record->event.pressed) {
214 // signal the LED controller thread
215 msg=(TOGGLE_LAYER_LEDS << 8) | 5;
216 chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
200 } 217 }
201 break;
202 } 218 }
203} 219}
204 220
diff --git a/keyboards/infinity60/led_controller.c b/keyboards/infinity60/led_controller.c
index 03f061a20..2a7431a4c 100644
--- a/keyboards/infinity60/led_controller.c
+++ b/keyboards/infinity60/led_controller.c
@@ -122,7 +122,6 @@ msg_t is31_write_register(uint8_t page, uint8_t reg, uint8_t data) {
122 is31_select_page(page); 122 is31_select_page(page);
123 tx[0] = reg; 123 tx[0] = reg;
124 tx[1] = data; 124 tx[1] = data;
125 xprintf("page display: %X\n", page);
126 return i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, tx, 2, NULL, 0, US2ST(IS31_TIMEOUT)); 125 return i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, tx, 2, NULL, 0, US2ST(IS31_TIMEOUT));
127} 126}
128 127
@@ -379,6 +378,8 @@ void set_led_bit (uint8_t *led_control_reg, uint8_t msg_led, uint8_t toggle_on)
379 ////first byte is register address 0x00 378 ////first byte is register address 0x00
380 row_byte = ((msg_led / 10) % 10 - 1 ) * 2 + 1; 379 row_byte = ((msg_led / 10) % 10 - 1 ) * 2 + 1;
381 column_bit = 1<<(msg_led % 10 - 1); 380 column_bit = 1<<(msg_led % 10 - 1);
381 xprintf("row %X\n", row_byte);
382 xprintf("col %X\n", column_bit);
382 383
383 if (toggle_on) { 384 if (toggle_on) {
384 led_control_reg[row_byte] |= 1<<(column_bit); 385 led_control_reg[row_byte] |= 1<<(column_bit);
@@ -451,15 +452,23 @@ void led_controller_init(void) {
451 /* initialise IS31 chip */ 452 /* initialise IS31 chip */
452 is31_init(); 453 is31_init();
453 454
454 /* enable LEDs on all pages */ 455 //set Display Option Register so all pwm intensity is controlled from Frame 1
455 full_page[0] = 0; 456 is31_write_register(IS31_FUNCTIONREG, IS31_REG_DISPLAYOPT, IS31_REG_DISPLAYOPT_INTENSITY_SAME);
456 __builtin_memcpy(full_page+1, is31_ic60_leds_mask, 0x12); 457
458 /* set full pwm on Frame 1 */
459 for(i=1; i<9; i++) {
460 pwm_reg_array[i]=0xFF;
461 }
457 for(i=0; i<8; i++) { 462 for(i=0; i<8; i++) {
458 is31_write_data(i, full_page, 1+0x12); 463 pwm_reg_array[0] = 0x24 + (i * 0x10);//first byte of 9 bytes must be register address
464 is31_write_data(0, pwm_reg_array, 9);
465 chThdSleepMilliseconds(5);
459 } 466 }
460 467
461 //set Display Option Register so all pwm intensity is controlled from Frame 1 468 //set all led bits on for Frame 2 LEDS_ALL
462 is31_write_register(IS31_FUNCTIONREG, IS31_REG_DISPLAYOPT, IS31_REG_DISPLAYOPT_INTENSITY_SAME); 469 full_page[0] = 0;
470 __builtin_memcpy(full_page+1, is31_ic60_leds_mask, 0x12);
471 is31_write_data(1, full_page, 1+0x12);
463 472
464 /* enable breathing when the displayed page changes */ 473 /* enable breathing when the displayed page changes */
465 // Fade-in Fade-out, time = 26ms * 2^N, N=3 474 // Fade-in Fade-out, time = 26ms * 2^N, N=3