summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2021-01-22 18:35:21 +0800
committerGitHub <[email protected]>2021-01-22 18:35:21 +0800
commitf9c5007caea595e3d7b608f855a9fb19afe6f939 (patch)
treeb06e1303d2c427d7258b9c648a0e28f4ee0636f1 /components
parentb36aeb46a681b28224e851eb560dd71dcc502b3d (diff)
parentf3ee2dd186582715fb0d9bfca5edf8594f9a0d79 (diff)
Merge pull request #3271 from fmkong/sensor_irq_disable
[drivers/sensor]disable irq only when the sensor and module sensors a…
Diffstat (limited to 'components')
-rw-r--r--components/drivers/sensors/sensor.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/components/drivers/sensors/sensor.c b/components/drivers/sensors/sensor.c
index bbfcea97be..660b86f85b 100644
--- a/components/drivers/sensors/sensor.c
+++ b/components/drivers/sensors/sensor.c
@@ -216,12 +216,6 @@ static rt_err_t rt_sensor_close(rt_device_t dev)
sensor->config.power = RT_SENSOR_POWER_DOWN;
}
- /* Sensor disable interrupt */
- if (sensor->config.irq_pin.pin != RT_PIN_NONE)
- {
- rt_pin_irq_enable(sensor->config.irq_pin.pin, RT_FALSE);
- }
-
if (sensor->module != RT_NULL && sensor->info.fifo_max > 0 && sensor->data_buf != RT_NULL)
{
for (i = 0; i < sensor->module->sen_num; i ++)
@@ -240,6 +234,11 @@ static rt_err_t rt_sensor_close(rt_device_t dev)
}
}
}
+ /* Sensor disable interrupt */
+ if (sensor->config.irq_pin.pin != RT_PIN_NONE)
+ {
+ rt_pin_irq_enable(sensor->config.irq_pin.pin, RT_FALSE);
+ }
__exit:
if (sensor->module)