change SensorQuantityRead with SensorQuantityReadValue for sensor framework

This commit is contained in:
Liu_Weichao
2022-08-31 10:54:54 +08:00
parent f55022fc46
commit b5b3cb9ca7
17 changed files with 81 additions and 36 deletions

View File

@@ -30,7 +30,7 @@ void AltitudeBmp180(void)
int32 altitude;
struct SensorQuantity *p_altitude = SensorQuantityFind(SENSOR_QUANTITY_BMP180_ALTITUDE, SENSOR_QUANTITY_ALTITUDE);
SensorQuantityOpen(p_altitude);
altitude = SensorQuantityRead(p_altitude);
altitude = SensorQuantityReadValue(p_altitude);
printf("Altitude Pressure : %d Pa\n", altitude);

View File

@@ -31,6 +31,6 @@ void Ch4As830(void)
{
struct SensorQuantity *ch4 = SensorQuantityFind(SENSOR_QUANTITY_AS830_CH4, SENSOR_QUANTITY_CH4);
SensorQuantityOpen(ch4);
printf("CH4 : %d %%LTL\n", SensorQuantityRead(ch4));
printf("CH4 : %d %%LTL\n", SensorQuantityReadValue(ch4));
SensorQuantityClose(ch4);
}

View File

@@ -31,6 +31,6 @@ void Co2G8s(void)
{
struct SensorQuantity *co2 = SensorQuantityFind(SENSOR_QUANTITY_G8S_CO2, SENSOR_QUANTITY_CO2);
SensorQuantityOpen(co2);
printf("CO2 : %d ppm\n", SensorQuantityRead(co2));
printf("CO2 : %d ppm\n", SensorQuantityReadValue(co2));
SensorQuantityClose(co2);
}

View File

@@ -31,6 +31,6 @@ void Co2Zg09(void)
{
struct SensorQuantity *co2 = SensorQuantityFind(SENSOR_QUANTITY_ZG09_CO2, SENSOR_QUANTITY_CO2);
SensorQuantityOpen(co2);
printf("CO2 : %d ppm\n", SensorQuantityRead(co2));
printf("CO2 : %d ppm\n", SensorQuantityReadValue(co2));
SensorQuantityClose(co2);
}

View File

@@ -34,7 +34,7 @@ void HchoTb600bHcho1os(void)
SensorQuantityOpen(hcho);
int32_t result = 0;
result = SensorQuantityRead(hcho);
result = SensorQuantityReadValue(hcho);
printf("tvoc concentration is : %dppb\n", result);
SensorQuantityClose(hcho);

View File

@@ -35,7 +35,7 @@ void HumiHs300x(void)
struct SensorQuantity *humi = SensorQuantityFind(SENSOR_QUANTITY_HS300X_HUMIDITY, SENSOR_QUANTITY_HUMI);
SensorQuantityOpen(humi);
for (i = 0; i < 100; i ++) {
humidity = SensorQuantityRead(humi);
humidity = SensorQuantityReadValue(humi);
printf("Humidity : %d.%d %%RH\n", humidity/10, humidity%10);
PrivTaskDelay(5000);
}

View File

@@ -40,7 +40,7 @@ void IaqTb600bIaq10(void)
SensorQuantityOpen(iaq);
int32_t result = 0;
result = SensorQuantityRead(iaq);
result = SensorQuantityReadValue(iaq);
printf("Gas concentration is : %dppb\n", result);
SensorQuantityClose(iaq);

View File

@@ -33,6 +33,6 @@ void Pm100Ps5308(void)
struct SensorQuantity *pm10_0 = SensorQuantityFind(SENSOR_QUANTITY_PS5308_PM10, SENSOR_QUANTITY_PM);
SensorQuantityOpen(pm10_0);
PrivTaskDelay(2000);
printf("PM10 : %d ug/m³\n", SensorQuantityRead(pm10_0));
printf("PM10 : %d ug/m³\n", SensorQuantityReadValue(pm10_0));
SensorQuantityClose(pm10_0);
}

