FILTER_NUM;=20;
void Prepare_Data(T_int16_xyz *acc_in,T_int16_xyz *acc_out)
{
static uint8_t filter_cnt=0;
static int16_tACC_X_BUF[FILTER_NUM],ACC_Y_BUF[FILTER_NUM],ACC_Z_BUF[FILTER_NUM];
ACC_X_BUF[filter_cnt] = acc_in->X;
ACC_Y_BUF[filter_cnt] = acc_in->Y;
ACC_Z_BUF[filter_cnt] = acc_in->Z;
for(i=0;i<FILTER_NUM;i++)
{
temp1 += ACC_X_BUF[i];
temp2 += ACC_Y_BUF[i];
temp3 += ACC_Z_BUF[i];
}//为什么 只赋值了一次就进入for循环 加了20次
acc_out->X = temp1 / FILTER_NUM;
acc_out->Y = temp2 / FILTER_NUM;
acc_out->Z = temp3 / FILTER_NUM;
filter_cnt++;
if(filter_cnt==FILTER_NUM)filter_cnt=0;
}
有奖活动 | |
---|---|
【有奖活动——B站互动赢积分】活动开启啦! | |
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |