Skip to content

Commit bb9e88c

Browse files
drivers/analog/ads1115: Add support for the Texas Instruments ADS1115
This patch adds initial support for the Texas Instruments ADS1115 ADC. Please read the documentation for more details. Signed-off-by: Tony Lin <[email protected]>
1 parent bf73fbe commit bb9e88c

File tree

5 files changed

+1098
-0
lines changed

5 files changed

+1098
-0
lines changed

drivers/analog/Kconfig

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,109 @@ config ADC_MCP3008_DIFFERENTIAL
257257

258258
endif # ADC_MCP3008
259259

260+
config ADC_ADS1115
261+
bool "ADS1115 support"
262+
default n
263+
select I2C
264+
---help---
265+
Enable driver support for the Texas Instruments ADS1115 16-bit ADC.
266+
Currently support is experimental, especially the comparator and ALRT/RDY
267+
pin functions.
268+
269+
if ADC_ADS1115
270+
271+
config ADC_ADS1115_I2C_FREQUENCY
272+
int "ADS1115 I2C frequency"
273+
default 100000
274+
---help---
275+
ADS1115 I2C frequency.
276+
277+
config ADC_ADS1115_ADDR
278+
hex "ADS1115 I2C address"
279+
default 0x48
280+
---help---
281+
ADS1115 I2C address. Default is 0x48.
282+
283+
config ADC_ADS1115_CHANNEL
284+
int "ADS1115 channel"
285+
default 0
286+
range 0 7
287+
---help---
288+
Default ADS1115 channel/mux configuration.
289+
0-3 are the differential channels.
290+
4-7 are the single ended channels for A0 to A3
291+
See the datasheet or ads1115.h for more info.
292+
293+
config ADC_ADS1115_PGA
294+
int "ADS1115 PGA"
295+
default 2
296+
range 0 7
297+
---help---
298+
ADS1115 PGA configuration.
299+
0 is +/-6.144V, 1 is +/-4.096V, 2 is +/-2.048V, 3 is +/-1.024V,
300+
4 is +/-0.512V, 5 is +/-0.256V, 6 is +/-0.256V, 7 is +/-0.256V.
301+
302+
config ADC_ADS1115_CONTINOUS
303+
bool "ADS1115 continuous mode"
304+
default n
305+
---help---
306+
ADS1115 continuous mode. The ADS1115 will repeatedly take conversions.
307+
If changing channels in this mode, there is a chance of old data being
308+
read. To avoid this, use one shot mode or use the ALERT/RDY pin.
309+
310+
config ADC_ADS1115_DR
311+
int "ADS1115 data rate"
312+
default 4
313+
range 0 7
314+
---help---
315+
ADS1115 data rate.
316+
0 is 8sps, 1 is 16sps, 2 is 32sps, 3 is 64sps,
317+
4 is 128sps, 5 is 250sps, 6 is 475sps, 7 is 860sps.
318+
319+
config ADC_ADS1115_COMP_MODE
320+
bool "ADS1115 window comparator mode"
321+
default n
322+
---help---
323+
ADS1115 window comparator mode.
324+
325+
config ADC_ADS1115_COMP_POL
326+
bool "ADS1115 comparator polarity"
327+
default n
328+
---help---
329+
ADS1115 comparator polarity. n is active low, y is active high.
330+
331+
config ADC_ADS1115_COMP_LAT
332+
bool "ADS1115 comparator latching"
333+
default n
334+
---help---
335+
ADS1115 comparator latching. n is non-latching, y is latching.
336+
Note that this is cleared when reading from the conversion register.
337+
338+
config ADC_ADS1115_COMP_QUE
339+
int "ADS1115 comparator queue"
340+
default 3
341+
range 0 3
342+
---help---
343+
ADS1115 comparator queue. 0 is assert after 1 conversion, 1, is
344+
assert after 2 conversions, 2 is assert after 4 conversions, 3
345+
is disable comparator, and set ALERT/RDY to high-impedence.
346+
347+
config ADC_ADS1115_HI_THRESH
348+
int "ADS1115 high threshold"
349+
default 32767
350+
range 0 65536
351+
---help---
352+
ADS1115 high threshold.
353+
354+
config ADC_ADS1115_LO_THRESH
355+
int "ADS1115 low threshold"
356+
range 0 65536
357+
default 32768
358+
---help---
359+
ADS1115 low threshold.
360+
361+
endif # ADC_ADS1115
362+
260363
endif # ADC
261364

262365
config COMP

drivers/analog/Make.defs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ endif
113113
ifeq ($(CONFIG_ADC_MCP3008),y)
114114
CSRCS += mcp3008.c
115115
endif
116+
117+
ifeq ($(CONFIG_ADC_ADS1115),y)
118+
CSRCS += ads1115.c
119+
endif
116120
endif
117121

118122
ifeq ($(CONFIG_LMP92001),y)

0 commit comments

Comments
 (0)