View File

@@ -33,6 +33,6 @@ void Pm10Ps5308(void)
struct SensorQuantity *pm1_0 = SensorQuantityFind(SENSOR_QUANTITY_PS5308_PM1_0, SENSOR_QUANTITY_PM);
SensorQuantityOpen(pm1_0);
PrivTaskDelay(2000);
printf("PM1.0 : %d ug/m³\n", SensorQuantityRead(pm1_0));
printf("PM1.0 : %d ug/m³\n", SensorQuantityReadValue(pm1_0));
SensorQuantityClose(pm1_0);
}

View File

@@ -33,6 +33,6 @@ void Pm25Ps5308(void)
struct SensorQuantity *pm2_5 = SensorQuantityFind(SENSOR_QUANTITY_PS5308_PM2_5, SENSOR_QUANTITY_PM);
SensorQuantityOpen(pm2_5);
PrivTaskDelay(2000);
printf("PM2.5 : %d ug/m³\n", SensorQuantityRead(pm2_5));
printf("PM2.5 : %d ug/m³\n", SensorQuantityReadValue(pm2_5));
SensorQuantityClose(pm2_5);
}

View File

@@ -35,7 +35,7 @@ void TempHs300x(void)
struct SensorQuantity *temp = SensorQuantityFind(SENSOR_QUANTITY_HS300X_TEMPERATURE, SENSOR_QUANTITY_TEMP);
SensorQuantityOpen(temp);
for (i = 0; i < 100; i ++) {
temperature = SensorQuantityRead(temp);
temperature = SensorQuantityReadValue(temp);
if (temperature > 0)
printf("Temperature : %d.%d ℃\n", temperature/10, temperature%10);
else

View File

@@ -34,7 +34,7 @@ void TvocTb600bTvoc10(void)
SensorQuantityOpen(tvoc);
int32_t result = 0;
result = SensorQuantityRead(tvoc);
result = SensorQuantityReadValue(tvoc);
printf("tvoc concentration is : %dppb\n", result);
SensorQuantityClose(tvoc);

View File

@@ -30,7 +30,7 @@ void VoiceD124(void)
struct SensorQuantity *voice = SensorQuantityFind(SENSOR_QUANTITY_D124_VOICE, SENSOR_QUANTITY_VOICE);
SensorQuantityOpen(voice);
PrivTaskDelay(2000);
uint16 result = SensorQuantityRead(voice);
uint16 result = SensorQuantityReadValue(voice);
printf("voice : %d.%d dB\n", result/(10*voice->value.decimal_places), result%(10*voice->value.decimal_places));
SensorQuantityClose(voice);
}

View File

@@ -30,7 +30,7 @@ void WindDirectionQsFx(void)
struct SensorQuantity *wind_direction = SensorQuantityFind(SENSOR_QUANTITY_QS_FX_WINDDIRECTION, SENSOR_QUANTITY_WINDDIRECTION);
SensorQuantityOpen(wind_direction);
PrivTaskDelay(2000);
uint16 result = SensorQuantityRead(wind_direction);
uint16 result = SensorQuantityReadValue(wind_direction);
printf("wind direction : %d degree\n", result);
SensorQuantityClose(wind_direction);
}

View File

@@ -30,7 +30,7 @@ void WindSpeedQsFs(void)
struct SensorQuantity *wind_speed = SensorQuantityFind(SENSOR_QUANTITY_QS_FS_WINDSPEED, SENSOR_QUANTITY_WINDSPEED);
SensorQuantityOpen(wind_speed);
PrivTaskDelay(2000);
uint16 result = SensorQuantityRead(wind_speed);
uint16 result = SensorQuantityReadValue(wind_speed);
printf("wind speed : %d.%d m/s\n", result/10, result%10);
SensorQuantityClose(wind_speed);
}