summaryrefslogtreecommitdiff
path: root/app/drivers/sensor
diff options
context:
space:
mode:
authorinnovaker <66737976+innovaker@users.noreply.github.com>2020-11-28 20:03:12 +0000
committerPete Johanson <peter@peterjohanson.com>2020-12-14 12:41:25 -0500
commit1411092a7bb6e21e6e3a272737ad36d613e3b367 (patch)
treea8ec11125f0c76e642aab2f5042e6e9890496ad5 /app/drivers/sensor
parent33c959d0318a60a02e016f01adafaf71f4613fc9 (diff)
refactor(app): replace `driver_data` with `data`
See: https://docs.zephyrproject.org/latest/releases/release-notes-2.4.html PR: #467
Diffstat (limited to 'app/drivers/sensor')
-rw-r--r--app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c6
-rw-r--r--app/drivers/sensor/ec11/ec11.c8
-rw-r--r--app/drivers/sensor/ec11/ec11_trigger.c10
3 files changed, 12 insertions, 12 deletions
diff --git a/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c b/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c
index e38d5d9..87bd1d8 100644
--- a/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c
+++ b/app/drivers/sensor/battery_voltage_divider/battery_voltage_divider.c
@@ -56,7 +56,7 @@ static uint8_t lithium_ion_mv_to_pct(int16_t bat_mv) {
}
static int bvd_sample_fetch(struct device *dev, enum sensor_channel chan) {
- struct bvd_data *drv_data = dev->driver_data;
+ struct bvd_data *drv_data = dev->data;
const struct bvd_config *drv_cfg = dev->config;
struct adc_sequence *as = &drv_data->as;
@@ -114,7 +114,7 @@ static int bvd_sample_fetch(struct device *dev, enum sensor_channel chan) {
}
static int bvd_channel_get(struct device *dev, enum sensor_channel chan, struct sensor_value *val) {
- struct bvd_data *drv_data = dev->driver_data;
+ struct bvd_data *drv_data = dev->data;
switch (chan) {
case SENSOR_CHAN_GAUGE_VOLTAGE:
@@ -140,7 +140,7 @@ static const struct sensor_driver_api bvd_api = {
};
static int bvd_init(struct device *dev) {
- struct bvd_data *drv_data = dev->driver_data;
+ struct bvd_data *drv_data = dev->data;
const struct bvd_config *drv_cfg = dev->config;
drv_data->adc = device_get_binding(drv_cfg->io_channel.label);
diff --git a/app/drivers/sensor/ec11/ec11.c b/app/drivers/sensor/ec11/ec11.c
index 692e691..80e75aa 100644
--- a/app/drivers/sensor/ec11/ec11.c
+++ b/app/drivers/sensor/ec11/ec11.c
@@ -19,7 +19,7 @@
LOG_MODULE_REGISTER(EC11, CONFIG_SENSOR_LOG_LEVEL);
static int ec11_get_ab_state(struct device *dev) {
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
const struct ec11_config *drv_cfg = dev->config;
return (gpio_pin_get(drv_data->a, drv_cfg->a_pin) << 1) |
@@ -27,7 +27,7 @@ static int ec11_get_ab_state(struct device *dev) {
}
static int ec11_sample_fetch(struct device *dev, enum sensor_channel chan) {
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
const struct ec11_config *drv_cfg = dev->config;
uint8_t val;
int8_t delta;
@@ -70,7 +70,7 @@ static int ec11_sample_fetch(struct device *dev, enum sensor_channel chan) {
static int ec11_channel_get(struct device *dev, enum sensor_channel chan,
struct sensor_value *val) {
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
if (chan != SENSOR_CHAN_ROTATION) {
return -ENOTSUP;
@@ -91,7 +91,7 @@ static const struct sensor_driver_api ec11_driver_api = {
};
int ec11_init(struct device *dev) {
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
const struct ec11_config *drv_cfg = dev->config;
LOG_DBG("A: %s %d B: %s %d resolution %d", drv_cfg->a_label, drv_cfg->a_pin, drv_cfg->b_label,
diff --git a/app/drivers/sensor/ec11/ec11_trigger.c b/app/drivers/sensor/ec11/ec11_trigger.c
index 12173c0..c4934fb 100644
--- a/app/drivers/sensor/ec11/ec11_trigger.c
+++ b/app/drivers/sensor/ec11/ec11_trigger.c
@@ -20,7 +20,7 @@ extern struct ec11_data ec11_driver;
LOG_MODULE_DECLARE(EC11, CONFIG_SENSOR_LOG_LEVEL);
static inline void setup_int(struct device *dev, bool enable) {
- struct ec11_data *data = dev->driver_data;
+ struct ec11_data *data = dev->data;
const struct ec11_config *cfg = dev->config;
LOG_DBG("enabled %s", (enable ? "true" : "false"));
@@ -66,7 +66,7 @@ static void ec11_b_gpio_callback(struct device *dev, struct gpio_callback *cb, u
static void ec11_thread_cb(void *arg) {
struct device *dev = arg;
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
drv_data->handler(dev, drv_data->trigger);
@@ -76,7 +76,7 @@ static void ec11_thread_cb(void *arg) {
#ifdef CONFIG_EC11_TRIGGER_OWN_THREAD
static void ec11_thread(int dev_ptr, int unused) {
struct device *dev = INT_TO_POINTER(dev_ptr);
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
ARG_UNUSED(unused);
@@ -99,7 +99,7 @@ static void ec11_work_cb(struct k_work *work) {
int ec11_trigger_set(struct device *dev, const struct sensor_trigger *trig,
sensor_trigger_handler_t handler) {
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
setup_int(dev, false);
@@ -114,7 +114,7 @@ int ec11_trigger_set(struct device *dev, const struct sensor_trigger *trig,
}
int ec11_init_interrupt(struct device *dev) {
- struct ec11_data *drv_data = dev->driver_data;
+ struct ec11_data *drv_data = dev->data;
const struct ec11_config *drv_cfg = dev->config;
drv_data->dev = dev;