Skip to content

Commit ada2b25

Browse files
TerryGengnathaniel-greaseboss
authored andcommitted
drivers: adc: ads114s0x: Rename variables, preparing for adding new devices
Renamed ads114s0x/8 to ads1x4s0x. Signed-off-by: Terry Geng <[email protected]>
1 parent adce223 commit ada2b25

File tree

11 files changed

+691
-659
lines changed

11 files changed

+691
-659
lines changed

drivers/adc/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ zephyr_library_sources_ifdef(CONFIG_ADC_GD32 adc_gd32.c)
3333
zephyr_library_sources_ifdef(CONFIG_ADC_ADS1112 adc_ads1112.c)
3434
zephyr_library_sources_ifdef(CONFIG_ADC_ADS1119 adc_ads1119.c)
3535
zephyr_library_sources_ifdef(CONFIG_ADC_ADS7052 adc_ads7052.c)
36-
zephyr_library_sources_ifdef(CONFIG_ADC_ADS1X4S0X adc_ads1x4s0x.c)
36+
zephyr_library_sources_ifdef(CONFIG_ADC_ADS1X4S0X adc_ads114s0x.c)
3737
zephyr_library_sources_ifdef(CONFIG_ADC_ADS131M02 adc_ads131m02.c)
3838
zephyr_library_sources_ifdef(CONFIG_ADC_RPI_PICO adc_rpi_pico.c)
3939
zephyr_library_sources_ifdef(CONFIG_ADC_XMC4XXX adc_xmc4xxx.c)

drivers/adc/Kconfig.ads1x4s0x

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,43 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
menuconfig ADC_ADS114S0X
6-
bool "Texas instruments ADS114S0x"
5+
menuconfig ADC_ADS1X4S0X
6+
bool "Texas instruments ADS1X4S0X"
77
default y
8-
depends on DT_HAS_TI_ADS114S06_ENABLED || DT_HAS_TI_ADS114S08_ENABLED \
9-
|| DT_HAS_TI_ADS124S06_ENABLED || DT_HAS_TI_ADS124S08_ENABLED
8+
depends on DT_HAS_TI_ADS1X4S08_ENABLED
109
select SPI
1110
select ADC_CONFIGURABLE_INPUTS
1211
select ADC_CONFIGURABLE_EXCITATION_CURRENT_SOURCE_PIN
1312
select ADC_CONFIGURABLE_VBIAS_PIN
1413
help
15-
Enable the driver implementation for the ADS114S0X family
14+
Enable the driver implementation for the ADS1X4S0X family
1615

17-
config ADC_ADS114S0X_ASYNC_THREAD_INIT_PRIO
18-
int "ADC ADS114S0x async thread priority"
16+
config ADC_ADS1X4S0X_ASYNC_THREAD_INIT_PRIO
17+
int "ADC ADS1X4S0X async thread priority"
1918
default 0
20-
depends on ADC_ADS114S0X
19+
depends on ADC_ADS1X4S0X
2120

22-
config ADC_ADS114S0X_ACQUISITION_THREAD_STACK_SIZE
21+
config ADC_ADS1X4S0X_ACQUISITION_THREAD_STACK_SIZE
2322
int "Stack size for the ADC data acquisition thread"
2423
default 400
25-
depends on ADC_ADS114S0X
24+
depends on ADC_ADS1X4S0X
2625
help
2726
Size of the stack used for the internal data acquisition
2827
thread.
2928

30-
config ADC_ADS114S0X_GPIO
29+
config ADC_ADS1X4S0X_GPIO
3130
bool "GPIO support"
3231
default n
33-
depends on GPIO && ADC_ADS114S0X
32+
depends on GPIO && ADC_ADS1X4S0X
3433
help
35-
Enable GPIO child device support in the ADS114S0x ADC driver.
34+
Enable GPIO child device support in the ADS1X4S0X ADC driver.
3635

37-
The GPIO functionality is handled by the ADS114S0x GPIO
36+
The GPIO functionality is handled by the ADS1X4S0X GPIO
3837
driver.
3938

40-
config ADC_ADS114S0X_WAIT_FOR_COMPLETION_TIMEOUT_MS
39+
config ADC_ADS1X4S0X_WAIT_FOR_COMPLETION_TIMEOUT_MS
4140
int "Timeout for wait for completion of a read in ms"
4241
default 1000
43-
depends on ADC_ADS114S0X
42+
depends on ADC_ADS1X4S0X
4443
help
4544
This is the wait time in ms until a read is completed.

drivers/adc/adc_ads1x4s0x.c

Lines changed: 538 additions & 556 deletions
Large diffs are not rendered by default.

