diff --git a/trunk/adc.c b/trunk/adc.c index cf87bdc..0c4cd83 100644 --- a/trunk/adc.c +++ b/trunk/adc.c @@ -40,7 +40,7 @@ typedef struct filter_work filter_work work_vr_3d = { - &vreg_ctr[ VREG_C_TUNE ] + &vreg_ctr[ VREG_C_3D ] }; @@ -85,7 +85,7 @@ static u8 adc_scaling( u8 ); ======================================================== */ void tsk_adc( ) { - static u8 old_tune; + static u8 old_3D; static u8 sndvol_codec; static u8 bt_temp_old; @@ -94,7 +94,7 @@ void tsk_adc( ) adc_updated = false; // 3D ///////////////////////////////////////// - vreg_ctr[ VREG_C_TUNE ] = adc_raw_dep; // 生値 + vreg_ctr[ VREG_C_3D ] = adc_raw_dep; // 生値 // Volume ///////////////////////////////////// { @@ -129,7 +129,7 @@ void tsk_adc( ) ADM = 0b00001011; // セレクトモード、昇圧、fCLK/6 ///ここから ↓ ADPC = 0x06; // ADCポートのセレクト - ADS = ADC_SEL_TUNE; + ADS = ADC_SEL_3D; nop8(); ADCS = 1; // AD開始。 /// ここまで ↑ までに1us=8clk以上開ける @@ -323,7 +323,7 @@ static u8 getmean3( u8 * hist ) ======================================================== */ __interrupt void int_adc( ) { - static u8 hist_tune[3]; + static u8 hist_3D[3]; static u8 hist_snd_vol[3]; static u8 hist_bt_temp[3]; static u8 index; @@ -340,7 +340,7 @@ case ( ADC_SEL_AMB_BRIT ): // break; */ - case ( ADC_SEL_TUNE ): + case ( ADC_SEL_3D ): EI(); adc_raw_dep = adc_data; break; @@ -520,7 +520,7 @@ static void adc_filter( u8 new_val, filter_work *work ) // getmean使用 // __interrupt void int_adc( ) { - static u8 hist_tune[3]; + static u8 hist_3D[3]; static u8 hist_snd_vol[3]; static u8 hist_bt_temp[3]; static u8 index; @@ -537,13 +537,13 @@ case ( ADC_SEL_AMB_BRIT ): // break; */ - case ( ADC_SEL_TUNE ): - hist_tune[index] = adc_data; + case ( ADC_SEL_3D ): + hist_3D[index] = adc_data; EI(); #ifdef _MODEL_WM0_ - adc_raw_dep = 255 - getmean3( hist_tune ); + adc_raw_dep = 255 - getmean3( hist_3D ); #else - adc_raw_dep = getmean3( hist_tune ); + adc_raw_dep = getmean3( hist_3D ); #endif break; diff --git a/trunk/adc.h b/trunk/adc.h index d49c5da..6f4ad04 100644 --- a/trunk/adc.h +++ b/trunk/adc.h @@ -17,7 +17,7 @@ */ // ANI6 P26 -#define ADC_SEL_TUNE 0x06 +#define ADC_SEL_3D 0x06 // ANI7 P27 #define ADC_SEL_VOL 0x07 diff --git a/trunk/bsr.lmf b/trunk/bsr.lmf index 6300bdc..d24015f 100644 Binary files a/trunk/bsr.lmf and b/trunk/bsr.lmf differ diff --git a/trunk/hoge.bin b/trunk/hoge.bin index e109ffa..a252c7f 100644 Binary files a/trunk/hoge.bin and b/trunk/hoge.bin differ diff --git a/trunk/i2c_mcu.c b/trunk/i2c_mcu.c index ecdfd6a..7ee4929 100644 --- a/trunk/i2c_mcu.c +++ b/trunk/i2c_mcu.c @@ -554,14 +554,15 @@ void iic_mcu_start( ) { return; } - iic_mcu_busy = true; + + iic_mcu_busy = true; DST1 = 0; NOP( ); // 2clkもしくは、DSTn==0をポーリング NOP( ); DEN1 = 0; I2C_PU_on(); - wait_ms( 10 ); // 立ち上がるのに50us位かかる + wait_ms( 20 ); // 立ち上がるのに50us位かかる SAU0EN = 1; nop8(); diff --git a/trunk/jhl_defs.h b/trunk/jhl_defs.h index e6cd773..77d17d3 100644 --- a/trunk/jhl_defs.h +++ b/trunk/jhl_defs.h @@ -96,6 +96,14 @@ unsigned char YEAR; unsigned char MIN; unsigned char SEC; +unsigned char TDR06 +unsigned char TDR03 + +unsigned char TDR01 +unsigned char TDR07 +unsigned char TDR05 +unsigned char TDR02 + # endif diff --git a/trunk/led.c b/trunk/led.c index 4a5dc63..0efb448 100644 --- a/trunk/led.c +++ b/trunk/led.c @@ -502,7 +502,7 @@ void tsk_led_wifi( ) if( flag_wifi_TX != 0 ) { - vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_WIFI_TX; + vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_WIFI_TX; // 送信パターン switch ( state_wifi_tx ) { diff --git a/trunk/led.h b/trunk/led.h index 96abc91..2ce119b 100644 --- a/trunk/led.h +++ b/trunk/led.h @@ -61,10 +61,10 @@ enum LED_ILUM_MODE }; -enum LED_MODE_TUNE +enum LED_MODE_3D { - LED_TUNE_ILM_OFF = 0, - LED_TUNE_ILM_ON + LED_3D_ILM_OFF = 0, + LED_3D_ILM_ON }; diff --git a/trunk/pm.c b/trunk/pm.c index a808f3d..fddd43b 100644 --- a/trunk/pm.c +++ b/trunk/pm.c @@ -127,7 +127,6 @@ void tsk_batt( ) heikinka_l = 0; } - // WM0ではCHG_ENABLEピンは /WL_RST に配線されており、充電制御しない if( !temp_zone_charge_disable && bt_authorized && !PM_EXTDC_n ) { BT_CHG_ENABLE(); // 温度範囲OKで充電再開 @@ -152,7 +151,7 @@ void tsk_batt( ) } else { - BT_IN_CHG_delayed_n = 0; + BT_IN_CHG_delayed_n = 0; // 充電中 } } else @@ -183,8 +182,7 @@ void tsk_batt( ) // 割り込みはmiscが引き受ける // 電池残量 // - if(( system_status.pwr_state != ON_CHECK )&& - ( system_status.pwr_state != OFF )) + if( system_status.pwr_state != ON_CHECK ) { BT_get_left(); } @@ -300,7 +298,7 @@ void BT_model_detect() BT_DET_P = 1; BT_TEMP_P = 1; - wait_ms(2); // 電圧が上がるのに時間が掛かる + wait_ms( 5 ); // 電圧が上がるのに時間が掛かる raw_adc_temperature = get_adc( ADC_SEL_BATT_TEMP ); temp = get_adc( ADC_SEL_BATT_DET ); diff --git a/trunk/task_debug.c b/trunk/task_debug.c index d59a303..1745e4e 100644 --- a/trunk/task_debug.c +++ b/trunk/task_debug.c @@ -56,9 +56,9 @@ void tsk_debug( ) // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 2, vreg_ctr[ VREG_C_IRQ1 ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, boot_ura ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_C_SND_VOL ] ); -// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_TUNE ] ); +// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_3D ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 0, vreg_ctr[ VREG_C_ACC_ZH ] ); -// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 3, vreg_ctr[ VREG_C_TUNE ] ); +// iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 3, vreg_ctr[ VREG_C_3D ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 2, vreg_ctr[ VREG_C_SND_VOL ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 1, vreg_ctr[ VREG_C_STATUS ] ); // iic_mcu_write_a_byte( IIC_SLA_DBG_MONITOR, 0, vreg_ctr[ VREG_C_ACC_ZH ] ); @@ -75,7 +75,7 @@ void tsk_debug( ) str[0] = vreg_ctr[ VREG_C_RTC_SEC ]; str[3] = vreg_ctr[ VREG_C_SND_VOL ]; - str[2] = vreg_ctr[ VREG_C_TUNE ]; + str[2] = vreg_ctr[ VREG_C_3D ]; str[1] = vreg_ctr[ VREG_C_ACC_CONFIG ]; str[0] = SEC; iic_mcu_write( IIC_SLA_DBG_MONITOR, 0x03, 4, &str ); diff --git a/trunk/task_misc.c b/trunk/task_misc.c index 929b024..9215b1e 100644 --- a/trunk/task_misc.c +++ b/trunk/task_misc.c @@ -52,7 +52,7 @@ bit twl_ver_read; bit going_to_sleep; -void update_LED_tune(); +void update_LED_3D(); void check_twl_vol_irq(); @@ -99,7 +99,7 @@ void tsk_misc( ) check_twl_vol_irq(); // TWL の音量変化割り込みチェック } - update_LED_tune(); // 3D ランプ更新 + update_LED_3D(); // 3D ランプ更新 } @@ -137,8 +137,8 @@ void check_twl_vol_irq() -// TUNE_LED /////////////////////////////////// -void update_LED_tune() +// 3D_LED ///////////////////////////////////// +void update_LED_3D() { if( system_status.pwr_state != ON ) { @@ -147,7 +147,7 @@ void update_LED_tune() // おしまい // } - if( vreg_ctr[VREG_C_LED_TUNE] == LED_TUNE_ILM_OFF ) + if( vreg_ctr[VREG_C_LED_3D] == LED_3D_ILM_OFF ) { if( LED_duty_3d != 0 ) { diff --git a/trunk/task_sys.c b/trunk/task_sys.c index 1a7d838..93e316e 100644 --- a/trunk/task_sys.c +++ b/trunk/task_sys.c @@ -89,7 +89,7 @@ void tsk_sys( ) timeout = 0; - // todo debug + // for debug #ifdef _DEBUG_BT_FUEL_ vreg_ctr[ VREG_C_DBG01 ] = 99; #endif @@ -296,7 +296,7 @@ void tsk_sys( ) // LED消灯を待つ vreg_ctr[ VREG_C_LED_POW ] = LED_POW_ILM_OFF; vreg_ctr[ VREG_C_LED_WIFI ] = WIFI_LED_OFF; - vreg_ctr[ VREG_C_LED_TUNE ] = LED_TUNE_ILM_OFF; + vreg_ctr[ VREG_C_LED_3D ] = LED_3D_ILM_OFF; info_led_off = true; if( LED_duty_pow_blu != 0 ) { @@ -362,8 +362,6 @@ void tsk_sys( ) iic_mcu_stop( ); - timeout = 0; - system_status.pwr_state = OFF; SW_pow_mask = true; SW_pow_count = 0; @@ -372,6 +370,7 @@ void tsk_sys( ) // no break // case OFF: + system_status.poweron_reason = NONE; if( !PM_EXTDC_n ) { // アダプタが刺さってるときはこのブロックを繰り返す。 @@ -382,10 +381,10 @@ void tsk_sys( ) if( SW_pow_count >= 10 ) // 電源スイッチが押されるのを待つ { // 電源投入 - system_status.poweron_reason = PWSW; system_status.pwr_state = ON_CHECK; } - if( system_status.model != MODEL_JIKKI ) + + if( system_status.model != MODEL_JIKKI ) { iic_mcu_stop( ); } @@ -407,8 +406,6 @@ void tsk_sys( ) }; // 省電力へ移行 - system_status.poweron_reason = NONE; - iic_mcu_stop( ); pm_chk_adapter(); PM_Chg_Stop(); @@ -440,9 +437,13 @@ void tsk_sys( ) { // 電源ボタンで起きたとき SW_pow_mask = false; - system_status.poweron_reason = NONE; system_status.pwr_state = ON_CHECK; + timeout = 0; } + // else{ + // アダプタで起きたときは OFF の中をぐるぐるまわる + // } + RTCIMK = 0; if( system_status.taikendai ) { diff --git a/trunk/user_define.h b/trunk/user_define.h index 1a7b2d0..ba185b6 100644 --- a/trunk/user_define.h +++ b/trunk/user_define.h @@ -145,7 +145,7 @@ //#define LED_CAM P1.0 // TO02 //#define LED_WIFI P1.1 // TO03 //#define LED_NOTIFY P1.3 // TO05 -//#define LED_TUNE P5.2 // SLTO ← TO01 +//#define LED_3D P5.2 // SLTO ← TO01 //#define LED_POW2 P1.4 // TO06 ( 青 ) //#define LED_POW1 P1.5 // TO07 ( 赤 ) //#define LED_CHARGE P2.4 diff --git a/trunk/vreg_ctr.c b/trunk/vreg_ctr.c index 9adc116..4c3e9f2 100644 --- a/trunk/vreg_ctr.c +++ b/trunk/vreg_ctr.c @@ -76,7 +76,7 @@ void vreg_ctr_reset( ) vreg_ctr[ VREG_C_LED_POW ] = 0; vreg_ctr[ VREG_C_LED_WIFI ] = 0; vreg_ctr[ VREG_C_LED_CAM ] = 0; - vreg_ctr[ VREG_C_LED_TUNE ] = 0; + vreg_ctr[ VREG_C_LED_3D ] = 0; vreg_ctr[ VREG_C_VOL_DIGITAL ] = 0x20; vreg_ctr[ VREG_C_VOL_OPTION ] = 0; // vreg_ctr[ VREG_C_VOL_CAL_MIN ] = 0x36; ここで書いちゃダメ! @@ -189,7 +189,7 @@ void vreg_ctr_write( u8 adrs, u8 data ) case ( VREG_C_LED_WIFI ): case ( VREG_C_LED_CAM ): - case ( VREG_C_LED_TUNE ): + case ( VREG_C_LED_3D ): vreg_ctr[adrs] = (u8)( data & 0x0F ); break; @@ -339,7 +339,7 @@ void vreg_ctr_write( u8 adrs, u8 data ) // read only // case ( VREG_C_MCU_VER_MAJOR ): case ( VREG_C_MCU_VER_MINOR ): - // VREG_C_TUNE = 0x08, + // VREG_C_3D = 0x08, // VREG_C_SND_VOL, // VREG_C_BT_TEMP, // VREG_C_BT_REMAIN, diff --git a/trunk/vreg_ctr.h b/trunk/vreg_ctr.h index d9ba124..d5e7020 100644 --- a/trunk/vreg_ctr.h +++ b/trunk/vreg_ctr.h @@ -70,7 +70,7 @@ // そのうちどこかに... -//#define REG_BIT_VR_TUNE_CHANGE ( 1 << 7 ) +//#define REG_BIT_VR_3D_CHANGE ( 1 << 7 ) @@ -162,7 +162,7 @@ enum VREG_C_ADRS VREG_C_DBG02, VREG_C_DBG03, - VREG_C_TUNE = 0x08, + VREG_C_3D = 0x08, VREG_C_SND_VOL, VREG_C_BT_TEMP, VREG_C_BT_REMAIN, @@ -198,7 +198,7 @@ enum VREG_C_ADRS VREG_C_LED_POW, VREG_C_LED_WIFI, VREG_C_LED_CAM, - VREG_C_LED_TUNE, + VREG_C_LED_3D, VREG_C_LED_NOTIFY_DATA, VREG_C_LED_NOTIFY_FLAG, diff --git a/trunk/yav_mcu_bsr.pri b/trunk/yav_mcu_bsr.pri index 4cb9a77..9cb435b 100644 --- a/trunk/yav_mcu_bsr.pri +++ b/trunk/yav_mcu_bsr.pri @@ -12,7 +12,7 @@ Firm Clock=System Flash Programming=Permit Low-voltage Flash Rewriting=On Fail Safe Break=0x2000 -Port=0 +Port=1 NMI=OFF TRESET=OFF IRESET=OFF @@ -22,7 +22,7 @@ SubClock=None [Mapping] Count=0 [Main] -Geometry=66, 66, 960, 728 +Geometry=13, 66, 1440, 858 Window=Max MDI_MAX=OFF Button=ON @@ -33,7 +33,7 @@ Coverage=OFF Timer=OFF Tracer=OFF [Load File] -Dir=\\tsclient\C\78k_data\yav-mcu-basara\trunk\ +Dir=\\Tsclient\c\78k_data\yav-mcu-basara\trunk\ SaveFilter=0 Start=0 End=0 @@ -45,7 +45,7 @@ Erase=OFF HighSpeed=OFF Symbol Reset=ON CPU Reset=ON -File1=\\tsclient\C\78k_data\yav-mcu-basara\trunk\bsr.lmf +File1=\\Tsclient\c\78k_data\yav-mcu-basara\trunk\bsr.lmf LoadFilter1=5 Offset1=0 Object1=ON @@ -55,10 +55,10 @@ HighSpeed1=OFF CPU Reset1=ON Symbol Reset1=ON [View File] -Dir=\\tsclient\C\78k_data\yav-mcu-basara\trunk\ +Dir=\\Tsclient\c\78k_data\yav-mcu-basara\trunk\ Filter=Source [Debugger Option] -Source Path="\\tsclient\C\78k_data\yav-mcu-basara\trunk\renge" +Source Path="" Symbol Size=Byte Symbol Format=Hex Register Name=Func @@ -78,10 +78,10 @@ Symbol Type=OFF Language=C Kanji=SJIS [Source] -Geometry=278, 33, 715, 1006 +Geometry=0, 0, 725, 753 Window=Normal -DispStart=431 -CaretPos=432,0 +DispStart=435 +CaretPos=436,0 Mode=Normal DispFile= Address1= @@ -139,6 +139,14 @@ SaveRange=Screen SaveStart= SaveEnd= Accumulative=ON +[Source1] +Geometry=139, 70, 725, 684 +Window=Normal +DispStart=153 +CaretPos=121,9 +Mode=Normal +DispFile=\\Tsclient\c\78k_data\yav-mcu-basara\trunk\led.c +Accumulative=ON [Assemble] Geometry=0, 0, 0, 0 Window=Hide @@ -185,7 +193,7 @@ SaveRange=Screen SaveStart= SaveEnd= [Memory] -Geometry=0, 0, 0, 0 +Geometry=856, 20, 550, 400 Window=Hide Boundary=0 Format=Hex @@ -194,7 +202,7 @@ Endian= Ascii=OFF Idtag=OFF Address= -DispStart=FFFFFFFF +DispStart=00000000 CaretPosData=0, 0 CaretPosAscii=0, 0 Address1= @@ -957,17 +965,15 @@ Detail=OFF Last Name= Count=0 [Variable] -Geometry=945, 6, 644, 1042 +Geometry=908, 128, 510, 614 Window=Normal Boundary=13762700 0=.vreg_ctr,P,N,A,+,1 -1=.tdr05,P,S,A,+,1 -2=.system_status,.,N,A,+,1 -Line=3 +Line=1 [Quick Watch] -0=tdr05,P,A,1 -1=vreg_ctr,P,A,1 -2=system_status,P,A,1 +0=vreg_ctr,P,A,1 +1=system=status,P,A,1 +2= 3= 4= 5= @@ -985,15 +991,7 @@ Line=3 Geometry=0, 0, 0, 0 Window=Hide Width=150 30 200 100 -Name0=Swb00003 -Address0=led.c#_led_pow_bt_empty+0x0 -Window0=ASM -Status0=ON -Name1=Swb00001 -Address1=led.c#_tsk_led_pow+0x7e -Window1=ASM -Status1=ON -Count=2 +Count=0 [Reset] Debugger=ON Symbol=OFF diff --git a/trunk/yav_mcu_bsr.prj b/trunk/yav_mcu_bsr.prj index 400c5ae..62cf6aa 100644 --- a/trunk/yav_mcu_bsr.prj +++ b/trunk/yav_mcu_bsr.prj @@ -23,7 +23,7 @@ MuitiLoad=0 LoadPrjNum=0 CheckVersion=CC78K0R|W2.13;RA78K0R|W1.33 [Option.IDK0R32G] -File=\\tsclient\C\78k_data\yav-mcu-basara\trunk\yav_mcu_bsr.pri +File=\\Tsclient\c\78k_data\yav-mcu-basara\trunk\yav_mcu_bsr.pri [BuildMode2] BuildModeName=K0R_dbg TargetFile=0 @@ -840,7 +840,7 @@ G=1 E=0 E0=flash.elk E1=a.elk -GO=0 +GO=1 GOValue=85 GOStart=FC00 GOSizeValue=1024