summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2022-12-23 23:00:26 -0500
committerMan, Jianting (Meco) <[email protected]>2022-12-26 02:10:30 -0500
commitd3c77d907f67b8215e3ac9265c0a3ddd4810cfe9 (patch)
tree88de7c0cf9af64fccbb0858708eb6034e956c8d5
parent40a24806f984e646a7aeb0c013eac26d77da5e71 (diff)
[sensor] set power and accuracy as the hightest level
-rw-r--r--components/drivers/sensor/sensor.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/drivers/sensor/sensor.c b/components/drivers/sensor/sensor.c
index 4966a45405..7646d7e0b1 100644
--- a/components/drivers/sensor/sensor.c
+++ b/components/drivers/sensor/sensor.c
@@ -493,5 +493,10 @@ int rt_hw_sensor_register(rt_sensor_t sensor,
LOG_I("sensor[%s] init success", device_name);
rt_free(device_name);
+
+ /* set sensor accuracy and power as the hightest */
+ rt_device_control(device, RT_SENSOR_CTRL_SET_ACCURACY_MODE, RT_SENSOR_MODE_ACCURACY_HIGHEST);
+ rt_device_control(device, RT_SENSOR_CTRL_SET_POWER_MODE, RT_SENSOR_MODE_POWER_HIGHEST);
+
return RT_EOK;
}