泣く泣く手動で、SDK0.14系からマージ

・電源LEDが青でないときに電源断を行うと、次回の起動時に問答無用で強制電源断が発生するのを修正
・モード遷移中にリセットなどでTWL側のMCUレジスタが不整合になるのを強制クリア
・アドレス 0x7F の本体情報の読み出しを、8文字以下で打ち切るとI2Cをがめてしまい、続く数文字分の通信に対して期待しない値を返してしまっていたのを修正(task_misc)
・試遊台対応
・LED_NOTIF_DATAを書くと時計が狂うのを修正


git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@303 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
n2232 2011-01-20 01:28:40 +00:00
parent 19ae1d412a
commit 02950b0366
11 changed files with 57 additions and 35 deletions

View File

@ -15,7 +15,7 @@
#define MCU_VER_MAJOR 0x01
#define MCU_VER_MINOR 13
#define MCU_VER_MINOR 0x15
#define _firm_format_v3_

View File

@ -150,7 +150,7 @@ __interrupt void int_iic_twl( )
{
// ③W
// データ書き込まれ
SVA = 0x5A;
SVA = 0x5A; // ダミー
LREL = 1; // スタートコンディション待ちへ(連続書き込み未対応のため)
vreg_twl_write( vreg_adrs, rcvd );
SVA = IIC_T_SLAVEADDRESS;

View File

@ -558,12 +558,10 @@ void tsk_led_notify( )
// 次のフレームに進める?
if( time_to_next_frame == 0 )
{
DBG_LED_on;
time_to_next_frame = info_LED.info_LED.term;
if( frame >= NOTIFY_LED_TERM -1 )
{
DBG_LED2_on;
vreg_ctr[ VREG_C_LED_NOTIFY_FLAG ] |= REG_BIT_IN_LOOP;
if( info_LED.info_LED.last_loop != 255 ) // 255:無限ループ
{
@ -591,8 +589,6 @@ void tsk_led_notify( )
LED_dim_status_info_B.delta = (( LED_dim_status_info_B.to - LED_dim_status_info_B.now ) ) / info_LED.info_LED.fade_time;
}
DBG_LED_off;
DBG_LED2_off;
time_to_next_frame -= 1;
}
}

View File

@ -66,7 +66,8 @@ const u8 BT_MANUF_BORDER[] = {
PM_EXTDCは割り込みメインにするかも
======================================================== */
#define INTERVAL_TSK_BATT 100
#define INTERVAL_TSK_BATT 60
// ↑100だと充電エラー時にうまく点滅しないので
bit temp_zone_charge_disable; // 温度で充電停止する時にヒステリシスを付けるため
void tsk_batt( )
@ -578,13 +579,13 @@ void BT_get_left(){
vreg_ctr[ VREG_C_BT_REMAIN_FINE ] = temp_fuel[1];
}
// 電池電圧
/*
if( iic_mcu_read( IIC_SLA_BT_GAUGE, BT_GAUGE_REG_VCELL, 2, temp_v ) == ERR_SUCCESS )
//*
if( iic_mcu_read( IIC_SLA_BT_GAUGE, BT_GAUGE_REG_VCELL, 2, temp_fuel ) == ERR_SUCCESS )
{
vreg_ctr[ VREG_C_BT_VOLTAGE ] = temp_v[0];
vreg_ctr[ VREG_C_BT_VOLTAGE ] = temp_fuel[0];
}
else
*/
//*/
{
vreg_ctr[ VREG_C_BT_VOLTAGE ] = 200;
}

View File

@ -82,7 +82,6 @@ void tsk_sw( )
if( system_status.pwr_state == ON_TRIG )
{
SW_pow_count = 0; // カウントクリア
off_timeout_timer = 0;
}
if( --task_interval != 0 )
@ -109,15 +108,13 @@ void tsk_sw( )
else if( SW_pow_count == ( HOLD_THREASHOLD ) )
{
set_irq( VREG_C_IRQ0, REG_BIT_SW_POW_HOLD );
off_timeout_timer = vreg_ctr[ VREG_C_OFF_DELAY ] * 16;
if( off_timeout_timer == 0 )
{
off_timeout_timer = vreg_ctr[ VREG_C_OFF_DELAY ] * 16;
}
}
/*
else if( SW_pow_count > ( HOLD_THREASHOLD + vreg_ctr[ VREG_C_OFF_DELAY ] )) // ‚¨‚æ‚» 100/SYSTEM_TICK
{
system_status.force_off = 1;
}
*/
if( off_timeout_timer != 0 )
if( off_timeout_timer != 0 ) // 長押し割り込み後、タイムアウトで強制オフ。
{
off_timeout_timer -= 1;
if( off_timeout_timer == 1 )
@ -141,7 +138,7 @@ void tsk_sw( )
default:
SW_HOME_n = 1; // 放されてる状態
}
if( !( system_status.taikendai || system_status.taikendai_nbd ))
// if( !( system_status.taikendai || system_status.taikendai_nbd ))
{
chk_clicked( SW_HOME_n, SW_home_count, REG_BIT_SW_HOME_CLICK );
chk_clicked( !SW_HOME_n, SW_home_count_rel, REG_BIT_SW_HOME_RELEASE );

View File

@ -10,7 +10,11 @@ extern bit SW_pow_mask;
#define CLICK_THRESHOLD 2
#define HOLD_THREASHOLD (u16)( 3000 /INTERVAL_TSK_SW )
#define TIME_PWSW_CLICK (u8)( 160 /INTERVAL_TSK_SW )
#define TIME_PWSW_CLICK (u8)( 220 /INTERVAL_TSK_SW )
#define FORCEOFF_THREASHOLD (u8)( 12000 /INTERVAL_TSK_SW /16 )
extern u16 off_timeout_timer;
#define clear_pow_off_countdown(){ off_timeout_timer = 0; system_status.force_off = false; }
#endif

View File

@ -207,7 +207,9 @@ task_status_immed tski_do_command0( )
{
FCRAM_RST_ast; // twlÍntrƒ<C692>[ƒhÅ“®<E2809C>ìµÄé
}
vreg_twl[ REG_TWL_INT_ADRS_MODE ] = 0x03;
// TWLモードからDSモードへの切り替え中にリセットすると
// IRQが読まれない場合があるのでTWLレジスタを初期化する
vreg_twl_init();
}
if( temp_command & REG_BIT_FCRAM_RESET_REQ )
{
@ -264,16 +266,15 @@ extern bit bt_chg_ready;
======================================================== */
task_status_immed tski_mcu_info_read()
{
static u8 infos[10];
static u8 infos[10]; // staticにしたんだし、電源投入時にでもキャッシュしとけばいいのに
if( SPD ) // stop
if( SPD ) // stop
{
goto end;
}
if( STD ) // restart
{
SPIE = 1;
WDT_Restart( );
}
@ -281,10 +282,8 @@ task_status_immed tski_mcu_info_read()
{
return( ERR_CONTINUE );
}
else
{
IICAIF = 0;
}
IICAIF = 0;
WDT_Restart( );
if( iic_burst_state > 8 )
@ -293,7 +292,7 @@ task_status_immed tski_mcu_info_read()
}
else if( iic_burst_state == 0 )
{
if( !system_status.captureBox )
if( !system_status.captureBox )
{
IICA = (u8)system_status.model;
}
@ -314,13 +313,20 @@ task_status_immed tski_mcu_info_read()
{
IICA = infos[ iic_burst_state -1 ];
}
iic_burst_state++;
if( !ACKD ) // 途中で打ち切り
{
goto end;
}
iic_burst_state++;
return( ERR_CONTINUE );
end:
LREL = 1;
SPIE = 0;
IICAIF = 0;
IICAMK = 0;
LREL = 1;
iic_burst_state = 0;
return( ERR_FINISED );
}

View File

@ -294,7 +294,8 @@ void tsk_sys( )
{
return;
}
system_status.force_off = false;
clear_pow_off_countdown();
vreg_ctr[ VREG_C_ACC_CONFIG ] = 0x00;
tski_acc_hosu_set();
@ -391,6 +392,7 @@ void tsk_sys( )
}
else
{
// アダプタなし
if( chg_led_override != 0 ) // これがゼロになるまで待つ
{
return;
@ -431,8 +433,19 @@ void tsk_sys( )
system_status.pwr_state = ON_CHECK;
}
RTCIMK = 0;
if( system_status.taikendai )
{
system_status.pwr_state = OFF_TRIG;
}
}
return;
#if 0
default:
NOP( ); // あり得ないステート
#endif
}
}

View File

@ -4,6 +4,7 @@
#define IIC_T_SLAVEADDRESS 0x4A
#define IIC_C_SLAVEADDRESS 0x4A
#define IIC_C_SLAVEADDRESS_DMY 0x4C
#define IIC_SLA_DCP 0x50

View File

@ -207,6 +207,7 @@ void vreg_ctr_write( u8 adrs, u8 data )
info_led_pattern_updated = true;
}
}
break;
/// 非同期で動いているためここでは書かない。
// 予約するだけでstopで書く

View File

@ -59,7 +59,10 @@ void vreg_twl_write( u8 adrs, u8 data )
case ( REG_TWL_INT_ADRS_CAM ):
vreg_twl[ REG_TWL_INT_ADRS_CAM ] = ( data & 0x03 );
cam_led_update = true;
if( ( data & 0x03 ) == TWL_CAMLED_BLINK )
{
cam_led_update = true; // こうでないと一発消灯時に不具合があるため
}
tsk_led_cam();
break;