From 8946ed4b8c9ab1a8c1a44291b651dc14b2678d68 Mon Sep 17 00:00:00 2001 From: fujita_ryohei Date: Thu, 1 Apr 2010 04:19:22 +0000 Subject: [PATCH] =?UTF-8?q?=E6=AD=A9=E6=95=B0=E8=A8=88OFF=E3=81=A7?= =?UTF-8?q?=E3=82=82=E5=8A=A0=E9=80=9F=E5=BA=A6=E3=82=BB=E3=83=B3=E3=82=B5?= =?UTF-8?q?ON=E3=81=A7=E6=AD=A9=E6=95=B0=E3=82=AB=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=97=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= 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@113 013db118-44a6-b54f-8bf7-843cb86687b1 --- trunk/accero.c | 41 +++++++++++++++++++++++++++-------------- trunk/config.h | 2 +- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/trunk/accero.c b/trunk/accero.c index 06ebfb9..bc35257 100644 --- a/trunk/accero.c +++ b/trunk/accero.c @@ -65,17 +65,33 @@ task_status tsk_soft_int( ); task_status_immed tsk_cbk_accero( ) { // (疑似)isrから登録されます - if( system_status.pwr_state == ON ) +/* + if(( system_status.pwr_state == OFF ) || ( system_status.pwr_state == BT_CHARGE ) ) { + return ( ERR_SUCCESS ); + } + else + { +*/ // 加速度センサデータレジスタへの反映 if( iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, &vreg_ctr[VREG_C_ACC_XL] ) - == ERR_SUCCESS ) + != ERR_SUCCESS ) + { + // 加速度センサが異常になったので止める + vreg_ctr[VREG_C_ACC_CONFIG] &= ~( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ); +// vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_ACCERO_ERR; + acc_hosu_set(); + return ( ERR_SUCCESS ); // タスクの削除は必要 + } + else { - if( ( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_ACQ ) != 0 ) + // 正常時パス // + // 加速度更新&割り込み + if( (( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_ACQ ) != 0 ) && + ( system_status.pwr_state == ON ) + ) { set_irq( VREG_C_IRQ1, REG_BIT_ACC_DAT_RDY ); - } - // ゴミデータのカラ読み if( ACC_VALID == 1 ) { @@ -83,19 +99,16 @@ task_status_immed tsk_cbk_accero( ) iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, temp ); } } - else + if(( system_status.pwr_state != OFF ) && + ( system_status.pwr_state != BT_CHARGE ) && + ( ( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_HOSU ) != 0 ) + ) { - // 加速度センサが異常になったので止める - vreg_ctr[VREG_C_ACC_CONFIG] &= ~( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ); - acc_hosu_set(); - return ( ERR_SUCCESS ); // タスクの削除は必要 - } - } - DBG_LED_WIFI_2_on; pedometer(); // 歩数計 DBG_LED_WIFI_2_off; - + } + } return ( ERR_SUCCESS ); } diff --git a/trunk/config.h b/trunk/config.h index 656cd5a..cd1f51d 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