drivers: sensor: vl53l1x: Allow for SENSOR_CHAN_ALL channel to be used

It mirrors the functionality of the vl53l0x driver.
Also removes an assert not needed, as the channel is checked.

Signed-off-by: Daniel Stuart <daniel.stuart14@gmail.com>
This commit is contained in:
Daniel Stuart 2023-08-17 16:09:04 -03:00 committed by Carles Cufí
commit d9e7af6cdd

View file

@ -307,7 +307,8 @@ static int vl53l1x_sample_fetch(const struct device *dev,
const struct vl53l1x_config *config = dev->config; const struct vl53l1x_config *config = dev->config;
VL53L1_Error ret; VL53L1_Error ret;
__ASSERT_NO_MSG(chan == SENSOR_CHAN_DISTANCE); __ASSERT_NO_MSG((chan == SENSOR_CHAN_ALL)
|| (chan == SENSOR_CHAN_DISTANCE));
/* Will immediately stop current measurement */ /* Will immediately stop current measurement */
ret = VL53L1_StopMeasurement(&drv_data->vl53l1x); ret = VL53L1_StopMeasurement(&drv_data->vl53l1x);
@ -340,8 +341,6 @@ static int vl53l1x_channel_get(const struct device *dev,
struct vl53l1x_data *drv_data = dev->data; struct vl53l1x_data *drv_data = dev->data;
VL53L1_Error ret; VL53L1_Error ret;
__ASSERT_NO_MSG(chan == SENSOR_CHAN_DISTANCE);
if (chan != SENSOR_CHAN_DISTANCE) { if (chan != SENSOR_CHAN_DISTANCE) {
return -ENOTSUP; return -ENOTSUP;
} }