-/* case LED_MSG_SLEEP_LED_ON:
- // save current settings
- is31_read_register(IS31_FUNCTIONREG, IS31_REG_PICTDISP, &save_page);
- is31_read_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL1, &save_breath1);
- is31_read_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL2, &save_breath2);
- // use pages 7 and 8 for (hardware) breathing (assuming they're empty)
- is31_write_register(6, BREATHE_LED_ADDRESS, 0xFF);
- is31_write_register(7, BREATHE_LED_ADDRESS, 0x00);
- is31_write_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL1, (6<<4)|6);
- is31_write_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL2, IS31_REG_BREATHCTRL2_ENABLE|3);
- retval = MSG_TIMEOUT;
- temp = 6;
- while(retval == MSG_TIMEOUT) {
- // switch to the other page
- is31_write_register(IS31_FUNCTIONREG, IS31_REG_PICTDISP, temp);
- temp = (temp == 6 ? 7 : 6);
- // the times should be sufficiently long for IS31 to finish switching pages
- retval = chMBFetch(&led_mailbox, &msg, MS2ST(temp == 6 ? 4000 : 6000));
- }
- // received a message (should be a wakeup), so restore previous state
- chThdSleepMilliseconds(3000); // need to wait until the page change finishes
- // note: any other messages are queued
- is31_write_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL1, save_breath1);
- is31_write_register(IS31_FUNCTIONREG, IS31_REG_BREATHCTRL2, save_breath2);
- is31_write_register(IS31_FUNCTIONREG, IS31_REG_PICTDISP, save_page);
- break;
- case LED_MSG_SLEEP_LED_OFF:
- // should not get here; wakeup should be received in the branch above break;
- break;
-*/
- xprintf("--------------------\n");
- chThdSleepMilliseconds(10);
- }
-#if DEBUG_ENABLED
- uint8_t j;
- uint8_t pages[3]={0x00, 0x07};
- //debugging code - print full led/blink/pwm registers on each frame
- xprintf("----layer state----: %X\n", layer_state);
- for(i=0;i<2;i++) {
- xprintf("page: %d\n", pages[i]);
- chThdSleepMilliseconds(2);
- for(j=0;j<0x24;j++){
- if(j > 0 && j % 9 == 0){
- xprintf("\n");
- }
- switch (j) {
- case 0:
- xprintf("\n--on-off--\n");
- chThdSleepMilliseconds(2);
- break;
- case 0x12:
- xprintf("\n--blink--\n");
- chThdSleepMilliseconds(2);
- break;