summaryrefslogtreecommitdiffstats
path: root/keyboards/infinity60
diff options
context:
space:
mode:
authorjpetermans <tibcmhhm@gmail.com>2017-04-11 07:23:45 +0200
committerjpetermans <tibcmhhm@gmail.com>2017-04-11 07:23:45 +0200
commitd8e9c183bef146bc4b42c7f15d5c44c7abd5118f (patch)
tree62f7d3a6d2b8df2eb4843a35a34108e950c8c38e /keyboards/infinity60
parentdda858c437e2fd0336f070ccb5d1f6e412815d9a (diff)
downloadqmk_firmware-d8e9c183bef146bc4b42c7f15d5c44c7abd5118f.tar.gz
qmk_firmware-d8e9c183bef146bc4b42c7f15d5c44c7abd5118f.tar.xz
led init code missing pwm writes for Frame 1
Diffstat (limited to 'keyboards/infinity60')
-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] = {
_______,_______,_______,_______,_______,_______,_______, _______, _______, _______,KC_MUTE, KC_VOLD, KC_VOLU,_______,KC_NO,\
_______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______,_______,\
_______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______, \
- _______,_______,F(2),F(3),F(4),_______,_______, _______, KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \
+ _______,_______,F(2),F(3),F(4),F(5),F(6),F(7), KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \
_______,_______,_______, KC_MPLY, _______,_______, _______,_______ \
),
/* ~ */
@@ -91,7 +91,9 @@ enum function_id {
enum macro_id {
ACTION_LEDS_ALL,
ACTION_LEDS_GAME,
- ACTION_LED_1
+ ACTION_LEDS_NAV,
+ ACTION_LEDS_MEDIA,
+ ACTION_LEDS_NUMPAD
};
/* ==================================
@@ -170,7 +172,9 @@ const uint16_t fn_actions[] = {
[1] = ACTION_LAYER_MODS(_TILDE, MOD_LSFT),
[2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
[3] = ACTION_FUNCTION(ACTION_LEDS_GAME),
- [4] = ACTION_FUNCTION(ACTION_LED_1)
+ [4] = ACTION_FUNCTION(ACTION_LEDS_MEDIA),
+ [5] = ACTION_FUNCTION(ACTION_LEDS_NAV),
+ [6] = ACTION_FUNCTION(ACTION_LEDS_NUMPAD)
};
@@ -182,23 +186,35 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
case ACTION_LEDS_ALL:
if(record->event.pressed) {
// signal the LED controller thread
- msg=(TOGGLE_LED << 8) | 12;
+ msg=(TOGGLE_ALL << 8) | 0;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
break;
case ACTION_LEDS_GAME:
if(record->event.pressed) {
// signal the LED controller thread
- msg=(TOGGLE_LAYER_LEDS << 8) | 5;
+ msg=(TOGGLE_LED << 8) | 11;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
break;
- case ACTION_LED_1:
+ case ACTION_LEDS_NAV:
if(record->event.pressed) {
// signal the LED controller thread
- chMBPost(&led_mailbox, ADDR_LED_1, TIME_IMMEDIATE);
+ msg=(TOGGLE_LAYER_LEDS << 8) | 3;
+ chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
+ }
+ case ACTION_LEDS_NUMPAD:
+ if(record->event.pressed) {
+ // signal the LED controller thread
+ msg=(TOGGLE_LAYER_LEDS << 8) | 4;
+ chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
+ }
+ case ACTION_LEDS_MEDIA:
+ if(record->event.pressed) {
+ // signal the LED controller thread
+ msg=(TOGGLE_LAYER_LEDS << 8) | 5;
+ chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
- break;
}
}
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) {
is31_select_page(page);
tx[0] = reg;
tx[1] = data;
- xprintf("page display: %X\n", page);
return i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, tx, 2, NULL, 0, US2ST(IS31_TIMEOUT));
}
@@ -379,6 +378,8 @@ void set_led_bit (uint8_t *led_control_reg, uint8_t msg_led, uint8_t toggle_on)
////first byte is register address 0x00
row_byte = ((msg_led / 10) % 10 - 1 ) * 2 + 1;
column_bit = 1<<(msg_led % 10 - 1);
+ xprintf("row %X\n", row_byte);
+ xprintf("col %X\n", column_bit);
if (toggle_on) {
led_control_reg[row_byte] |= 1<<(column_bit);
@@ -451,15 +452,23 @@ void led_controller_init(void) {
/* initialise IS31 chip */
is31_init();
- /* enable LEDs on all pages */
- full_page[0] = 0;
- __builtin_memcpy(full_page+1, is31_ic60_leds_mask, 0x12);
+ //set Display Option Register so all pwm intensity is controlled from Frame 1
+ is31_write_register(IS31_FUNCTIONREG, IS31_REG_DISPLAYOPT, IS31_REG_DISPLAYOPT_INTENSITY_SAME);
+
+ /* set full pwm on Frame 1 */
+ for(i=1; i<9; i++) {
+ pwm_reg_array[i]=0xFF;
+ }
for(i=0; i<8; i++) {
- is31_write_data(i, full_page, 1+0x12);
+ pwm_reg_array[0] = 0x24 + (i * 0x10);//first byte of 9 bytes must be register address
+ is31_write_data(0, pwm_reg_array, 9);
+ chThdSleepMilliseconds(5);
}
- //set Display Option Register so all pwm intensity is controlled from Frame 1
- is31_write_register(IS31_FUNCTIONREG, IS31_REG_DISPLAYOPT, IS31_REG_DISPLAYOPT_INTENSITY_SAME);
+ //set all led bits on for Frame 2 LEDS_ALL
+ full_page[0] = 0;
+ __builtin_memcpy(full_page+1, is31_ic60_leds_mask, 0x12);
+ is31_write_data(1, full_page, 1+0x12);
/* enable breathing when the displayed page changes */
// Fade-in Fade-out, time = 26ms * 2^N, N=3