暂时沿用wf5803

This commit is contained in:
stark1898y 2024-11-21 15:04:27 +08:00
parent 486c9f875b
commit 457c817fcb
1 changed files with 10 additions and 10 deletions

View File

@ -116,7 +116,7 @@ void PRESS_IO_SPI_Init(void)
PRESS_SPI_CsStop(kPressOut);
PRESS_SPI_CsStop(kPressAtom);
// spi初始化模式0
// spi初始化模式0
GPIOA_ModeCfg(GPIO_Pin_13 | GPIO_Pin_14, GPIO_ModeOut_PP_5mA);
GPIOA_ModeCfg(GPIO_Pin_15, GPIO_ModeIN_PU);
@ -126,14 +126,14 @@ void PRESS_IO_SPI_Init(void)
void WF5803_Init(void)
{
PRESS_IO_SPI_Init();
WF5803_WriteReg(0x00, 0x81, kPressIn); // 配置spi为四线模式
WF5803_WriteReg(0x00, 0x81, kPressOut); // 配置spi为四线模式
WF5803_WriteReg(0x00, 0x81, kPressAtom); // 配置spi为四线模式
WF5803_WriteReg(0x00, 0x81, kPressIn); // 配置spi为四线模式
WF5803_WriteReg(0x00, 0x81, kPressOut); // 配置spi为四线模式
WF5803_WriteReg(0x00, 0x81, kPressAtom); // 配置spi为四线模式
}
void PRESS_LowerIO_Init(void)
{
// WF5803默认供电时其他IO都是高电平
// WF5803默认供电时其他IO都是高电平
// SPI
GPIOA_SetBits(GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
GPIOA_ModeCfg(GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15, GPIO_ModeIN_PU);
@ -189,8 +189,8 @@ uint8_t GetSensorData(TePressSensorIndex index)
PRINT("Status = %02x\r\n", WF5803_ReadReg(0x02, index));
// 气压数据
// 温度数据
// 气压数据
// 温度数据
for (uint8_t i = 0; i < 5; i++)
{
press_raw_data[index][i] = WF5803_ReadReg(0x06 + i, index);
@ -222,7 +222,7 @@ void SensorData_Process(TePressSensorIndex index)
fDat = reading / 8388608.0f;
}
press = fDat * 125 + 17.5; // WF5803_1BAR 如果是使用10m级别的深传就使用这个
press = fDat * 125 + 17.5; // WF5803_1BAR 如果是使用10m级别的深传就使用这个
reading = press_raw_data[index][3];
reading = reading << 8;