summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/drivers/zephyr/battery_voltage_divider.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/drivers/zephyr/battery_voltage_divider.c b/app/drivers/zephyr/battery_voltage_divider.c
index 980f1b4..6139d46 100644
--- a/app/drivers/zephyr/battery_voltage_divider.c
+++ b/app/drivers/zephyr/battery_voltage_divider.c
@@ -58,6 +58,11 @@ static int bvd_sample_fetch(struct device *dev, enum sensor_channel chan) {
const struct bvd_config *drv_cfg = dev->config_info;
struct adc_sequence *as = &drv_data->as;
+ // Make sure selected channel is supported
+ if (chan != SENSOR_CHAN_GAUGE_VOLTAGE && chan != SENSOR_CHAN_GAUGE_STATE_OF_CHARGE) {
+ return -ENOTSUP;
+ }
+
int rc = 0;
// Enable power GPIO if present