/* ******************************************************** 一部のステータスレジスタを更新、必要に応じて割り込みを入れます。 $Id$ ********************************************************* */ #ifndef _WIN32 #pragma SFR #pragma NOP #pragma HALT #pragma STOP #endif #include "incs_loader.h" #include "renge\renge.h" #include "pm.h" #include "accero.h" #include "adc.h" #include "i2c_mcu.h" #include "led.h" /********************************************//** ステータスレジスタの、 - 蓋開閉 で割り込みが必要であれば発生させます。 todo: 統合? ***********************************************/ void tsk_status( ) { static u8 state_old; // ステータス変化検出→割り込み の為 u8 diff; // 蓋開けチェック set_bit( SHELL_OPEN, vreg_ctr[VREG_C_STATUS], REG_BIT_ST_SHELL_OPEN ); // ステータスレジスタ関係 → 割り込み // // pm.c で、その場で行います。 // REG_BIT_LCD_ON/OFF // REG_BIT_BL_ON/OFF // REG_BIT_BT_DC_CONNECT/DISC // REG_BIT_BT_CHG_START/STOP diff = (u8)( vreg_ctr[VREG_C_STATUS] ^ state_old ); if( diff != 0 ) { state_old = vreg_ctr[VREG_C_STATUS]; if( system_status.pwr_state == ON ) { if( diff & REG_BIT_BATT_CHARGE ) { // 充電状態反映 if( is_bt_charging ) // set_irqを別々に呼ぶ方がコンパクト { set_irq( VREG_C_IRQ1, REG_BIT_BT_CHG_START ); } else { set_irq( VREG_C_IRQ1, REG_BIT_BT_CHG_STOP ); } } } if(( system_status.pwr_state == ON ) || ( system_status.pwr_state == SLEEP ) ) { if( diff & REG_BIT_ST_SHELL_OPEN ) { // 蓋の開け閉め if( is_shell_open ) { set_irq( VREG_C_IRQ0, REG_BIT_SHELL_OPEN ); } else { set_irq( VREG_C_IRQ0, REG_BIT_SHELL_CLOSE ); } } } } }