mirror of
https://github.com/rvtr/ctr_mcu.git
synced 2025-06-19 09:05:48 -04:00
お知らせLED3色対応、LED部分をとりあえず。
拡張レジスタ・色テーブルをもらう部分を書く前に一度コミット 一部の割り込みをレジスタバンク使用するように変更。 効果あるか? コンパイラのワーニング対応 バッテリ残量で割り込み(暫定3%、8% 有用か?) git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@128 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
parent
953ab3e63a
commit
e8aebb8b95
@ -14,7 +14,16 @@
|
||||
#pragma MUL
|
||||
#pragma BCD
|
||||
|
||||
|
||||
|
||||
#include "config.h"
|
||||
#ifdef _MCU_BSR_
|
||||
#pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了
|
||||
#endif
|
||||
|
||||
|
||||
#include "incs.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// ========================================================
|
||||
@ -252,4 +261,3 @@ __interrupt void intp23_ACC_ready( )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,16 +159,16 @@ void tsk_adc( )
|
||||
switch ( vreg_ctr[VREG_C_LED_TUNE] )
|
||||
{
|
||||
case LED_TUNE_ILM_ON:
|
||||
LED_duty_TUNE = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_duty_3d = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
break;
|
||||
|
||||
case LED_TUNE_ILM_SVR:
|
||||
LED_duty_TUNE = vreg_ctr[VREG_C_TUNE] / 16;
|
||||
LED_duty_3d = vreg_ctr[VREG_C_TUNE] / 16;
|
||||
break;
|
||||
|
||||
case LED_TUNE_ILM_OFF:
|
||||
default:
|
||||
LED_duty_TUNE = 0;
|
||||
LED_duty_3d = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
//#define _MODEL_CTR_TS_
|
||||
// <20>ªFINAL SoC <20>{ Type-C
|
||||
#define _MODEL_CTR_
|
||||
#define _NOTIFY_FULLCOLOR_
|
||||
|
||||
|
||||
//#define _SW_HOME_ENABLE_
|
||||
|
@ -3,6 +3,17 @@
|
||||
“¡“c<EFBFBD>—ŠJ‹Z.nintendo
|
||||
'09 Apr
|
||||
======================================================== */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef _MCU_KE3_
|
||||
#pragma interrupt INTIICA int_iic_ctr // CTR側
|
||||
#else
|
||||
// TSはマザボでテレコ、WMは回路図がテレコで結局一致…
|
||||
#pragma interrupt INTIICA1 int_iic_ctr RB1
|
||||
#endif
|
||||
|
||||
|
||||
#include "incs.h"
|
||||
|
||||
#ifdef _MCU_BSR_
|
||||
|
@ -3,6 +3,13 @@
|
||||
|
||||
|
||||
/*============================================================================*/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef _MCU_KE3_
|
||||
#else
|
||||
#pragma interrupt INTIICA0 int_iic_twl RB2
|
||||
#endif
|
||||
|
||||
#include "incs.h"
|
||||
#include "i2c_twl_defs.h"
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
|
||||
#include "accero.h"
|
||||
|
||||
#include "pm.h"
|
||||
|
||||
//=========================================================
|
||||
|
||||
#endif
|
||||
|
@ -20,9 +20,13 @@
|
||||
//#pragma interrupt INTP7 intp21_RFTx
|
||||
//#endif
|
||||
|
||||
|
||||
/*
|
||||
acceroへ
|
||||
#ifdef _MCU_BSR_
|
||||
#pragma interrupt INTP23 intp23_ACC_ready // 加速度センサ、データ準備完了
|
||||
#pragma interrupt INTP23 intp23_ACC_ready RB3 // 加速度センサ、データ準備完了
|
||||
#endif
|
||||
*/
|
||||
|
||||
//#pragma interrupt INTCMP0 fn_intcmp0
|
||||
//#pragma interrupt INTCMP1 fn_intcmp1
|
||||
@ -42,15 +46,22 @@
|
||||
//#pragma interrupt INTSRE1 fn_intsre1
|
||||
|
||||
|
||||
/*
|
||||
それぞれの .c へ
|
||||
#ifdef _MCU_KE3_
|
||||
#pragma interrupt INTIICA int_iic_ctr // CTR側
|
||||
#pragma interrupt INTIICA int_iic_ctr RB1 // CTR側
|
||||
#else
|
||||
|
||||
// TSはマザボでテレコ、WMは回路図がテレコで結局一致…
|
||||
#pragma interrupt INTIICA0 int_iic_twl
|
||||
#pragma interrupt INTIICA1 int_iic_ctr
|
||||
#pragma interrupt INTIICA1 int_iic_ctr RB1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MCU_KE3_
|
||||
#else
|
||||
#pragma interrupt INTIICA0 int_iic_twl RB2
|
||||
#endif
|
||||
*/
|
||||
|
||||
//#pragma interrupt INTTM00 fn_inttm00
|
||||
//#pragma interrupt INTTM01 fn_inttm01
|
||||
//#pragma interrupt INTTM02 fn_inttm02
|
||||
@ -365,3 +376,5 @@ __interrupt void intp5( )
|
||||
// 起きるだけ
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
205
trunk/led.c
205
trunk/led.c
@ -33,18 +33,48 @@ static void led_pow_hotaru( );
|
||||
// ========================================================
|
||||
// お知らせLEDのパターンを流し込んでもらう
|
||||
typedef struct{
|
||||
unsigned char red:3;
|
||||
unsigned char grn:3;
|
||||
unsigned char blu:2;
|
||||
u8 red;
|
||||
u8 grn;
|
||||
u8 blu;
|
||||
}st_info_LED_ptn;
|
||||
|
||||
st_info_LED_ptn info_LED_ptn[32];
|
||||
typedef struct{
|
||||
st_info_LED_ptn ptn[32];
|
||||
u8 option1;
|
||||
u8 option2;
|
||||
u8 option3;
|
||||
u8 option4;
|
||||
}st_info_LED;
|
||||
|
||||
st_info_LED info_LED;
|
||||
|
||||
|
||||
|
||||
#define led_fade_to( now, goal ) now = fade_to( now, goal )
|
||||
|
||||
|
||||
|
||||
/* ========================================================
|
||||
reg_ledをgoalになるまでグラデーションする
|
||||
とりあえず、ステップ固定
|
||||
====================================================== */
|
||||
u8 fade_to( u8 now, u8 goal )
|
||||
{
|
||||
if( now != goal )
|
||||
{
|
||||
if( now > goal )
|
||||
{
|
||||
now -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
now += 1;
|
||||
}
|
||||
}
|
||||
return( now );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -93,7 +123,7 @@ void LED_init( )
|
||||
if( system_status.reboot )
|
||||
{
|
||||
vreg_ctr[VREG_C_LED_POW] = LED_POW_ILM_AUTO;
|
||||
LED_duty_pow_H = LED_BRIGHT_MAX;
|
||||
LED_duty_pow_blu = LED_BRIGHT_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,8 +185,7 @@ void tsk_led_pow( )
|
||||
|
||||
// 強制
|
||||
case ( LED_POW_ILM_OFF ):
|
||||
LED_duty_pow_H -= ( LED_duty_pow_H == 0x0000 ) ? 0 : 1;
|
||||
LED_duty_pow_L -= ( LED_duty_pow_L == 0x0000 ) ? 0 : 1;
|
||||
LED_pow_red = 0;
|
||||
break;
|
||||
|
||||
case ( LED_POW_ILM_HOTARU ):
|
||||
@ -169,13 +198,13 @@ void tsk_led_pow( )
|
||||
break;
|
||||
|
||||
case ( LED_POW_ILM_ONLY_RED ):
|
||||
LED_duty_pow_H = 0x0000;
|
||||
LED_duty_pow_L = LED_BRIGHT_MAX;
|
||||
led_fade_to( LED_duty_pow_blu, 0 );
|
||||
LED_pow_red = 1;
|
||||
break;
|
||||
|
||||
case ( LED_POW_ILM_ONLY_BLUE ):
|
||||
LED_duty_pow_H = LED_BRIGHT_MAX;
|
||||
LED_duty_pow_L = 0x0000;
|
||||
led_fade_to( LED_duty_pow_blu, LED_BRIGHT_MAX );
|
||||
LED_pow_red = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -190,47 +219,35 @@ static void led_pow_normal( )
|
||||
{
|
||||
static u8 state;
|
||||
|
||||
if( vreg_ctr[VREG_C_BT_REMAIN] < 3 )
|
||||
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_EMPTY )
|
||||
{
|
||||
led_fade_to( LED_duty_pow_blu, 0 );
|
||||
// 赤点滅
|
||||
state++;
|
||||
if( state < 127 )
|
||||
{
|
||||
LED_duty_pow_H = 0x0000;
|
||||
LED_duty_pow_L = 0x0000;
|
||||
LED_pow_red = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_duty_pow_L = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_pow_red = 1;
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
else if( vreg_ctr[VREG_C_BT_REMAIN] < 12 )
|
||||
else if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
|
||||
{
|
||||
// 赤点灯
|
||||
if( LED_duty_pow_H != 0x0000 )
|
||||
{ // 青フェードアウト
|
||||
LED_duty_pow_H -= 1;
|
||||
}
|
||||
if( LED_duty_pow_L != vreg_ctr[VREG_C_LED_BRIGHT] )
|
||||
{ // 赤フェードイン
|
||||
LED_duty_pow_L += ( LED_duty_pow_L < vreg_ctr[VREG_C_LED_BRIGHT] ) ? 1 : -1;
|
||||
}
|
||||
led_fade_to( LED_duty_pow_blu, 0 );
|
||||
LED_pow_red = 1;
|
||||
return;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// 青点灯
|
||||
if( LED_duty_pow_H != vreg_ctr[VREG_C_LED_BRIGHT] )
|
||||
{
|
||||
LED_duty_pow_H += ( LED_duty_pow_H < vreg_ctr[VREG_C_LED_BRIGHT] ) ? 1 : -1;
|
||||
}
|
||||
if( LED_duty_pow_L != 0x0000 )
|
||||
{
|
||||
LED_duty_pow_L -= 1;
|
||||
}
|
||||
led_fade_to( LED_duty_pow_blu, vreg_ctr[VREG_C_LED_BRIGHT] );
|
||||
LED_pow_red = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -246,41 +263,14 @@ static void led_pow_hotaru( )
|
||||
static u8 delay;
|
||||
static u8 state;
|
||||
static u16 blue_to;
|
||||
static u16 red_to;
|
||||
|
||||
if( delay != 0 )
|
||||
{
|
||||
delay -= 1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = 10;
|
||||
}
|
||||
|
||||
if( LED_duty_pow_L != red_to )
|
||||
{
|
||||
if( LED_duty_pow_L > red_to )
|
||||
{
|
||||
LED_duty_pow_L -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_duty_pow_L += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if( LED_duty_pow_H != blue_to )
|
||||
{
|
||||
if( LED_duty_pow_H > blue_to )
|
||||
{
|
||||
LED_duty_pow_H -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_duty_pow_H += 2;
|
||||
}
|
||||
}
|
||||
delay = 10;
|
||||
|
||||
switch ( state )
|
||||
{
|
||||
@ -288,24 +278,23 @@ static void led_pow_hotaru( )
|
||||
case ( 0 ):
|
||||
case ( 2 ):
|
||||
case ( 4 ):
|
||||
if( vreg_ctr[VREG_C_BT_REMAIN] < 12 )
|
||||
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
|
||||
{
|
||||
// 赤いとき
|
||||
blue_to = 0;
|
||||
red_to = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_pow_red = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
blue_to = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
red_to = 0;
|
||||
LED_pow_red = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// フェードアウト
|
||||
if( vreg_ctr[VREG_C_BT_REMAIN] < 12 )
|
||||
if( vreg_ctr[VREG_C_BT_REMAIN] <= BATT_TH_LO )
|
||||
{
|
||||
red_to = 2;
|
||||
LED_pow_red = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -314,10 +303,24 @@ static void led_pow_hotaru( )
|
||||
break;
|
||||
}
|
||||
|
||||
if( ( LED_duty_pow_H == blue_to ) && ( LED_duty_pow_L == red_to ) )
|
||||
// LED更新
|
||||
if( LED_duty_pow_blu != blue_to )
|
||||
{
|
||||
if( LED_duty_pow_blu > blue_to )
|
||||
{
|
||||
LED_duty_pow_blu -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_duty_pow_blu += 2;
|
||||
}
|
||||
}
|
||||
|
||||
if( LED_duty_pow_blu == blue_to )
|
||||
{
|
||||
state += 1;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -410,41 +413,49 @@ void tsk_led_wifi( )
|
||||
|
||||
|
||||
/* ========================================================
|
||||
* 割り込みそのものは使いません *
|
||||
LED_Wifi2 P24 (未)
|
||||
お知らせLED
|
||||
======================================================== */
|
||||
void tsk_led_notify( )
|
||||
{
|
||||
static u8 task_interval;
|
||||
static u8 flg_char_space;
|
||||
static u8 state_notify_led; // 点灯パターンの進行具合
|
||||
static u8 flag_wifi_TX;
|
||||
// static u8 task_interval;
|
||||
static u16 time_to_next;
|
||||
static u8 pos;
|
||||
st_info_LED_ptn temp;
|
||||
|
||||
temp = info_LED.ptn[ pos ];
|
||||
/*
|
||||
led_fade_to( LED_duty_notify_red, (u8)temp.red );
|
||||
led_fade_to( LED_duty_notify_grn, (u8)temp.grn );
|
||||
led_fade_to( LED_duty_notify_blu, (u8)temp.blu );
|
||||
/*/
|
||||
LED_duty_notify_red = (u8)temp.red;
|
||||
LED_duty_notify_grn = (u8)temp.grn;
|
||||
LED_duty_notify_blu = (u8)temp.blu;
|
||||
//*/
|
||||
/*
|
||||
if( task_interval != 0 )
|
||||
{
|
||||
task_interval -= 1;
|
||||
return;
|
||||
}
|
||||
task_interval -= 1;
|
||||
*/
|
||||
|
||||
if( task_interval-- != 0 )
|
||||
if( time_to_next-- != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( vreg_ctr[VREG_C_LED_NOTIFY] )
|
||||
{
|
||||
default:
|
||||
LED_duty_NOTIFY = 0;
|
||||
state_notify_led = 0;
|
||||
flg_char_space = 0;
|
||||
break;
|
||||
time_to_next = 32;
|
||||
pos += 1;
|
||||
pos &= 0x1F;
|
||||
|
||||
case ( NOTIFY_LED_ON ):
|
||||
LED_duty_NOTIFY = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
state_notify_led = 0;
|
||||
flg_char_space = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/******************************************************//**
|
||||
LED_Cam TO02
|
||||
\n BLINK,*_PLUSE の時は、1周期分は必ずその状態になります。
|
||||
@ -469,24 +480,24 @@ void tsk_led_cam( )
|
||||
{
|
||||
case ( CAM_LED_OFF ):
|
||||
default:
|
||||
LED_duty_CAM = 0;
|
||||
LED_CAM = 0;
|
||||
state_led_cam = 0;
|
||||
break;
|
||||
|
||||
case ( CAM_LED_ON ):
|
||||
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_CAM = 1;
|
||||
state_led_cam = 0;
|
||||
break;
|
||||
|
||||
case ( CAM_LED_BLINK ):
|
||||
if( state_led_cam == 0 )
|
||||
{
|
||||
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_CAM = 1;
|
||||
state_led_cam = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_duty_CAM = 0;
|
||||
LED_CAM = 0;
|
||||
state_led_cam = 0;
|
||||
}
|
||||
task_interval = 250;
|
||||
@ -495,7 +506,7 @@ void tsk_led_cam( )
|
||||
case ( CAM_LED_ON_PLUSE ):
|
||||
if( state_led_cam == 0 )
|
||||
{
|
||||
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_CAM = 1;
|
||||
state_led_cam = 1;
|
||||
task_interval = 250;
|
||||
}
|
||||
@ -508,7 +519,7 @@ void tsk_led_cam( )
|
||||
case ( CAM_LED_OFF_PLUSE ):
|
||||
if( state_led_cam == 0 )
|
||||
{
|
||||
LED_duty_CAM = 0;
|
||||
LED_CAM = 0;
|
||||
state_led_cam = 1;
|
||||
task_interval = 250;
|
||||
}
|
||||
@ -521,19 +532,19 @@ void tsk_led_cam( )
|
||||
case ( CAM_LED_BY_TWL ):
|
||||
switch ( vreg_twl[ REG_TWL_INT_ADRS_CAM ] ){ // switchのネストとか…
|
||||
case( TWL_CAMLED_OFF ):
|
||||
LED_duty_CAM = 0;
|
||||
LED_CAM = 0;
|
||||
state_led_cam = 0;
|
||||
break;
|
||||
|
||||
case( TWL_CAMLED_BLINK ):
|
||||
if( state_led_cam == 0 )
|
||||
{
|
||||
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_CAM = 1;
|
||||
state_led_cam = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
LED_duty_CAM = 0;
|
||||
LED_CAM = 0;
|
||||
state_led_cam = 0;
|
||||
}
|
||||
task_interval = 250;
|
||||
@ -542,7 +553,7 @@ void tsk_led_cam( )
|
||||
case( TWL_CAMLED_ON ):
|
||||
case( TWL_CAMLED_DEF_ON ):
|
||||
default:
|
||||
LED_duty_CAM = vreg_ctr[VREG_C_LED_BRIGHT];
|
||||
LED_CAM = 1;
|
||||
state_led_cam = 1;
|
||||
break;
|
||||
}
|
||||
|
19
trunk/led.h
19
trunk/led.h
@ -4,14 +4,21 @@
|
||||
|
||||
// ====================================
|
||||
|
||||
|
||||
#ifdef _NOTIFY_FULLCOLOR_
|
||||
// LED_DUTY
|
||||
#define LED_duty_pow_L TDR07
|
||||
#define LED_duty_pow_H TDR06
|
||||
#define LED_duty_pow_blu TDR06
|
||||
#define LED_duty_WiFi TDR03
|
||||
#define LED_duty_NOTIFY TDR05
|
||||
#define LED_duty_CAM TDR02
|
||||
#define LED_duty_TUNE TDR01
|
||||
// wifi2はPWMできません。
|
||||
#define LED_duty_3d TDR01
|
||||
#define LED_duty_notify_red TDR07
|
||||
#define LED_duty_notify_grn TDR05
|
||||
#define LED_duty_notify_blu TDR02
|
||||
|
||||
// これらはduty変えられません
|
||||
#define LED_pow_red P7.5
|
||||
#define LED_CAM P4.2
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define LED_BRIGHT_MAX 0x00FF
|
||||
|
@ -4,8 +4,9 @@
|
||||
|
||||
|
||||
********************************************************* */
|
||||
#pragma MUL
|
||||
#pragma BCD
|
||||
#pragma mul
|
||||
#pragma div
|
||||
#pragma bcd
|
||||
|
||||
#include "incs.h"
|
||||
#include <math.h>
|
||||
|
35
trunk/pm.c
35
trunk/pm.c
@ -180,7 +180,7 @@ SoC
|
||||
}
|
||||
*/
|
||||
vreg_ctr[VREG_C_STATUS] = (( vreg_ctr[VREG_C_STATUS] & 0b10011111 )
|
||||
| (( blset << 6 ) | ( blset << 4 )) & 0b01100000 );
|
||||
| ( (( blset << 6 ) | ( blset << 4 )) & 0b01100000 ));
|
||||
// PMICのBLのビットと、MCUのSTATUSレジスタのビット位置が逆なため入れ替え
|
||||
|
||||
{
|
||||
@ -287,7 +287,6 @@ task_status_immed tski_vcom_set( )
|
||||
err PM_sys_pow_on( )
|
||||
{
|
||||
#ifdef _PMIC_CTR_
|
||||
u8 err;
|
||||
|
||||
// 電源順次立ち上げ
|
||||
// PM_reset_ast( ); 不要 PM_LDSW_onまかせ
|
||||
@ -557,10 +556,11 @@ task_status_immed ntr_pmic_comm( )
|
||||
// リセットリクエスト /////////////////////////////////
|
||||
if( ( reg_shadow & REG_BIT_TWL_REQ_RST_REQ ) != 0 )
|
||||
{
|
||||
#if 0
|
||||
// CODECバグ回避
|
||||
// リセット単品でなかったら無視
|
||||
// codec <20>C<EFBFBD>³<EFBFBD>Ï<EFBFBD>«
|
||||
if( ( reg1_old ^ reg_shadow ) == REG_BIT_TWL_REQ_RST_REQ )
|
||||
#endif
|
||||
{
|
||||
set_irq( VREG_C_IRQ2, REG_BIT_TWL_RESET_REQ );
|
||||
}
|
||||
@ -703,7 +703,34 @@ void tsk_batt( )
|
||||
// 電池残量 //
|
||||
if( system_status.pwr_state == ON )
|
||||
{
|
||||
static u8 bt_left_state; // バッテリ残量で割り込みのため
|
||||
|
||||
BT_get_left();
|
||||
switch( bt_left_state )
|
||||
{
|
||||
case( 0 ): // 前回、バッテリーは十分にあった
|
||||
if( vreg_ctr[ VREG_C_BT_REMAIN ] <= BATT_TH_LO )
|
||||
{
|
||||
bt_left_state = 1; // 突然バッテリ残量が減っても、Lo割り込みを入れる
|
||||
set_irq( VREG_C_IRQ1, REG_BIT_BT_REMAIN );
|
||||
}
|
||||
break;
|
||||
|
||||
case( 1 ):
|
||||
if( vreg_ctr[ VREG_C_BT_REMAIN ] <= BATT_TH_EMPTY )
|
||||
{
|
||||
bt_left_state = 2;
|
||||
set_irq( VREG_C_IRQ1, REG_BIT_BT_REMAIN );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if( vreg_ctr[ VREG_C_BT_REMAIN ] > BATT_TH_LO )
|
||||
{
|
||||
bt_left_state = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@ -726,7 +753,7 @@ void tsk_batt( )
|
||||
電池温度で判定する
|
||||
|
||||
***********************************************************/
|
||||
#define swap_endian_16( x ) (unsigned int)( x << 8 | x >> 8 )
|
||||
#define swap_endian_16( x ) (unsigned int)(( x << 8 ) | ( x >> 8 ))
|
||||
void BT_init( )
|
||||
{
|
||||
u8 temp;
|
||||
|
@ -1,12 +1,18 @@
|
||||
#ifndef __PM__
|
||||
#define __PM__
|
||||
|
||||
// #include "batt_params.h"
|
||||
|
||||
|
||||
#define IIC_SLA_PMIC 0x84
|
||||
#define IIC_SLA_BT_GAUGE 0x6C
|
||||
|
||||
|
||||
|
||||
#define BATT_TH_LO 8
|
||||
#define BATT_TH_EMPTY 3
|
||||
|
||||
|
||||
|
||||
//=========================================================
|
||||
enum PMIC_REG_ADRS
|
||||
{
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "i2c_twl.h"
|
||||
#include "i2c_ctr.h"
|
||||
#include "led.h"
|
||||
#include "accero.h"
|
||||
#include "pm.h"
|
||||
#include "rtc.h"
|
||||
|
||||
|
@ -7,8 +7,6 @@
|
||||
#include "renge.h"
|
||||
#include "pm.h"
|
||||
|
||||
#include "accero.h"
|
||||
|
||||
|
||||
/* ========================================================
|
||||
======================================================== */
|
||||
|
@ -189,7 +189,7 @@ task_status_immed do_command0( )
|
||||
wait_ms( 100 );
|
||||
{
|
||||
u8 codec_reg_init[3] = { 0,0,0 };
|
||||
iic_mcu_write( IIC_SLA_CODEC, CODEC_REG_PM, 3, codec_reg_init );
|
||||
iic_mcu_write( IIC_SLA_CODEC, CODEC_REG_PM, 3, codec_reg_init );
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -215,9 +215,6 @@ extern u8 iic_burst_state;
|
||||
======================================================== */
|
||||
task_status_immed tski_mcu_info_read()
|
||||
{
|
||||
u8 temp;
|
||||
|
||||
|
||||
if( SPD )
|
||||
{
|
||||
goto end;
|
||||
@ -236,7 +233,7 @@ task_status_immed tski_mcu_info_read()
|
||||
{
|
||||
IICAIF = 0;
|
||||
}
|
||||
|
||||
|
||||
switch( iic_burst_state++ ){
|
||||
case( 0 ): // –{‘ÌŽí—ÞŽ¯•Ê
|
||||
IICA = (u8)system_status.model;
|
||||
|
@ -232,7 +232,7 @@ void tsk_sys( )
|
||||
case OFF_TRIG: //---------------------------------------
|
||||
// LED消灯を待つ
|
||||
vreg_ctr[VREG_C_LED_POW] = LED_POW_ILM_OFF;
|
||||
if(( LED_duty_pow_H != 0 ) || ( LED_duty_pow_L != 0 ))
|
||||
if( LED_duty_pow_blu != 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -512,6 +512,72 @@ DefaultMode2=1
|
||||
DefaultMode3=1
|
||||
DefaultMode4=1
|
||||
DefaultMode5=1
|
||||
[ToolSet]
|
||||
ToolSetName=(•Ï<E280A2>X)78K0R Software Package V1.10
|
||||
Tool1=CC78K0R|W2.10
|
||||
Tool2=RA78K0R|W1.31
|
||||
Tool3=ID78K0R-QB|V3.60
|
||||
[BuildBefore-AfterCmd]
|
||||
Before1=touch magic.c
|
||||
After1=ruby nec_s_2_bsrbin2.rb bsr.hex
|
||||
[SrcFile]
|
||||
Source1=loader.c
|
||||
Source2=pm.c
|
||||
Source3=i2c_ctr.c
|
||||
Source4=main.c
|
||||
Source5=magic.c
|
||||
Source6=WDT.c
|
||||
Source7=i2c_mcu.c
|
||||
Source8=i2c_twl.c
|
||||
Source9=led.c
|
||||
Source10=rtc.c
|
||||
Source11=vreg_ctr.c
|
||||
Source12=vreg_twl.c
|
||||
Source13=adc.c
|
||||
Source14=renge\renge.c
|
||||
Source15=accero.c
|
||||
Source16=self_flash.c
|
||||
Source17=sw.c
|
||||
Source18=task_debug.c
|
||||
Source19=task_misc.c
|
||||
Source20=task_sys.c
|
||||
Source21=pedo_alg_thre_det2.c
|
||||
Source22=ini_VECT.c
|
||||
[IncFile]
|
||||
Include1=incs_loader.h
|
||||
Include2=jhl_defs.h
|
||||
Include3=config.h
|
||||
Include4=user_define.h
|
||||
Include5=bsr_system.h
|
||||
Include6=renge\renge.h
|
||||
Include7=renge\renge_defs.h
|
||||
Include8=renge\renge_task_immediate.h
|
||||
Include9=vreg_ctr.h
|
||||
Include10=vreg_twl.h
|
||||
Include11=loader.h
|
||||
Include12=i2c_mcu.h
|
||||
Include13=WDT.h
|
||||
Include14=fsl.h
|
||||
Include15=fsl_user.h
|
||||
Include16=i2c_ctr.h
|
||||
Include17=pm.h
|
||||
Include18=rtc.h
|
||||
Include19=reboot.h
|
||||
Include20=incs.h
|
||||
Include21=accero.h
|
||||
Include22=pedometer.h
|
||||
Include23=adc.h
|
||||
Include24=led.h
|
||||
Include25=batt_params.h
|
||||
Include26=..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
|
||||
Include27=i2c_twl_defs.h
|
||||
Include28=renge\renge_task_intval.h
|
||||
Include29=..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h
|
||||
Include30=i2c_twl.h
|
||||
Include31=sw.h
|
||||
Include32=self_flash.h
|
||||
Include33=pool.h
|
||||
Include34=pedo_lpf_coeff.h
|
||||
[Options.CC78K0R 0]
|
||||
Version=210
|
||||
Include0=renge,C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r
|
||||
@ -689,6 +755,89 @@ Usesaddrchk=0
|
||||
Autoallocationchk=1
|
||||
Jumpoptimize=1
|
||||
Librarycallchk=1
|
||||
Librarycall=1129
|
||||
Aggressivechk=1
|
||||
Relativebranchchk=1
|
||||
Debugoptchk=0
|
||||
Outdebugchk=1
|
||||
Outdebug=1153
|
||||
Outasmsrccmb0=inter_asm
|
||||
Outasmsrccmb1=bsr.asm
|
||||
Outasmsrcchk=1
|
||||
Outasmsrc=1158
|
||||
Outasmoptall=1
|
||||
Common=0
|
||||
Outerrlistchk=0
|
||||
Outerrlist=1174
|
||||
Xreference=0
|
||||
Preprocess=0
|
||||
Prenocomment=0
|
||||
Predefine=0
|
||||
Preifdef=1
|
||||
Preinclude=1
|
||||
Preline=1
|
||||
Prenumber=1
|
||||
Formfeed=0
|
||||
Columns=132
|
||||
Lines=0
|
||||
Tablength=8
|
||||
Ansi=0
|
||||
Cpraspras=1
|
||||
Commentnest=0
|
||||
Intunexpand=0
|
||||
Kanjicode=1210
|
||||
Verbose=0
|
||||
CommandFile=0
|
||||
Warninglevel=2
|
||||
Startupchk=1
|
||||
Fixation=0
|
||||
FarROMization=0
|
||||
Objectsel=1305
|
||||
Librarychk=1
|
||||
Floatingpoint=0
|
||||
Muldivunit=1
|
||||
Mulunit=1
|
||||
Startup=s0rm.rel
|
||||
Library1=cl0rdm.lib
|
||||
Library2=cl0rm.lib
|
||||
Library3=cl0rmf.lib
|
||||
VfiFileBoot0=
|
||||
VfiFileBoot1=boot.vfi
|
||||
VF78K0Rchk=0
|
||||
VF78K0Rvs=
|
||||
[Options.CC78K0R 2 led.c]
|
||||
Version=210
|
||||
Define0=
|
||||
Define1=_debug_,_TEG_,proc_is_ke3
|
||||
Define2=_debug_,_TEG_,proc_is_ke3,%time%
|
||||
Undefine0=
|
||||
Include0=renge,C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r
|
||||
Include1=renge,C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r
|
||||
Include2=renge,C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r
|
||||
Include3=renge,C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r
|
||||
Include4=C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r
|
||||
Memorymodel=1
|
||||
Flashobj=0
|
||||
FlashStartadr=
|
||||
FlashBranchStartadr=
|
||||
Mirror=0
|
||||
Saddrglobalchk=0
|
||||
Saddrglobal=1066
|
||||
Saddrstaticchk=0
|
||||
Saddrstatic=1072
|
||||
Bitfieldmsb=0
|
||||
Onebytechk=0
|
||||
Pacstructchk=0
|
||||
AssignROMchk=0
|
||||
AssignROM=0
|
||||
Maxoptimizechk=0
|
||||
Maxoptimize=1104
|
||||
Charunexpandchk=0
|
||||
Unsignedchar=0
|
||||
Usesaddrchk=0
|
||||
Autoallocationchk=1
|
||||
Jumpoptimize=1
|
||||
Librarycallchk=1
|
||||
Librarycall=1132
|
||||
Aggressivechk=1
|
||||
Relativebranchchk=1
|
||||
@ -722,7 +871,7 @@ Intunexpand=0
|
||||
Kanjicode=1210
|
||||
Verbose=0
|
||||
CommandFile=0
|
||||
Warninglevel=1
|
||||
Warninglevel=2
|
||||
Startupchk=1
|
||||
Fixation=0
|
||||
FarROMization=0
|
||||
@ -978,69 +1127,3 @@ VfiFileBoot0=
|
||||
VfiFileBoot1=boot.vfi
|
||||
VF78K0Rchk=0
|
||||
VF78K0Rvs=
|
||||
[ToolSet]
|
||||
ToolSetName=(•Ï<E280A2>X)78K0R Software Package V1.10
|
||||
Tool1=CC78K0R|W2.10
|
||||
Tool2=RA78K0R|W1.31
|
||||
Tool3=ID78K0R-QB|V3.60
|
||||
[SrcFile]
|
||||
Source1=loader.c
|
||||
Source2=pm.c
|
||||
Source3=i2c_ctr.c
|
||||
Source4=main.c
|
||||
Source5=magic.c
|
||||
Source6=WDT.c
|
||||
Source7=i2c_mcu.c
|
||||
Source8=i2c_twl.c
|
||||
Source9=ini_VECT.c
|
||||
Source10=led.c
|
||||
Source11=rtc.c
|
||||
Source12=vreg_ctr.c
|
||||
Source13=vreg_twl.c
|
||||
Source14=adc.c
|
||||
Source15=renge\renge.c
|
||||
Source16=accero.c
|
||||
Source17=self_flash.c
|
||||
Source18=sw.c
|
||||
Source19=task_debug.c
|
||||
Source20=task_misc.c
|
||||
Source21=task_sys.c
|
||||
Source22=pedo_alg_thre_det2.c
|
||||
[BuildBefore-AfterCmd]
|
||||
Before1=touch magic.c
|
||||
After1=ruby nec_s_2_bsrbin2.rb bsr.hex
|
||||
[IncFile]
|
||||
Include1=incs_loader.h
|
||||
Include2=jhl_defs.h
|
||||
Include3=config.h
|
||||
Include4=user_define.h
|
||||
Include5=bsr_system.h
|
||||
Include6=renge\renge.h
|
||||
Include7=renge\renge_defs.h
|
||||
Include8=renge\renge_task_immediate.h
|
||||
Include9=vreg_ctr.h
|
||||
Include10=vreg_twl.h
|
||||
Include11=loader.h
|
||||
Include12=i2c_mcu.h
|
||||
Include13=WDT.h
|
||||
Include14=fsl.h
|
||||
Include15=fsl_user.h
|
||||
Include16=i2c_ctr.h
|
||||
Include17=pm.h
|
||||
Include18=rtc.h
|
||||
Include19=reboot.h
|
||||
Include20=incs.h
|
||||
Include21=accero.h
|
||||
Include22=pedometer.h
|
||||
Include23=adc.h
|
||||
Include24=led.h
|
||||
Include25=batt_params.h
|
||||
Include26=..\..\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r\fsl.h
|
||||
Include27=i2c_twl_defs.h
|
||||
Include28=renge\renge_task_intval.h
|
||||
Include29=..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\inc78k0r\math.h
|
||||
Include30=i2c_twl.h
|
||||
Include31=sw.h
|
||||
Include32=self_flash.h
|
||||
Include33=pool.h
|
||||
Include34=pedo_lpf_coeff.h
|
||||
|
Loading…
Reference in New Issue
Block a user