STM32F4,ADXL345参数配置
ad_cmd = 0x0B; // 中断上升沿,13位全分辨率,输出数据右对齐,16g量程
adxl345_WriteOneByte(DATA_FORMAT, ad_cmd);
ad_cmd = 0x0F; // 数据输出速度为3200Hz
adxl345_WriteOneByte(BW_RATE, ad_cmd);
ad_cmd = 0x08; // 链接使能,测量模式
adxl345_WriteOneByte(POWER_CTL, ad_cmd);
ad_cmd = 0x00; // 禁用中断
adxl345_WriteOneByte(INT_ENABLE, ad_cmd);
ad_cmd = 0x7F; // DataReady INT1中断
adxl345_WriteOneByte(INT_MAP, ad_cmd);
ad_cmd = 0x00; // xyz轴偏移
adxl345_WriteOneByte(OFSX, ad_cmd);
adxl345_WriteOneByte(OFSY, ad_cmd);
adxl345_WriteOneByte(OFSZ, ad_cmd);
ad_cmd = 0x80; // DataReady中断
adxl345_WriteOneByte(INT_ENABLE, ad_cmd);
更多回帖