mirror of
https://github.com/rvtr/ctr_mcu.git
synced 2025-06-19 09:05:48 -04:00
コマンドが立て続けに来たとき、期待通りに動かないことがあるので改良
do_command2を分割、他 git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@74 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
parent
97607f90f3
commit
9a6867a19e
@ -21,8 +21,6 @@
|
||||
|
||||
//#define _SW_HOME_ENABLE_
|
||||
|
||||
//#define _SAITO_
|
||||
|
||||
// ---------------------------------- //
|
||||
|
||||
#ifdef _MODEL_TEG2_
|
||||
|
42
trunk/pm.c
42
trunk/pm.c
@ -45,9 +45,6 @@ u8 rcomp;
|
||||
float temp_co_up;
|
||||
float temp_co_dn;
|
||||
|
||||
u8 command_bl_set;
|
||||
|
||||
|
||||
// ========================================================
|
||||
static void PM_get_batt_left();
|
||||
|
||||
@ -407,7 +404,6 @@ err PM_LCD_vcom_set( )
|
||||
|
||||
|
||||
#else
|
||||
|
||||
// パラディウム上のSoCでチェックしたいとき、PMICも液晶もつながってないので
|
||||
// 異常終了しないようにダミー関数にする
|
||||
err PM_LCD_on( )
|
||||
@ -564,6 +560,10 @@ err PM_sys_pow_on( )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ========================================================
|
||||
電源OFFシーケンス
|
||||
todo: 電源異常断の場合
|
||||
@ -844,3 +844,37 @@ static void PM_get_batt_left(){
|
||||
( vreg_ctr[ VREG_C_BT_REMAIN ] < 5 )? 1 : 0 ); // 1で電池切れ
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**********************************************************
|
||||
command2 液晶系
|
||||
ラッパー的な物。ERR_SUCCESSしか返さないが…
|
||||
**********************************************************/
|
||||
task_status_immed tski_PM_LCD_on()
|
||||
{
|
||||
PM_LCD_on();
|
||||
return( ERR_SUCCESS );
|
||||
}
|
||||
|
||||
task_status_immed tski_PM_LCD_off()
|
||||
{
|
||||
PM_LCD_off();
|
||||
return( ERR_SUCCESS );
|
||||
}
|
||||
|
||||
task_status_immed tski_PM_BL_set()
|
||||
{
|
||||
u8 cmd_BL; // ↓volatileとか付けなくても大丈夫みたい
|
||||
|
||||
do
|
||||
{
|
||||
cmd_BL = vreg_ctr[VREG_C_COMMAND2];
|
||||
PM_BL_set( cmd_BL ); // マスク済み
|
||||
}
|
||||
while( cmd_BL != vreg_ctr[VREG_C_COMMAND2] );
|
||||
|
||||
return( ERR_SUCCESS );
|
||||
}
|
||||
|
16
trunk/pm.h
16
trunk/pm.h
@ -85,8 +85,6 @@ enum BT_GAUGE_REG_ADRS
|
||||
|
||||
//=========================================================
|
||||
extern u8 raw_adc_temperature;
|
||||
extern u8 command_bl_set;
|
||||
|
||||
|
||||
|
||||
//=========================================================
|
||||
@ -102,7 +100,9 @@ err PM_BL_set( u8 );
|
||||
|
||||
task_status_immed PM_bt_temp_update( );
|
||||
task_status_immed tski_vcom_set( );
|
||||
|
||||
task_status_immed tski_PM_LCD_on();
|
||||
task_status_immed tski_PM_LCD_off();
|
||||
task_status_immed tski_PM_BL_set();
|
||||
|
||||
|
||||
// これを呼ぶ前に、現在温度を教えておく必要があります。
|
||||
@ -136,14 +136,8 @@ task_status_immed tski_vcom_set( );
|
||||
|
||||
#else
|
||||
|
||||
#ifdef _SAITO_
|
||||
// スリープ時、3.3のみAUTO/PFM
|
||||
#define PM_VDD_ecoMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R05 | 0x04 ))
|
||||
#else
|
||||
|
||||
#define PM_VDD_ecoMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R05 | PM_REG_BIT_VDD_AUTO ))
|
||||
#endif
|
||||
|
||||
//#define PM_VDD_ecoMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R05 | PM_REG_BIT_VDD_AUTO ))
|
||||
#define PM_VDD_ecoMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R05 | PM_REG_BIT_VDD_PWM ))
|
||||
#define PM_VDD_normMode() ( iic_mcu_write_a_byte( IIC_SLA_PMIC, PM_REG_ADRS_POW_SAVE, PM_REG_BIT_VDD1P_1R05 | PM_REG_BIT_VDD_PWM ))
|
||||
|
||||
#endif
|
||||
|
@ -162,7 +162,7 @@ err renge_task_immed_add( task_status* new_task ){
|
||||
}
|
||||
}
|
||||
// タスク登録しすぎ(無いはず
|
||||
// NOP(); // デバッガで捕まえるため
|
||||
NOP(); // デバッガで捕まえるため
|
||||
return( ERR_ERR );
|
||||
}
|
||||
|
||||
|
@ -10,9 +10,6 @@
|
||||
#include "accero.h"
|
||||
|
||||
|
||||
extern u8 command_bl_set;
|
||||
|
||||
|
||||
/* ========================================================
|
||||
======================================================== */
|
||||
void tsk_debug( )
|
||||
|
@ -156,34 +156,6 @@ task_status_immed do_command0( )
|
||||
|
||||
|
||||
|
||||
/* ========================================================
|
||||
command2 液晶系
|
||||
0なら呼ばれません。ケア不要
|
||||
======================================================== */
|
||||
task_status_immed do_command2( )
|
||||
{
|
||||
// こちらからの完了割り込みを待ってくれることを前提にしています。
|
||||
if(( vreg_ctr[VREG_C_COMMAND2] & REG_BIT_CMD_LCD_ON ) != 0 )
|
||||
{
|
||||
PM_LCD_on();
|
||||
}
|
||||
else if(( vreg_ctr[VREG_C_COMMAND2] & REG_BIT_CMD_LCD_OFF ) != 0 )
|
||||
{
|
||||
PM_LCD_off();
|
||||
}
|
||||
|
||||
// バックライトの個別on/off
|
||||
if(( vreg_ctr[VREG_C_COMMAND2] & REG_BITS_CMD_BL ) != 0 )
|
||||
{
|
||||
PM_BL_set( vreg_ctr[VREG_C_COMMAND2] & REG_BITS_CMD_BL );
|
||||
}
|
||||
|
||||
vreg_ctr[VREG_C_COMMAND2] = 0;
|
||||
return ( ERR_FINISED );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ========================================================
|
||||
互換向け、TWLアプリへの割り込み
|
||||
仮想レジスタの書き込み時に行います。
|
||||
|
@ -18,6 +18,7 @@ CTR MCU I2C
|
||||
u8 vreg_ctr[VREG_C_ENDMARK_];
|
||||
|
||||
bit irq_readed; // AAA型のため。
|
||||
|
||||
extern bit update;
|
||||
extern u8 pool[];
|
||||
|
||||
@ -109,10 +110,23 @@ void vreg_ctr_write( u8 adrs, u8 data )
|
||||
break;
|
||||
|
||||
case ( VREG_C_COMMAND2 ):
|
||||
vreg_ctr[adrs] |= data;
|
||||
if( data != 0 )
|
||||
// こちらからの完了割り込みを待ってくれないそうです。 #-ω-) 何のための割り込みだ
|
||||
// 液晶電源
|
||||
if(( data & REG_BIT_CMD_LCD_ON ) != 0 )
|
||||
{
|
||||
renge_task_immed_add( do_command2 );
|
||||
renge_task_immed_add( tski_PM_LCD_on );
|
||||
}
|
||||
else if(( data & REG_BIT_CMD_LCD_OFF ) != 0 )
|
||||
{
|
||||
renge_task_immed_add( tski_PM_LCD_off );
|
||||
}
|
||||
|
||||
// バックライト設定
|
||||
/// 今のところさらに細かくは分けないけど…
|
||||
if(( data & REG_BITS_CMD_BL ) != 0 )
|
||||
{
|
||||
vreg_ctr[adrs] = ( data & REG_BITS_CMD_BL );
|
||||
renge_task_immed_add( tski_PM_BL_set );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1,4 +1,16 @@
|
||||
C:\WINDOWS\system32\cmd.exe /c touch magic.c
|
||||
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -quvjl3wt -sainter_asm -zp -no pm.c
|
||||
pm.c(190) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
pm.c(202) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
pm.c(206) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
pm.c(257) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
pm.c(294) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
pm.c(370) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
pm.c(378) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
pm.c(844) : CC78K0R warning W0401: Conversion may lose significant digits
|
||||
Compilation complete, 0 error(s) and 8 warning(s) found.
|
||||
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\pm.asm
|
||||
Assembly complete, 0 error(s) and 0 warning(s) found.
|
||||
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -quvjl3wt -sainter_asm -zp -no magic.c
|
||||
Compilation complete, 0 error(s) and 0 warning(s) found.
|
||||
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\magic.asm
|
||||
@ -13,4 +25,4 @@ intel-HEX to bsr bin converter
|
||||
file converted!
|
||||
|
||||
|
||||
Build Total error(s) : 0 Total warning(s) : 0
|
||||
Build Total error(s) : 0 Total warning(s) : 8
|
||||
|
@ -80,8 +80,8 @@ Kanji=SJIS
|
||||
[Source]
|
||||
Geometry=202, 65, 1025, 1014
|
||||
Window=Normal
|
||||
DispStart=103
|
||||
CaretPos=104,0
|
||||
DispStart=274
|
||||
CaretPos=275,0
|
||||
Mode=Normal
|
||||
DispFile=
|
||||
Address1=
|
||||
@ -142,8 +142,8 @@ Accumulative=ON
|
||||
[Assemble]
|
||||
Geometry=605, 2, 600, 400
|
||||
Window=Normal
|
||||
DispStart=12558
|
||||
CaretPos=12558,27
|
||||
DispStart=16372
|
||||
CaretPos=16372,27
|
||||
Address1=
|
||||
Address2=
|
||||
Address3=
|
||||
@ -274,7 +274,7 @@ Address13=
|
||||
Address14=
|
||||
Address15=
|
||||
Address16=
|
||||
Boundary=239, 52
|
||||
Boundary=202, 89
|
||||
Mode=Bin
|
||||
Attribute=Show
|
||||
Sort=Unsort
|
||||
@ -899,7 +899,7 @@ Address3=task_misc.c#_do_command0+0x0
|
||||
Window3=ASM
|
||||
Status3=ON
|
||||
Name4=Swb00002
|
||||
Address4=task_sys.c#_tsk_sys+0x193
|
||||
Address4=task_sys.c#_chk_emergencyExit+0x4
|
||||
Window4=ASM
|
||||
Status4=ON
|
||||
Count=5
|
||||
|
@ -7,7 +7,7 @@ FrameCY=1043
|
||||
OpenFile1=task_sys.c,0,521,328,1765,1085,25,250,25,0
|
||||
OpenFile2=bsr_mcu.dr,0,198,198,1177,834,0,54,0,0
|
||||
OpenFile3=loader.c,0,266,31,1510,788,23,43,23,0
|
||||
OpenFile4=sw.c,0,132,132,1376,889,0,166,17,0
|
||||
OpenFile4=sw.c,0,132,132,1376,889,0,165,17,0
|
||||
OpenFile5=pm.c,0,421,154,1400,790,25,271,0,0
|
||||
OpenFile6=config.h,0,282,262,1526,1019,0,19,0,0
|
||||
OpenFile7=vreg_ctr.c,0,159,252,1138,888,30,201,38,0
|
||||
|
@ -1,7 +1,7 @@
|
||||
[SdbInfo]
|
||||
Ver=5
|
||||
[loader.c]
|
||||
T=4b3081f8
|
||||
T=4b3486b4
|
||||
1=incs_loader.h
|
||||
2=fsl.h
|
||||
3=fsl_user.h
|
||||
@ -22,7 +22,7 @@ T=4b346598
|
||||
1=incs.h
|
||||
2=accero.h
|
||||
[main.c]
|
||||
T=4b3421b2
|
||||
T=4b3800f0
|
||||
1=incs_loader.h
|
||||
2=WDT.h
|
||||
3=rtc.h
|
||||
@ -31,7 +31,7 @@ T=4b3421b2
|
||||
6=led.h
|
||||
7=adc.h
|
||||
[magic.c]
|
||||
T=4b3465a1
|
||||
T=4b395492
|
||||
1=config.h
|
||||
[WDT.c]
|
||||
T=4afd21ca
|
||||
@ -52,7 +52,7 @@ T=4b307b06
|
||||
1=incs.h
|
||||
2=led.h
|
||||
[rtc.c]
|
||||
T=4b34233a
|
||||
T=4b380da2
|
||||
1=incs.h
|
||||
[vreg_ctr.c]
|
||||
T=4b34616d
|
||||
@ -100,7 +100,7 @@ T=4b20a948
|
||||
T=4afd21cb
|
||||
1=incs_loader.h
|
||||
[sw.c]
|
||||
T=4b21cccc
|
||||
T=4b383e14
|
||||
1=incs.h
|
||||
2=i2c_twl.h
|
||||
3=i2c_ctr.h
|
||||
@ -121,7 +121,7 @@ T=4b34648e
|
||||
3=pm.h
|
||||
4=accero.h
|
||||
[task_sys.c]
|
||||
T=4b345ee5
|
||||
T=4b385483
|
||||
1=incs.h
|
||||
2=i2c_twl.h
|
||||
3=i2c_ctr.h
|
||||
|
Loading…
Reference in New Issue
Block a user