#include "macrodriver.h" #include "System.h" #include "Port.h" #include "Timer.h" #include "SW_I2C.h" // jhl #include "user_define.h" // jhl #include "demo.h" // jhl /****************************************************************************** デバッグがさびしいので、デモ。 ******************************************************************************/ void demos(){ // demo_pwr_led_0_inv_dim(); // demo_dcp_0_trig(); // こいつは1ms位掛かる } #if 0 /****************************************************************************** DCP 三角波を出し続けるデモ ******************************************************************************/ static void demo_dcp_0_trig(){ static unsigned char i,j; static char direction = 0; if( ++i == 100 ){ i = 0; if( direction == 0 ){ if( dcp_inc_vol() != 0 ){ direction = 1; } }else{ if( dcp_dec_vol() != 0 ){ direction = 0; } } } } #endif /****************************************************************************** 動作確認用LEDデモ ******************************************************************************/ static void demo_pwr_led_0_inv_dim(){ static unsigned char i,j; if( i++ == 9 ){ i = 0; if( ++j == 100 ){ j = 0; } // TMH0_ChangeDuty( j ); // TMH1_ChangeDuty( 100 - j ); } } /*****************************************************************************  デバッグタスク  フラッシュ耐久試験など 意味なかった ****************************************************************************/ void tsk_eep_test(){ #ifdef _eep_test_ static u8 flash_status[17]; static u8 count_H = 0; static u8 count_M = 0; static u8 count_L = 0; static u8 count_BC_H = 0; static u8 count_BC_L = 0; flash_enable(); flash_status[ 15 ] = flash_write( DAT_BL_BRIGHT, &count_L ); if( flash_status[ 15 ] == 0x00 ){ // 正常書き込み正常終了 if( ++count_L == 100 ){ count_L = 0; if( ++count_M == 100 ){ count_M = 0; if( ++count_H == 100 ){ count_H = 0; } } } } if( ( flash_status[15] == 0xF5 ) // ブロックデータフル || ( flash_status[15] == 0xF6 ) // 書き込みエラー || ( flash_status[15] == 0xFA ) ){ // 有効ブロックなし flash_status[6] = flash_erase(); flash_status[14] = flash_block_change(); if( flash_status[14] == 0 ){ if( ++count_BC_L == 100 ){ count_BC_L = 0; ++count_BC_H; } flash_status[7] = count_BC_H; flash_status[8] = count_BC_L; }else{ flash_status[5] = flash_status[14]; } } flash_disable(); if( ( flash_status[15] != 0x00 ) && ( flash_status[15] != 0xF5 ) ){ flash_status[4] = flash_status[15]; } flash_status[ 0 ] = count_H; flash_status[ 1 ] = count_M; flash_status[ 2 ] = count_L; flash_status[ 3 ] = self_free_space(); flash_status[ 9 ] = 0; iic2m_write_nmem( IIC_SLV_ADDR_MONITOR, 0x5A, flash_status, 9 ); #endif }