mirror of
https://github.com/rvtr/ctr_mcu.git
synced 2025-10-31 13:51:10 -04:00
I2Cレジスタの加速度値の更新をアトミックに
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@355 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
parent
3775d247c2
commit
c38c488949
@ -79,9 +79,10 @@ task_status tsk_soft_int( );
|
||||
task_status_immed tski_cbk_accero( )
|
||||
{ // (疑似)isrから登録されます
|
||||
static u8 err_count;
|
||||
u8 acc_dat_buff[6];
|
||||
|
||||
// 加速度センサデータレジスタへの反映
|
||||
if( iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, &vreg_ctr[VREG_C_ACC_XL] )
|
||||
if( iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, acc_dat_buff )
|
||||
!= ERR_SUCCESS )
|
||||
{
|
||||
err_count ++;
|
||||
@ -101,6 +102,8 @@ task_status_immed tski_cbk_accero( )
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy( &vreg_ctr[VREG_C_ACC_XL], acc_dat_buff, 6 );
|
||||
|
||||
err_count = 0;
|
||||
// 正常時パス //
|
||||
// 加速度更新&割り込み
|
||||
|
||||
Loading…
Reference in New Issue
Block a user