diff options
| author | jpetermans <tibcmhhm@gmail.com> | 2017-04-10 22:23:45 -0700 |
|---|---|---|
| committer | jpetermans <tibcmhhm@gmail.com> | 2017-04-10 22:23:45 -0700 |
| commit | d8e9c183bef146bc4b42c7f15d5c44c7abd5118f (patch) | |
| tree | 62f7d3a6d2b8df2eb4843a35a34108e950c8c38e /keyboards/infinity60/led_controller.c | |
| parent | dda858c437e2fd0336f070ccb5d1f6e412815d9a (diff) | |
| download | qmk_firmware-d8e9c183bef146bc4b42c7f15d5c44c7abd5118f.tar.gz qmk_firmware-d8e9c183bef146bc4b42c7f15d5c44c7abd5118f.zip | |
led init code missing pwm writes for Frame 1
Diffstat (limited to 'keyboards/infinity60/led_controller.c')
| -rw-r--r-- | keyboards/infinity60/led_controller.c | 23 |
1 files changed, 16 insertions, 7 deletions
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 |