drivers/gpio/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ zephyr_library()
77
# zephyr-keep-sorted-start
88
zephyr_library_sources_ifdef(CONFIG_GPIO_AD559X gpio_ad559x.c)
99
zephyr_library_sources_ifdef(CONFIG_GPIO_ADP5585 gpio_adp5585.c)
10-
zephyr_library_sources_ifdef(CONFIG_GPIO_ADS1X4S0X gpio_ads1x4s0x.c)
10+
zephyr_library_sources_ifdef(CONFIG_GPIO_ADS1X4S0X gpio_ads114s0x.c)
1111
zephyr_library_sources_ifdef(CONFIG_GPIO_ALTERA_PIO gpio_altera_pio.c)
1212
zephyr_library_sources_ifdef(CONFIG_GPIO_AMBIQ gpio_ambiq.c)
1313
zephyr_library_sources_ifdef(CONFIG_GPIO_ANDES_ATCGPIO100 gpio_andes_atcgpio100.c)

drivers/gpio/Kconfig.ads1x4s0x

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# ADS114S0x GPIO configuration options
1+
# ADS1X4S0X GPIO configuration options
22

33
# Copyright (c) 2023 SILA Embedded Solutions GmbH
44
# SPDX-License-Identifier: Apache-2.0
55

6-
menuconfig GPIO_ADS114S0X
7-
bool "ADS114S0x GPIO driver"
6+
menuconfig GPIO_ADS1X4S0X
7+
bool "ADS1X4S0X GPIO driver"
88
default y
9-
depends on DT_HAS_TI_ADS114S0X_GPIO_ENABLED
10-
depends on ADC_ADS114S0X_GPIO
9+
depends on DT_HAS_TI_ADS1X4S0X_GPIO_ENABLED
10+
depends on ADC_ADS1X4S0X_GPIO
1111
help
12-
Enable GPIO driver for ADS114S0x.
12+
Enable GPIO driver for ADS1X4S0X.
1313

14-
The ADS114S0x is a multi-channel analog frontend (AFE).
14+
The ADS1X4S0X is a multi-channel analog frontend (AFE).
1515

16-
The GPIO port of the ADS114S0x (GPIO0 to GPIO3) is exposed as a
16+
The GPIO port of the ADS1X4S0X (GPIO0 to GPIO3) is exposed as a
1717
GPIO controller driver with read/write support.
1818

19-
config GPIO_ADS114S0X_INIT_PRIORITY
19+
config GPIO_ADS1X4S0X_INIT_PRIORITY
2020
int "Driver init priority"
2121
default 99
22-
depends on GPIO_ADS114S0X
22+
depends on GPIO_ADS1X4S0X
2323
help
2424
Device driver initialization priority. This driver must be
25-
initialized after the ADS114S0x ADC driver.
25+
initialized after the ADS1X4S0X ADC driver.

drivers/gpio/gpio_ads1x4s0x.c

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@
99
* @brief GPIO driver for the ADS1X4S0X AFE.
1010
*/
1111

12-
#define DT_DRV_COMPAT ti_ads114s0x_gpio
12+
#define DT_DRV_COMPAT ti_ads1x4s0x_gpio
1313

1414
#include <zephyr/drivers/gpio.h>
1515
#include <zephyr/kernel.h>
1616

1717
#define LOG_LEVEL CONFIG_GPIO_LOG_LEVEL
1818
#include <zephyr/logging/log.h>
19-
LOG_MODULE_REGISTER(gpio_ads114s0x);
19+
LOG_MODULE_REGISTER(gpio_ads1x4s0x);
2020

2121
#include <zephyr/drivers/adc/ads1x4s0x.h>
2222

2323
#include <zephyr/drivers/gpio/gpio_utils.h>
2424

