Skip to content

Commit 9fa35bc

Browse files
asemjonovsMaureenHelm
authored andcommitted
adc: Add TI ADS7052 SPI driver
Add driver for TI ADS7052. Signed-off-by: Al Semjonovs <asemjonovs@google.com>
1 parent 336803e commit 9fa35bc

File tree

9 files changed

+411
-3
lines changed

9 files changed

+411
-3
lines changed

boards/arm/tdk_robokit1/tdk_robokit1-common.dtsi

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include <zephyr/dt-bindings/adc/adc.h>
78
#include "tdk_robokit1-pinctrl.dtsi"
89

910
/ {
@@ -90,7 +91,8 @@
9091
pinctrl-names = "default";
9192
dmas = <&xdmac 0 DMA_PERID_SPI0_TX>, <&xdmac 1 DMA_PERID_SPI0_RX>;
9293
dma-names = "tx", "rx";
93-
cs-gpios =<&pioa 31 GPIO_ACTIVE_LOW>;
94+
cs-gpios =<&pioa 31 GPIO_ACTIVE_LOW>,
95+
<&pioc 31 GPIO_ACTIVE_LOW>;
9496
status = "okay";
9597

9698
icm42688: icm42688p@0 {
@@ -103,6 +105,22 @@
103105
gyro-hz = <32000>;
104106
gyro-fs = <2000>;
105107
};
108+
spi_adc: adc@1 {
109+
compatible = "ti,ads7052";
110+
reg = <1>;
111+
#io-channel-cells = <1>;
112+
#address-cells = <1>;
113+
#size-cells = <0>;
114+
spi-max-frequency = <12000000>;
115+
channel@0 {
116+
reg = <0>;
117+
zephyr,gain = "ADC_GAIN_1";
118+
zephyr,reference = "ADC_REF_VDD_1";
119+
zephyr,vref-mv = <3300>;
120+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
121+
zephyr,resolution = <14>;
122+
};
123+
};
106124
};
107125

108126
&spi1 {

drivers/adc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ zephyr_library_sources_ifdef(CONFIG_ADC_TEST adc_test.c)
2828
zephyr_library_sources_ifdef(CONFIG_ADC_ADS1X1X adc_ads1x1x.c)
2929
zephyr_library_sources_ifdef(CONFIG_ADC_GD32 adc_gd32.c)
3030
zephyr_library_sources_ifdef(CONFIG_ADC_ADS1119 adc_ads1119.c)
31+
zephyr_library_sources_ifdef(CONFIG_ADC_ADS7052 adc_ads7052.c)
3132
zephyr_library_sources_ifdef(CONFIG_ADC_RPI_PICO adc_rpi_pico.c)
3233
zephyr_library_sources_ifdef(CONFIG_ADC_XMC4XXX adc_xmc4xxx.c)
3334
zephyr_library_sources_ifdef(CONFIG_ADC_ESP32 adc_esp32.c)

drivers/adc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ source "drivers/adc/Kconfig.gd32"
8484

8585
source "drivers/adc/Kconfig.ads1119"
8686

87+
source "drivers/adc/Kconfig.ads7052"
88+
8789
source "drivers/adc/Kconfig.rpi_pico"
8890

8991
source "drivers/adc/Kconfig.xmc4xxx"

drivers/adc/Kconfig.ads7052

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright (c) 2023 Google LLC
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
config ADC_ADS7052
6+
bool "Texas instruments ADS7052 SPI"
7+
default y
8+
depends on DT_HAS_TI_ADS7052_ENABLED
9+
select SPI
10+
select ADC_CONFIGURABLE_INPUTS
11+
help
12+
Enable the driver implementation for the ADS7052
13+
14+
if ADC_ADS7052
15+
16+
config ADC_ADS7052_INIT_PRIORITY
17+
int "ADS7052 init priority"
18+
default 80
19+
help
20+
ADS7052 device initialization priority must come
21+
after SPI initialization
22+
23+
config ADC_ADS7052_ACQUISITION_THREAD_STACK_SIZE
24+
int "Stack size for the ADC data acquisition thread"
25+
default 512
26+
help
27+
Size of the stack used for the internal data acquisition
28+
thread.
29+
30+
config ADC_ADS7052_ACQUISITION_THREAD_PRIO
31+
int "Priority for the ADC data acquisition thread"
32+
default 0
33+
help
34+
Priority level for the internal ADC data acquisition thread.
35+
36+
endif # ADC_ADS7052

0 commit comments

Comments
 (0)