From d88fef1e839adb1687ebac08f494bf62f857db9b Mon Sep 17 00:00:00 2001 From: fujita_ryohei Date: Thu, 4 Feb 2010 07:47:38 +0000 Subject: [PATCH] =?UTF-8?q?=E6=AD=A9=E6=95=B0=E8=A8=88=E3=83=87=E3=83=90?= =?UTF-8?q?=E3=83=83=E3=82=B0=E7=94=A8=E3=81=ABIIC2=E3=83=AC=E3=82=B8?= =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=81=AB=E3=83=87=E3=83=BC=E3=82=BF=E3=82=92?= =?UTF-8?q?=E5=90=90=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@94 013db118-44a6-b54f-8bf7-843cb86687b1 --- trunk/accero.c | 21 +++++++++++++++++++++ trunk/config.h | 2 +- trunk/i2c_ctr.c | 7 ++----- trunk/i2c_twl.c | 4 ++-- trunk/pm.c | 8 ++++---- trunk/rtc.c | 1 - trunk/rtc.h | 1 - trunk/task_misc.c | 3 ++- trunk/user_define.h | 2 -- trunk/vreg_ctr.h | 20 +++++++++++++++++++- trunk/vreg_twl.h | 8 ++++++++ trunk/yav_mcu_bsr.plg | 23 ++++++++++++++++++----- 12 files changed, 77 insertions(+), 23 deletions(-) diff --git a/trunk/accero.c b/trunk/accero.c index f12b905..d277b34 100644 --- a/trunk/accero.c +++ b/trunk/accero.c @@ -149,7 +149,28 @@ task_status_immed tsk_cbk_accero( ) { time_l += ( time_l != 65535 ) ? 1: 0; } + + { + static u8 i = 0; + + vreg_ctr[VREG_C_ACC_DBG_0] = i; + + vreg_ctr[VREG_C_ACC_DBG_1] = (u8)( acc_norm[0] / 256 & 0x00FF ); + vreg_ctr[VREG_C_ACC_DBG_2] = (u8)( acc_norm[0] & 0x00FF ); + + vreg_ctr[VREG_C_ACC_DBG_3] = (u8)( interval_hh / 256 & 0x00FF ); + vreg_ctr[VREG_C_ACC_DBG_4] = (u8)( interval_hh & 0x00FF ); + + vreg_ctr[VREG_C_ACC_DBG_5] = (u8)( time_l / 256 & 0x00FF ); + vreg_ctr[VREG_C_ACC_DBG_6] = (u8)( time_l & 0x00FF ); + + vreg_ctr[VREG_C_ACC_DBG_7] = vreg_ctr[ VREG_C_ACC_HOSU_L ]; + } + + + } + return ( ERR_SUCCESS ); } diff --git a/trunk/config.h b/trunk/config.h index 6bf9ce9..d6cec3d 100644 --- a/trunk/config.h +++ b/trunk/config.h @@ -2,7 +2,7 @@ #define __config__ #define _debug_ -// #define _debug_led_ +//#define _debug_led_ #define MCU_VER_MAJOR 0x00 diff --git a/trunk/i2c_ctr.c b/trunk/i2c_ctr.c index 0c0d981..1159e6b 100644 --- a/trunk/i2c_ctr.c +++ b/trunk/i2c_ctr.c @@ -68,7 +68,6 @@ __interrupt void int_iic_ctr( ) static u8 reg_adrs_internal; static u8 tx_buf; u8 rx_buf; - u8 tx_buf_temp; EI(); @@ -168,7 +167,7 @@ __interrupt void int_iic_ctr( ) default: // バースト R/W でここが何回も呼ばれることになる if( state == IIC_TX ) { // 送信 -// IICA = tx_buf; + IICA = tx_buf; vreg_ctr_after_read( reg_adrs ); // 読んだらクリアなどの処理 } else @@ -184,9 +183,7 @@ __interrupt void int_iic_ctr( ) if( state == IIC_TX ) { // さらにつぎに送るデータの準備だけシテオク。SPが来て使われないかもしれない - tx_buf_temp = vreg_ctr_read( reg_adrs ); - IICA = tx_buf; - tx_buf = tx_buf_temp; + tx_buf = vreg_ctr_read( reg_adrs ); } break; } diff --git a/trunk/i2c_twl.c b/trunk/i2c_twl.c index 9c9377e..1df2e57 100644 --- a/trunk/i2c_twl.c +++ b/trunk/i2c_twl.c @@ -95,13 +95,13 @@ __interrupt void int_iic_twl( ) } */ WREL = 1; // ウェイト解除して次のバイトを待つ - wait_next; // 1バイト受信完了を待つ // 2回目 R/W レジスタアドレス temp = IICA; - WREL = 1; IICAIF = 0; + WREL = 1; + vreg_adrs = adrs_table_twl_ext2int( temp ); // 3回目 diff --git a/trunk/pm.c b/trunk/pm.c index 38cbea0..dc9a76f 100644 --- a/trunk/pm.c +++ b/trunk/pm.c @@ -503,13 +503,13 @@ err PM_sys_pow_on( ) PM_reset_neg(); RESET2_neg; FCRAM_RST_neg; - +/* wait_ms( 100 ); { // CODEC 不定レジスタ初期化 u8 codec_reg_init[3] = { 0,0,0 }; iic_mcu_write( IIC_SLA_CODEC, CODEC_REG_PM, 3, codec_reg_init ); } - +*/ #else // TWL PMIC u8 temp; @@ -531,7 +531,6 @@ err PM_sys_pow_on( ) return ( ERR_ERR ); } vreg_ctr[VREG_C_BT_REMAIN] = temp; - PM_reset_neg(); RESET2_neg; FCRAM_RST_neg; @@ -544,11 +543,12 @@ err PM_sys_pow_on( ) FCRAM_RST_ast; return ( ERR_ERR ); } +/* { // CODEC 不定レジスタ初期化 u8 codec_reg_init[3] = { 0,0,0 }; iic_mcu_write( IIC_SLA_CODEC, CODEC_REG_PM, 3, codec_reg_init ); } - +*/ #endif return ( ERR_SUCCESS ); diff --git a/trunk/rtc.c b/trunk/rtc.c index 6773e6a..fd0f60d 100644 --- a/trunk/rtc.c +++ b/trunk/rtc.c @@ -70,7 +70,6 @@ void RTC_init( void ) ======================================================== */ __interrupt void int_rtc( ) { - EI(); // 日付も指定日で if( ( vreg_ctr[VREG_C_RTC_ALARM_DAY] == DAY ) && ( vreg_ctr[VREG_C_RTC_ALARM_MONTH] == MONTH ) diff --git a/trunk/rtc.h b/trunk/rtc.h index a29ca0a..cd1a0f7 100644 --- a/trunk/rtc.h +++ b/trunk/rtc.h @@ -3,7 +3,6 @@ void RTC_init( void ); -__interrupt void int_rtc_int( ); void rtc_buf_reflesh( ); void set_rtc( ); diff --git a/trunk/task_misc.c b/trunk/task_misc.c index 4abdbb1..113f1d2 100644 --- a/trunk/task_misc.c +++ b/trunk/task_misc.c @@ -148,13 +148,14 @@ task_status_immed do_command0( ) FCRAM_RST_neg; RESET2_neg; PM_reset_neg(); - +/* // CODEC 不定レジスタ初期化 wait_ms( 100 ); { u8 codec_reg_init[3] = { 0,0,0 }; iic_mcu_write( IIC_SLA_CODEC, CODEC_REG_PM, 3, codec_reg_init ); } +*/ } } diff --git a/trunk/user_define.h b/trunk/user_define.h index 2bd0847..2e123cd 100644 --- a/trunk/user_define.h +++ b/trunk/user_define.h @@ -27,10 +27,8 @@ #define DBG_LED_WIFI_2_toggle ( P2.4 ^= 1 ) #else -#define DBG_LED_WIFI_on ; #define DBG_LED_WIFI_2_on ; #define DBG_LED_WIFI_2_off ; -#define DBG_LED_WIFI_off ; #define DBG_LED_WIFI_2_toggle ; #endif diff --git a/trunk/vreg_ctr.h b/trunk/vreg_ctr.h index 8a8c940..90b86b3 100644 --- a/trunk/vreg_ctr.h +++ b/trunk/vreg_ctr.h @@ -231,6 +231,25 @@ enum VREG_C // VREG_C_AMBIENT_BRIGHTNESS = 0x60, +// 歩数計の評価のため... + VREG_C_ACC_DBG_0 = 0x50, + VREG_C_ACC_DBG_1, + VREG_C_ACC_DBG_2, + VREG_C_ACC_DBG_3, + VREG_C_ACC_DBG_4, + VREG_C_ACC_DBG_5, + VREG_C_ACC_DBG_6, + VREG_C_ACC_DBG_7, + VREG_C_ACC_DBG_8, + VREG_C_ACC_DBG_9, + VREG_C_ACC_DBG_A, + VREG_C_ACC_DBG_B, + VREG_C_ACC_DBG_C, + VREG_C_ACC_DBG_D, + VREG_C_ACC_DBG_E, + VREG_C_ACC_DBG_F, + + VREG_C_ENDMARK_ }; /* @@ -245,5 +264,4 @@ u8 vreg_ctr_read( u8 phy_adrs ); void vreg_ctr_after_read( u8 adrs ); void set_irq( u8 irqreg, u8 irq_flg ); - #endif diff --git a/trunk/vreg_twl.h b/trunk/vreg_twl.h index 007acc7..19d8bd8 100644 --- a/trunk/vreg_twl.h +++ b/trunk/vreg_twl.h @@ -118,4 +118,12 @@ u8 vreg_twl_read( u8 phy_adrs ); task_status_immed command_from_twl( ); + +// 読んだらクリアなどの処理 +#define vreg_twl_after_read( reg_adrs ); \ + if( reg_adrs == REG_TWL_INT_ADRS_IRQ ) \ + { \ + vreg_twl[ REG_TWL_INT_ADRS_IRQ ]= 0;\ + } + #endif diff --git a/trunk/yav_mcu_bsr.plg b/trunk/yav_mcu_bsr.plg index 0c1f022..f313cc8 100644 --- a/trunk/yav_mcu_bsr.plg +++ b/trunk/yav_mcu_bsr.plg @@ -1,13 +1,26 @@ 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 loader.c -loader.c(111) : CC78K0R warning W0401: Conversion may lose significant digits -Compilation complete, 0 error(s) and 1 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\loader.asm +"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(167) : CC78K0R warning W0401: Conversion may lose significant digits +pm.c(178) : CC78K0R warning W0401: Conversion may lose significant digits +pm.c(182) : CC78K0R warning W0401: Conversion may lose significant digits +pm.c(233) : CC78K0R warning W0401: Conversion may lose significant digits +pm.c(270) : CC78K0R warning W0401: Conversion may lose significant digits +pm.c(349) : CC78K0R warning W0401: Conversion may lose significant digits +pm.c(357) : CC78K0R warning W0401: Conversion may lose significant digits +pm.c(839) : 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 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 task_misc.c +task_misc.c(48) : CC78K0R warning W0401: Conversion may lose significant digits +task_misc.c(34) : CC78K0R warning W0401: Conversion may lose significant digits +Compilation complete, 0 error(s) and 2 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\task_misc.asm +Assembly complete, 0 error(s) and 0 warning(s) found. "C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\lk78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -obsr.lmf "..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r\s0rm.rel" -go85h,0FC00h,1024 -gi0FFFFFFFFFFFFFFFFFFFFh -pbsr_k0r.map -nkd -kp -gb7EFBFFh -b"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib" -bcl0rdm.lib -bcl0rm.lib -bcl0rmf.lib -i"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r" -dbsr_mcu.dr -s -w0 loader.rel pm.rel i2c_ctr.rel main.rel magic.rel WDT.rel i2c_mcu.rel i2c_twl.rel ini_VECT.rel led.rel rtc.rel vreg_ctr.rel vreg_twl.rel adc.rel renge.rel accero.rel self_flash.rel reboot.rel sw.rel task_debug.rel task_misc.rel task_sys.rel Link complete, 0 error(s) and 0 warning(s) found. "C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\oc78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -o.\bsr.hex -nu -ki bsr.lmf @@ -18,4 +31,4 @@ intel-HEX to bsr bin converter file converted! -Build Total error(s) : 0 Total warning(s) : 1 +Build Total error(s) : 0 Total warning(s) : 10