25-
struct gpio_ads114s0x_config {
25+
struct gpio_ads1x4s0x_config {
2626
/* gpio_driver_config needs to be first */
2727
struct gpio_driver_config common;
2828
const struct device *parent;
2929
};
3030

31-
struct gpio_ads114s0x_data {
31+
struct gpio_ads1x4s0x_data {
3232
/* gpio_driver_data needs to be first */
3333
struct gpio_driver_data common;
3434
};
3535

36-
static int gpio_ads114s0x_config(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags)
36+
static int gpio_ads1x4s0x_config(const struct device *dev, gpio_pin_t pin, gpio_flags_t flags)
3737
{
38-
const struct gpio_ads114s0x_config *config = dev->config;
38+
const struct gpio_ads1x4s0x_config *config = dev->config;
3939
int err = 0;
4040

4141
if ((flags & (GPIO_INPUT | GPIO_OUTPUT)) == GPIO_DISCONNECTED) {
42-
return ads114s0x_gpio_deconfigure(config->parent, pin);
42+
return ads1x4s0x_gpio_deconfigure(config->parent, pin);
4343
}
4444

4545
if ((flags & GPIO_SINGLE_ENDED) != 0) {
@@ -51,16 +51,16 @@ static int gpio_ads114s0x_config(const struct device *dev, gpio_pin_t pin, gpio_
5151
}
5252

5353
if (flags & GPIO_INT_ENABLE) {
54-
/* ads114s0x GPIOs do not support interrupts */
54+
/* ads1x4s0x GPIOs do not support interrupts */
5555
return -ENOTSUP;
5656
}
5757

5858
switch (flags & GPIO_DIR_MASK) {
5959
case GPIO_INPUT:
60-
err = ads114s0x_gpio_set_input(config->parent, pin);
60+
err = ads1x4s0x_gpio_set_input(config->parent, pin);
6161
break;
6262
case GPIO_OUTPUT:
63-
err = ads114s0x_gpio_set_output(config->parent, pin,
63+
err = ads1x4s0x_gpio_set_output(config->parent, pin,
6464
(flags & GPIO_OUTPUT_INIT_HIGH) != 0);
6565
break;
6666
default:
@@ -70,76 +70,76 @@ static int gpio_ads114s0x_config(const struct device *dev, gpio_pin_t pin, gpio_
7070
return err;
7171
}
7272

73-
static int gpio_ads114s0x_port_get_raw(const struct device *dev, gpio_port_value_t *value)
73+
static int gpio_ads1x4s0x_port_get_raw(const struct device *dev, gpio_port_value_t *value)
7474
{
75-
const struct gpio_ads114s0x_config *config = dev->config;
75+
const struct gpio_ads1x4s0x_config *config = dev->config;
7676

77-
return ads114s0x_gpio_port_get_raw(config->parent, value);
77+
return ads1x4s0x_gpio_port_get_raw(config->parent, value);
7878
}
7979

80-
static int gpio_ads114s0x_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask,
80+
static int gpio_ads1x4s0x_port_set_masked_raw(const struct device *dev, gpio_port_pins_t mask,
8181
gpio_port_value_t value)
8282
{
83-
const struct gpio_ads114s0x_config *config = dev->config;
83+
const struct gpio_ads1x4s0x_config *config = dev->config;
8484

85-
return ads114s0x_gpio_port_set_masked_raw(config->parent, mask, value);
85+
return ads1x4s0x_gpio_port_set_masked_raw(config->parent, mask, value);
8686
}
8787

88-
static int gpio_ads114s0x_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins)
88+
static int gpio_ads1x4s0x_port_set_bits_raw(const struct device *dev, gpio_port_pins_t pins)
8989
{
90-
const struct gpio_ads114s0x_config *config = dev->config;
90+
const struct gpio_ads1x4s0x_config *config = dev->config;
9191

92-
return ads114s0x_gpio_port_set_masked_raw(config->parent, pins, pins);
92+
return ads1x4s0x_gpio_port_set_masked_raw(config->parent, pins, pins);
9393
}
9494

95-
static int gpio_ads114s0x_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins)
95+
static int gpio_ads1x4s0x_port_clear_bits_raw(const struct device *dev, gpio_port_pins_t pins)
9696
{
97-
const struct gpio_ads114s0x_config *config = dev->config;
97+
const struct gpio_ads1x4s0x_config *config = dev->config;
9898

99-
return ads114s0x_gpio_port_set_masked_raw(config->parent, pins, 0);
99+
return ads1x4s0x_gpio_port_set_masked_raw(config->parent, pins, 0);
100100
}
101101

102-
static int gpio_ads114s0x_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins)
102+
static int gpio_ads1x4s0x_port_toggle_bits(const struct device *dev, gpio_port_pins_t pins)
103103
{
104-
const struct gpio_ads114s0x_config *config = dev->config;
104+
const struct gpio_ads1x4s0x_config *config = dev->config;
105105

106-
return ads114s0x_gpio_port_toggle_bits(config->parent, pins);
106+
return ads1x4s0x_gpio_port_toggle_bits(config->parent, pins);
107107
}
108108

109-
static int gpio_ads114s0x_init(const struct device *dev)
109+
static int gpio_ads1x4s0x_init(const struct device *dev)
110110
{
111-
const struct gpio_ads114s0x_config *config = dev->config;
111+
const struct gpio_ads1x4s0x_config *config = dev->config;
112112

113113
if (!device_is_ready(config->parent)) {
114-
LOG_ERR("parent ads114s0x device '%s' not ready", config->parent->name);
114+
LOG_ERR("parent ads1x4s0x device '%s' not ready", config->parent->name);
115115
return -EINVAL;
116116
}
117117

118118
return 0;
119119
}
120120

121-
static const struct gpio_driver_api gpio_ads114s0x_api = {
122-
.pin_configure = gpio_ads114s0x_config,
123-
.port_set_masked_raw = gpio_ads114s0x_port_set_masked_raw,
124-
.port_set_bits_raw = gpio_ads114s0x_port_set_bits_raw,
125-
.port_clear_bits_raw = gpio_ads114s0x_port_clear_bits_raw,
126-
.port_toggle_bits = gpio_ads114s0x_port_toggle_bits,
127-
.port_get_raw = gpio_ads114s0x_port_get_raw,
121+
static DEVICE_API(gpio, gpio_ads1x4s0x_api) = {
122+
.pin_configure = gpio_ads1x4s0x_config,
123+
.port_set_masked_raw = gpio_ads1x4s0x_port_set_masked_raw,
124+
.port_set_bits_raw = gpio_ads1x4s0x_port_set_bits_raw,
125+
.port_clear_bits_raw = gpio_ads1x4s0x_port_clear_bits_raw,
126+
.port_toggle_bits = gpio_ads1x4s0x_port_toggle_bits,
127+
.port_get_raw = gpio_ads1x4s0x_port_get_raw,
128128
};
129129

130-
BUILD_ASSERT(CONFIG_GPIO_ADS114S0X_INIT_PRIORITY > CONFIG_ADC_INIT_PRIORITY,
131-
"ADS114S0X GPIO driver must be initialized after ADS114S0X ADC driver");
130+
BUILD_ASSERT(CONFIG_GPIO_ADS1X4S0X_INIT_PRIORITY > CONFIG_ADC_INIT_PRIORITY,
131+
"ADS1X4S0X GPIO driver must be initialized after ADS1X4S0X ADC driver");
132132

133-
#define GPIO_ADS114S0X_DEVICE(id) \
134-
static const struct gpio_ads114s0x_config gpio_ads114s0x_##id##_cfg = { \
133+
#define GPIO_ADS1X4S0X_DEVICE(id) \
134+
static const struct gpio_ads1x4s0x_config gpio_ads1x4s0x_##id##_cfg = { \
135135
.common = {.port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(id)}, \
136136
.parent = DEVICE_DT_GET(DT_INST_BUS(id)), \
137137
}; \
138138
\
139-
static struct gpio_ads114s0x_data gpio_ads114s0x_##id##_data; \
139+
static struct gpio_ads1x4s0x_data gpio_ads1x4s0x_##id##_data; \
140140
\
141-
DEVICE_DT_INST_DEFINE(id, gpio_ads114s0x_init, NULL, &gpio_ads114s0x_##id##_data, \
142-
&gpio_ads114s0x_##id##_cfg, POST_KERNEL, \
143-
CONFIG_GPIO_ADS114S0X_INIT_PRIORITY, &gpio_ads114s0x_api);
141+
DEVICE_DT_INST_DEFINE(id, gpio_ads1x4s0x_init, NULL, &gpio_ads1x4s0x_##id##_data, \
142+
&gpio_ads1x4s0x_##id##_cfg, POST_KERNEL, \
143+
CONFIG_GPIO_ADS1X4S0X_INIT_PRIORITY, &gpio_ads1x4s0x_api);
144144

145-
DT_INST_FOREACH_STATUS_OKAY(GPIO_ADS114S0X_DEVICE)
145+
DT_INST_FOREACH_STATUS_OKAY(GPIO_ADS1X4S0X_DEVICE)

dts/bindings/gpio/ti,ads1x4s0x-gpio.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
description: TI ADS114S0x GPIO controller binding
88

9-
compatible: "ti,ads114s0x-gpio"
9+
compatible: "ti,ads1x4s0x-gpio"
1010

1111
include: [gpio-controller.yaml, base.yaml]
1212

include/zephyr/drivers/adc/ads1x4s0x.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#ifndef ZEPHYR_INCLUDE_DRIVERS_ADC_ADS114S0X_H_
8-
#define ZEPHYR_INCLUDE_DRIVERS_ADC_ADS114S0X_H_
7+
#ifndef ZEPHYR_INCLUDE_DRIVERS_ADC_ADS1X4S0X_H_
8+
#define ZEPHYR_INCLUDE_DRIVERS_ADC_ADS1X4S0X_H_
99

1010
#include <zephyr/device.h>
1111
#include <zephyr/drivers/gpio.h>
1212

13-
int ads114s0x_gpio_set_output(const struct device *dev, uint8_t pin, bool initial_value);
13+
int ads1x4s0x_gpio_set_output(const struct device *dev, uint8_t pin, bool initial_value);
1414

15-
int ads114s0x_gpio_set_input(const struct device *dev, uint8_t pin);
15+
int ads1x4s0x_gpio_set_input(const struct device *dev, uint8_t pin);
1616

17-
int ads114s0x_gpio_deconfigure(const struct device *dev, uint8_t pin);
17+
int ads1x4s0x_gpio_deconfigure(const struct device *dev, uint8_t pin);
1818

19-
int ads114s0x_gpio_set_pin_value(const struct device *dev, uint8_t pin,
19+
int ads1x4s0x_gpio_set_pin_value(const struct device *dev, uint8_t pin,
2020
bool value);
2121

22-
int ads114s0x_gpio_get_pin_value(const struct device *dev, uint8_t pin,
22+
int ads1x4s0x_gpio_get_pin_value(const struct device *dev, uint8_t pin,
2323
bool *value);
2424

25-
int ads114s0x_gpio_port_get_raw(const struct device *dev,
25+
int ads1x4s0x_gpio_port_get_raw(const struct device *dev,
2626
gpio_port_value_t *value);
2727

28-
int ads114s0x_gpio_port_set_masked_raw(const struct device *dev,
28+
int ads1x4s0x_gpio_port_set_masked_raw(const struct device *dev,
2929
gpio_port_pins_t mask,
3030
gpio_port_value_t value);
3131

32-
int ads114s0x_gpio_port_toggle_bits(const struct device *dev,
32+
int ads1x4s0x_gpio_port_toggle_bits(const struct device *dev,
3333
gpio_port_pins_t pins);
3434

35-
#endif /* ZEPHYR_INCLUDE_DRIVERS_ADC_ADS114S0X_H_ */
35+
#endif /* ZEPHYR_INCLUDE_DRIVERS_ADC_ADS1X4S0X_H_ */

include/zephyr/dt-bindings/adc/ads1x4s0x_adc.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADS114S0X_ADC_H_
8-
#define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADS114S0X_ADC_H_
7+
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADS1X4S0X_ADC_H_
8+
#define ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADS1X4S0X_ADC_H_
99

1010
/*
1111
* These are the available data rates described as samples per second. They
1212
* can be used with the time unit ticks for the acquisition time.
1313
*/
14-
#define ADS114S0X_CONFIG_DR_2_5 0
15-
#define ADS114S0X_CONFIG_DR_5 1
16-
#define ADS114S0X_CONFIG_DR_10 2
17-
#define ADS114S0X_CONFIG_DR_16_6 3
18-
#define ADS114S0X_CONFIG_DR_20 4
19-
#define ADS114S0X_CONFIG_DR_50 5
20-
#define ADS114S0X_CONFIG_DR_60 6
21-
#define ADS114S0X_CONFIG_DR_100 7
22-
#define ADS114S0X_CONFIG_DR_200 8
23-
#define ADS114S0X_CONFIG_DR_400 9
24-
#define ADS114S0X_CONFIG_DR_800 10
25-
#define ADS114S0X_CONFIG_DR_1000 11
26-
#define ADS114S0X_CONFIG_DR_2000 12
27-
#define ADS114S0X_CONFIG_DR_4000 13
14+
#define ADS1X4S0X_CONFIG_DR_2_5 0
15+
#define ADS1X4S0X_CONFIG_DR_5 1
16+
#define ADS1X4S0X_CONFIG_DR_10 2
17+
#define ADS1X4S0X_CONFIG_DR_16_6 3
18+
#define ADS1X4S0X_CONFIG_DR_20 4
19+
#define ADS1X4S0X_CONFIG_DR_50 5
20+
#define ADS1X4S0X_CONFIG_DR_60 6
21+
#define ADS1X4S0X_CONFIG_DR_100 7
22+
#define ADS1X4S0X_CONFIG_DR_200 8
23+
#define ADS1X4S0X_CONFIG_DR_400 9
24+
#define ADS1X4S0X_CONFIG_DR_800 10
25+
#define ADS1X4S0X_CONFIG_DR_1000 11
26+
#define ADS1X4S0X_CONFIG_DR_2000 12
27+
#define ADS1X4S0X_CONFIG_DR_4000 13
2828

29-
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADS114S0X_ADC_H_ */
29+
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_ADC_ADS1X4S0X_ADC_H_ */

0 commit comments

Comments
 (0)