aboutsummaryrefslogtreecommitdiff
path: root/keyboards/infinity60/led_controller.c
diff options
context:
space:
mode:
authorjpetermans <tibcmhhm@gmail.com>2017-04-13 17:51:37 -0700
committerjpetermans <tibcmhhm@gmail.com>2017-04-13 17:51:37 -0700
commitec1e936dfbb3b346ce74394c0ed92b5e279480d4 (patch)
tree2f71040c4f45b190964e874ac0fb136d6de80d79 /keyboards/infinity60/led_controller.c
parent1b1adf35bb746a875c2b846e1b1b405075c94847 (diff)
downloadqmk_firmware-ec1e936dfbb3b346ce74394c0ed92b5e279480d4.tar.gz
qmk_firmware-ec1e936dfbb3b346ce74394c0ed92b5e279480d4.zip
fixed bit shift in led_set_bit
Diffstat (limited to 'keyboards/infinity60/led_controller.c')
-rw-r--r--keyboards/infinity60/led_controller.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/keyboards/infinity60/led_controller.c b/keyboards/infinity60/led_controller.c
index eb3ccafc1..e98d8de50 100644
--- a/keyboards/infinity60/led_controller.c
+++ b/keyboards/infinity60/led_controller.c
@@ -376,26 +376,40 @@ void set_led_bit (uint8_t page, uint8_t *led_control_reg, uint8_t led_addr, uint
376 uint8_t control_reg_addr, column_bit, column_byte, temp; 376 uint8_t control_reg_addr, column_bit, column_byte, temp;
377 //first byte is led control register address 0x00 377 //first byte is led control register address 0x00
378 //msg_led tens column is pin#, ones column is bit position in 8-bit mask 378 //msg_led tens column is pin#, ones column is bit position in 8-bit mask
379 chThdSleepMilliseconds(10);
380 xprintf("led_addr: %d ", led_addr);
379 control_reg_addr = ((led_addr / 10) % 10 - 1 ) * 0x02;// A-register is every other byte 381 control_reg_addr = ((led_addr / 10) % 10 - 1 ) * 0x02;// A-register is every other byte
380 column_bit = 1<<(led_addr % 10 - 1); 382 column_bit = 1<<(led_addr % 10 - 1);
381 383
382 is31_read_register(page,control_reg_addr,&temp);//need to maintain status of leds in this row (1 byte) 384 is31_read_register(page,control_reg_addr,&temp);//need to maintain status of leds in this row (1 byte)
385 chThdSleepMilliseconds(10);
386 xprintf("col_bit: %X ", column_bit);
383 column_byte = temp; 387 column_byte = temp;
384 388
389 chThdSleepMilliseconds(10);
390 xprintf("action: %X ", action);
385 switch(action) { 391 switch(action) {
386 case 0: 392 case 0:
387 column_byte &= ~1<<(column_bit); 393 xprintf("off-");
394 chThdSleepMilliseconds(10);
395 column_byte &= ~column_bit;
388 break; 396 break;
389 case 1: 397 case 1:
390 column_byte |= 1<<(column_bit); 398 xprintf("on-");
399 chThdSleepMilliseconds(10);
400 column_byte |= column_bit;
391 break; 401 break;
392 case 2: 402 case 2:
393 column_byte ^= 1<<(column_bit); 403 xprintf("toggle-");
404 chThdSleepMilliseconds(10);
405 column_byte ^= column_bit;
394 break; 406 break;
395 } 407 }
396 408
397 led_control_reg[0] = control_reg_addr; 409 led_control_reg[0] = control_reg_addr;
398 led_control_reg[1] = column_byte; 410 led_control_reg[1] = column_byte;
411 chThdSleepMilliseconds(10);
412 xprintf("set_bit row: %X set_bit col: %X\n", led_control_reg[0], led_control_reg[1]);
399} 413}
400 414
401void set_lock_leds(uint8_t lock_type, uint8_t led_on) { 415void set_lock_leds(uint8_t lock_type, uint8_t led_on) {
@@ -427,11 +441,13 @@ void set_lock_leds(uint8_t lock_type, uint8_t led_on) {
427 #endif 441 #endif
428 } 442 }
429 443
430 for(page=BACKLIGHT_OFF_LOCK_LED_OFF; page<8; page++) { //set in led_controller.h 444 for(page=0; page<8; page++) { //set in led_controller.h
431 //TODO: check if frame2 (or frame1, first byte all on), and ignore if true 445 //TODO: check if frame2 (or frame1, first byte all on), and ignore if true
432 //also if BACKLIGHT_OFF_LOCK_LED_OFF set 446 //also if BACKLIGHT_OFF_LOCK_LED_OFF set
433 set_led_bit(page,led_control_write,led_addr,led_on); 447 set_led_bit(page,led_control_write,led_addr,led_on);
434 is31_write_data (page, led_control_write, 0x02); 448 xprintf("lock_led row: %X lock_led col%X\n", led_control_write[0], led_control_write[1]);
449 is31_write_data(page, led_control_write, 0x02);
450 chThdSleepMilliseconds(10);
435 } 451 }
436} 452}
437 453