-
-/* 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);
- }
- }
-}
-
-/* ==============================
- * debug function
- * ============================== */
-void print_debug(uint8_t page) {
- uint8_t j, debug_temp;
- //debugging code - print full led/blink/pwm registers on each frame
- xprintf("----layer state----: %X\n", layer_state);
- xprintf("page: %d\n", page);
- chThdSleepMilliseconds(10);
- for(j=0;j<0x24;j++){
- if(j > 0 && j % 9 == 0){
- xprintf("\n");
- }
- switch (j) {
- case 0:
- xprintf("\n--on-off--\n");
- chThdSleepMilliseconds(10);
- break;
- case 0x12:
- xprintf("\n--blink--\n");
- chThdSleepMilliseconds(10);
- break;
- }
- is31_read_register(page,j,&debug_temp);
- xprintf("%02X, ", debug_temp);
- chThdSleepMilliseconds(10);
- }
-
- xprintf("\n--pwm--\n");
- chThdSleepMilliseconds(10);
- for(j=0x24;j<0xB4;j++) {
- is31_read_register(page,j,&debug_temp);
- xprintf("%02X, ", debug_temp);
- chThdSleepMilliseconds(10);
- if(j > 0x24 && (j-3) % 8 == 0){
- xprintf("\n");
- }
- }
- xprintf("\n");
-
- //Function Register
- xprintf("\n--FUNCTION--\n");
- chThdSleepMilliseconds(10);
- for(j=0;j<0x0D;j++) {
- is31_read_register(0x0B,j,&debug_temp);
- switch(j) {
- case 0:
- xprintf("Config %02X", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 1:
- xprintf(" - Pict %02X\n", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 2:
- xprintf("Auto1 %02X", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 3:
- xprintf(" - Auto2 %02X\n", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 5:
- xprintf("Disp %02X", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 6:
- xprintf(" - Audio %02X\n", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 7:
- xprintf("Frame %02X", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 8:
- xprintf(" - Breath1 %02X\n", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 9:
- xprintf("Breath2 %02X - ", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 10:
- xprintf(" - Shut %02X\n", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 11:
- xprintf("AGC %02X", debug_temp);
- chThdSleepMilliseconds(2);
- break;
- case 12:
- xprintf(" - ADC %02X\n", debug_temp);
- chThdSleepMilliseconds(2);
- break;