diff --git a/boards/cc2538dk/Makefile.features b/boards/cc2538dk/Makefile.features index c2f4c92a7961e634345da8bc59907546e2f1df06..e7427063099920758792e7fa809c88d7dd600d2a 100644 --- a/boards/cc2538dk/Makefile.features +++ b/boards/cc2538dk/Makefile.features @@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart +FEATURES_PROVIDED += periph_adc # Various other features (if any) FEATURES_PROVIDED += cpp diff --git a/boards/cc2538dk/include/periph_conf.h b/boards/cc2538dk/include/periph_conf.h index 575a8a653ffa9557fbd5c71521ff273fef78d0a2..601dc7e0a32dafc329758b83ecb2225a6c99af94 100644 --- a/boards/cc2538dk/include/periph_conf.h +++ b/boards/cc2538dk/include/periph_conf.h @@ -143,6 +143,19 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0])) /** @} */ +/** + * @name ADC configuration + * @{ + */ +#define SOC_ADC_ADCCON_REF SOC_ADC_ADCCON_REF_AVDD5 + +static const adc_conf_t adc_config[] = { + GPIO_PIN(0, 6), /**< GPIO_PA6 = ADC_ALS_PIN */ +}; + +#define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0])) +/** @} */ + /** * @name Radio peripheral configuration * @{ diff --git a/boards/openmote-cc2538/Makefile.features b/boards/openmote-cc2538/Makefile.features index 819901ddc85175a1a5edc80a62d2cd05fcebb2ec..923b5130eba27050752641afebf96f1842a61eb9 100644 --- a/boards/openmote-cc2538/Makefile.features +++ b/boards/openmote-cc2538/Makefile.features @@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart +FEATURES_PROVIDED += periph_adc # Various other features (if any) FEATURES_PROVIDED += cpp diff --git a/boards/openmote-cc2538/include/periph_conf.h b/boards/openmote-cc2538/include/periph_conf.h index aadf637d9d6f5d3661a21f137d3fd71d98f01c4f..46bb7997feb26a85d5485dd04c9995daf98bcbae 100644 --- a/boards/openmote-cc2538/include/periph_conf.h +++ b/boards/openmote-cc2538/include/periph_conf.h @@ -14,6 +14,7 @@ * @brief Peripheral MCU configuration for the OpenMote-cc2538 board * * @author Hauke Petersen <hauke.petersen@fu-berlin.de> + * @author Sebastian Meiling <s@mlng.net> */ #ifndef PERIPH_CONF_H @@ -64,6 +65,23 @@ static const timer_conf_t timer_config[] = { #define TIMER_IRQ_PRIO 1 /** @} */ +/** + * @name ADC configuration + * @{ + */ +#define SOC_ADC_ADCCON_REF SOC_ADC_ADCCON_REF_AVDD5 + +static const adc_conf_t adc_config[] = { + GPIO_PIN(0, 2), /**< GPIO_PA2 = AD4_PIN */ + GPIO_PIN(0, 3), /**< GPIO_PA3 = CTS_DI07_PIN */ + GPIO_PIN(0, 4), /**< GPIO_PA4 = AD5_PIN */ + GPIO_PIN(0, 5), /**< GPIO_PA5 = AD6_PIN */ + GPIO_PIN(0, 6), /**< GPIO_PA6 = ON_SLEEP_PIN */ +}; + +#define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0])) +/** @} */ + /** * @name UART configuration * @{ diff --git a/boards/remote-pa/Makefile.features b/boards/remote-pa/Makefile.features index 819901ddc85175a1a5edc80a62d2cd05fcebb2ec..923b5130eba27050752641afebf96f1842a61eb9 100644 --- a/boards/remote-pa/Makefile.features +++ b/boards/remote-pa/Makefile.features @@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart +FEATURES_PROVIDED += periph_adc # Various other features (if any) FEATURES_PROVIDED += cpp diff --git a/boards/remote-pa/include/periph_conf.h b/boards/remote-pa/include/periph_conf.h index 4212494a77a3860eb7ae436f73e34b5974fb62fb..4fd66fb62daaadf830e87dda1a88db802bc48b91 100644 --- a/boards/remote-pa/include/periph_conf.h +++ b/boards/remote-pa/include/periph_conf.h @@ -16,6 +16,7 @@ * * @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Antonio Lignan <alinan@zolertia.com> + * @author Sebastian Meiling <s@mlng.net> */ #ifndef PERIPH_CONF_H @@ -106,6 +107,20 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0])) /** @} */ +/** + * @name ADC configuration + * @{ + */ +#define SOC_ADC_ADCCON_REF SOC_ADC_ADCCON_REF_AVDD5 + +static const adc_conf_t adc_config[] = { + GPIO_PIN(0, 6), /**< GPIO_PA6 = ADC2_PIN */ + GPIO_PIN(0, 7), /**< GPIO_PA7 = ADC3_PIN */ +}; + +#define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0])) +/** @} */ + #ifdef __cplusplus } /* end extern "C" */ #endif diff --git a/boards/remote-reva/Makefile.features b/boards/remote-reva/Makefile.features index 819901ddc85175a1a5edc80a62d2cd05fcebb2ec..923b5130eba27050752641afebf96f1842a61eb9 100644 --- a/boards/remote-reva/Makefile.features +++ b/boards/remote-reva/Makefile.features @@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart +FEATURES_PROVIDED += periph_adc # Various other features (if any) FEATURES_PROVIDED += cpp diff --git a/boards/remote-reva/README.md b/boards/remote-reva/README.md index fef16a76eae4ef0b8441458b538c6d6befa6ce5c..6e5efae045ff1c845298261d87b1b795132aca1d 100644 --- a/boards/remote-reva/README.md +++ b/boards/remote-reva/README.md @@ -27,6 +27,7 @@ In terms of hardware support, the following drivers have been implemented: * I2C/SPI library * LEDs * Buttons + * ADC * RF switch to programatically drive either 2.4GHz or sub-1GHz to a single RP-SMA * RF 2.4GHz built-in in CC2538 @@ -35,7 +36,6 @@ And under work or pending at cc2538 base cpu: * Built-in core temperature and battery sensor. * CC1200 sub-1GHz radio interface. * Micro-SD external storage. - * ADC * USB (in CDC-ACM). * uDMA Controller. diff --git a/boards/remote-reva/include/periph_conf.h b/boards/remote-reva/include/periph_conf.h index 6b7350d41fe7477df5e6e9ae6127a69ef4704bde..2d236f3fc496908d8b5ae9daab6de3ec3132706d 100644 --- a/boards/remote-reva/include/periph_conf.h +++ b/boards/remote-reva/include/periph_conf.h @@ -16,6 +16,7 @@ * * @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Antonio Lignan <alinan@zolertia.com> + * @author Sebastian Meiling <s@mlng.net> */ #ifndef PERIPH_CONF_H @@ -107,6 +108,24 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0])) /** @} */ +/** + * @name ADC configuration + * @{ + */ +#define SOC_ADC_ADCCON_REF SOC_ADC_ADCCON_REF_AVDD5 + +static const adc_conf_t adc_config[] = { + GPIO_PIN(0, 5), /**< GPIO_PA5 = ADC1_PIN */ + GPIO_PIN(0, 4), /**< GPIO_PA4 = ADC2_PIN */ + /* voltage divider with 5/3 relationship to allow 5V sensors */ + GPIO_PIN(0, 2), /**< GPIO_PA2 = ADC3_PIN */ +}; + +#define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0])) +/** @} */ + + + #ifdef __cplusplus } /* end extern "C" */ #endif diff --git a/boards/remote-revb/Makefile.features b/boards/remote-revb/Makefile.features index 819901ddc85175a1a5edc80a62d2cd05fcebb2ec..923b5130eba27050752641afebf96f1842a61eb9 100644 --- a/boards/remote-revb/Makefile.features +++ b/boards/remote-revb/Makefile.features @@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart +FEATURES_PROVIDED += periph_adc # Various other features (if any) FEATURES_PROVIDED += cpp diff --git a/boards/remote-revb/include/periph_conf.h b/boards/remote-revb/include/periph_conf.h index 930cccfa92ca70c78a77266c36e5e47a7bcdae01..0bca28c4112db920aa54dbeb97eec23a5ac3fa3d 100644 --- a/boards/remote-revb/include/periph_conf.h +++ b/boards/remote-revb/include/periph_conf.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2014 Freie Universität Berlin * Copyright (C) 2015 Zolertia SL + * 2017 HAW Hamburg * * This file is subject to the terms and conditions of the GNU Lesser General * Public License v2.1. See the file LICENSE in the top level directory for more @@ -15,7 +16,8 @@ * @brief Peripheral MCU configuration for the RE-Mote board revision B * * @author Hauke Petersen <hauke.petersen@fu-berlin.de> - * Antonio Lignan <alinan@zolertia.com> + * @author Antonio Lignan <alinan@zolertia.com> + * @author Sebastian Meiling <s@mlng.net> */ #ifndef PERIPH_CONF_H @@ -105,10 +107,25 @@ static const spi_conf_t spi_config[] = { .cs_pin = GPIO_PA7 } }; - #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0])) /** @} */ +/** + * @name ADC configuration + * @{ + */ +#define SOC_ADC_ADCCON_REF SOC_ADC_ADCCON_REF_AVDD5 + +static const adc_conf_t adc_config[] = { + GPIO_PIN(0, 5), /**< GPIO_PA5 = ADC1_PIN */ + GPIO_PIN(0, 4), /**< GPIO_PA4 = ADC2_PIN */ + /* voltage divider with 5/3 relationship to allow 5V sensors */ + GPIO_PIN(0, 2), /**< GPIO_PA2 = ADC3_PIN */ +}; + +#define ADC_NUMOF (sizeof(adc_config) / sizeof(adc_config[0])) +/** @} */ + #ifdef __cplusplus } /* end extern "C" */ #endif