diff --git a/ChangeLog b/ChangeLog index 7083c3f5f3c..006db8725bb 100755 --- a/ChangeLog +++ b/ChangeLog @@ -11407,3 +11407,10 @@ errno value. Noted by Freddie Chopin. 7.15 2016-xx-xx Gregory Nutt + + * drivers/analog/adc1242.c and include/nuttx/analog/adc1242.h: Driver + for the 24-Bit Differential Input ADC ADS1242 that communicates via + SPI with a MCU. Reading the ADC conversion result as well as configuring + the ADC, setting the input channel, etc. is implemented via ioctl calls. + However, it does not yet implement the standard ADC interface. From + Alexander Entinger (2014-01-29). diff --git a/drivers/analog/Kconfig b/drivers/analog/Kconfig index 3245cc7c408..bc054804224 100644 --- a/drivers/analog/Kconfig +++ b/drivers/analog/Kconfig @@ -30,6 +30,18 @@ config ADC_NO_STARTUP_CONV ---help--- Do not start conversion when opening ADC device. +config ADC_ADS1242 + bool "TI ADS1242 support" + default n + select SPI + ---help--- + Enable driver support for the ADS1242 24-Bit SPI powered ADC. + + This driver supports reading the ADC conversion result as well as + configuring the ADC, setting the input channel, etc. is implemented + via ioctl calls. However, it does not yet implement the standard ADC + interface. + config ADC_ADS125X bool "TI ADS1255/ADS1256 support" default n @@ -43,13 +55,6 @@ config ADS1255_FREQUENCY endif # ADC_ADS125X -config ADC_ADS1242 - bool "ADS1242" - default n - select SPI - ---help--- - Enable driver support for the ADS1242 24-Bit SPI powered ADC. - config ADC_PGA11X bool "TI PGA112/3/6/7 support" default n diff --git a/drivers/analog/Make.defs b/drivers/analog/Make.defs index 89cc5bd3f78..2d12a1695d1 100644 --- a/drivers/analog/Make.defs +++ b/drivers/analog/Make.defs @@ -66,6 +66,10 @@ endif # Include ADC device drivers +ifeq ($(CONFIG_ADC_ADS1242),y) + CSRCS += ads1242.c +endif + ifeq ($(CONFIG_ADC_ADS125X),y) CSRCS += ads1255.c endif diff --git a/drivers/analog/ads1242.c b/drivers/analog/ads1242.c index 6c80df4d2a2..93b82942c2c 100644 --- a/drivers/analog/ads1242.c +++ b/drivers/analog/ads1242.c @@ -95,7 +95,7 @@ static bool ads1242_is_data_ready(FAR struct ads1242_dev_s *dev); #if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) static void ads1242_print_regs(FAR struct ads1242_dev_s *dev, char const *msg); -#endif / defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) */ +#endif /* CONFIG_DEBUG && CONFIG_DEBUG_VERBOSE */ /* Character driver methods */ @@ -335,11 +335,9 @@ static void ads1242_set_negative_input(FAR struct ads1242_dev_s *dev, static bool ads1242_is_data_ready(FAR struct ads1242_dev_s *dev) { uint8_t acr_reg_value = 0xFF; - bool const is_data_ready; ads1242_read_reg(dev, ADS1242_REG_ACR, &acr_reg_value); - is_data_ready = (acr_reg_value & ADS1242_REG_ACR_BIT_nDRDY) == 0; - return is_data_ready; + return (acr_reg_value & ADS1242_REG_ACR_BIT_nDRDY) == 0; } /**************************************************************************** @@ -363,7 +361,7 @@ static void ads1242_print_regs(FAR struct ads1242_dev_s *dev, char const *msg) dbg("MUX %02X\n", mux_reg_value); dbg("ACR %02X\n", acr_reg_value); } -#endif /* defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) */ +#endif /* CONFIG_DEBUG && CONFIG_DEBUG_VERBOSE */ /**************************************************************************** * Name: ads1242_open @@ -419,9 +417,6 @@ static int ads1242_close(FAR struct file *filep) static ssize_t ads1242_read(FAR struct file *filep, FAR char *buffer, size_t buflen) { - FAR struct inode *inode = filep->f_inode; - FAR struct ads1242_dev_s *priv = inode->i_private; - return -ENOSYS; } @@ -432,9 +427,6 @@ static ssize_t ads1242_read(FAR struct file *filep, static ssize_t ads1242_write(FAR struct file *filep, FAR const char *buffer, size_t buflen) { - FAR struct inode *inode = filep->f_inode; - FAR struct ads1242_dev_s *priv = inode->i_private; - return -ENOSYS; }