mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
imxrt: ADC driver
Based on LPC17xx_40xx and STM32 drivers.
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
6696d72494
commit
d67bc0c3c8
@@ -163,6 +163,10 @@ config IMXRT_LPSPI
|
||||
bool
|
||||
default n
|
||||
|
||||
config IMXRT_ADC
|
||||
bool
|
||||
default n
|
||||
|
||||
config IMXRT_ENC
|
||||
bool
|
||||
default n
|
||||
@@ -518,6 +522,20 @@ menuconfig IMXRT_LPSPI4
|
||||
|
||||
endmenu # LPSPI Peripherals
|
||||
|
||||
menu "ADC Peripherals"
|
||||
|
||||
menuconfig IMXRT_ADC1
|
||||
bool "ADC1"
|
||||
default n
|
||||
select IMXRT_ADC
|
||||
|
||||
menuconfig IMXRT_ADC2
|
||||
bool "ADC2"
|
||||
default n
|
||||
select IMXRT_ADC
|
||||
|
||||
endmenu
|
||||
|
||||
config IMXRT_SEMC
|
||||
bool "Smart External Memory Controller (SEMC)"
|
||||
default n
|
||||
|
||||
@@ -167,3 +167,7 @@ endif
|
||||
ifeq ($(CONFIG_IMXRT_USBDEV),y)
|
||||
CHIP_CSRCS += imxrt_usbdev.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_IMXRT_ADC),y)
|
||||
CHIP_CSRCS += imxrt_adc.c
|
||||
endif
|
||||
|
||||
@@ -194,10 +194,10 @@
|
||||
#define ADC_CFG_ADSTS_SHIFT (8) /* Bits: 8-9 Defines the sample time duration. */
|
||||
#define ADC_CFG_ADSTS_MASK (3 << ADC_CFG_ADSTS_SHIFT)
|
||||
# define ADC_CFG_ADSTS(n) ((uint32_t)(n) << ADC_CFG_ADSTS_SHIFT)
|
||||
# define ADC_CFG_ADSTS_2_12 (0 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 2 if ADLSMP=0b, 12 if ADLSMP=1b */
|
||||
# define ADC_CFG_ADSTS_4_16 (1 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 4 if ADLSMP=0b, 16 if ADLSMP=1b */
|
||||
# define ADC_CFG_ADSTS_6_20 (2 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 6 if ADLSMP=0b, 20 if ADLSMP=1b */
|
||||
# define ADC_CFG_ADSTS_8_24 (3 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 8 if ADLSMP=0b, 24 if ADLSMP=1b */
|
||||
# define ADC_CFG_ADSTS_3_13 (0 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 3 if ADLSMP=0b, 13 if ADLSMP=1b */
|
||||
# define ADC_CFG_ADSTS_5_17 (1 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 5 if ADLSMP=0b, 17 if ADLSMP=1b */
|
||||
# define ADC_CFG_ADSTS_7_21 (2 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 7 if ADLSMP=0b, 21 if ADLSMP=1b */
|
||||
# define ADC_CFG_ADSTS_9_25 (3 << ADC_CFG_ADSTS_SHIFT) /* Sample period (ADC clocks) = 9 if ADLSMP=0b, 25 if ADLSMP=1b */
|
||||
#define ADC_CFG_ADHSC (1 << 10) /* Bit: 10 High Speed Configuration*/
|
||||
#define ADC_CFG_REFSEL_SHIFT (11) /* Bits: 11-12 Voltage Reference Selection */
|
||||
#define ADC_CFG_REFSEL_MASK (3 << ADC_CFG_REFSEL_SHIFT)
|
||||
|
||||
@@ -181,4 +181,6 @@
|
||||
IOMUX_SPEED_LOW )
|
||||
#define IOMUX_USBOTG_OC_DEFAULT (IOMUX_PULL_UP_100K)
|
||||
|
||||
#define IOMUX_ADC_DEFAULT (0)
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_IMXRT_HARDWARE_IMXRT_IOMUXC_H */
|
||||
|
||||
@@ -1081,4 +1081,38 @@
|
||||
#define GPIO_XBAR1_INOUT19_4 (GPIO_PERIPH | GPIO_ALT6 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B0_07_INDEX))
|
||||
#define GPIO_XBAR1_XBAR_IN02_1 (GPIO_PERIPH | GPIO_ALT3 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_EMC_00_INDEX))
|
||||
|
||||
/* ADC */
|
||||
#define GPIO_ADC1_CH0 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_11_INDEX))
|
||||
#define GPIO_ADC1_CH1 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B0_12_INDEX))
|
||||
#define GPIO_ADC1_CH2 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B0_13_INDEX))
|
||||
#define GPIO_ADC1_CH3 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B0_14_INDEX))
|
||||
#define GPIO_ADC1_CH4 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B0_15_INDEX))
|
||||
#define GPIO_ADC1_CH5 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_00_INDEX))
|
||||
#define GPIO_ADC1_CH6 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_01_INDEX))
|
||||
#define GPIO_ADC1_CH7 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_02_INDEX))
|
||||
#define GPIO_ADC1_CH8 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_03_INDEX))
|
||||
#define GPIO_ADC1_CH9 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_04_INDEX))
|
||||
#define GPIO_ADC1_CH10 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_05_INDEX))
|
||||
#define GPIO_ADC1_CH11 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_06_INDEX))
|
||||
#define GPIO_ADC1_CH12 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_07_INDEX))
|
||||
#define GPIO_ADC1_CH13 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_08_INDEX))
|
||||
#define GPIO_ADC1_CH14 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_09_INDEX))
|
||||
#define GPIO_ADC1_CH15 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_10_INDEX))
|
||||
#define GPIO_ADC2_CH0 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_11_INDEX))
|
||||
#define GPIO_ADC2_CH1 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_12_INDEX))
|
||||
#define GPIO_ADC2_CH2 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_13_INDEX))
|
||||
#define GPIO_ADC2_CH3 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_14_INDEX))
|
||||
#define GPIO_ADC2_CH4 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_15_INDEX))
|
||||
#define GPIO_ADC2_CH5 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_00_INDEX))
|
||||
#define GPIO_ADC2_CH6 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_01_INDEX))
|
||||
#define GPIO_ADC2_CH7 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_02_INDEX))
|
||||
#define GPIO_ADC2_CH8 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_03_INDEX))
|
||||
#define GPIO_ADC2_CH9 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_04_INDEX))
|
||||
#define GPIO_ADC2_CH10 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_05_INDEX))
|
||||
#define GPIO_ADC2_CH11 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_06_INDEX))
|
||||
#define GPIO_ADC2_CH12 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_07_INDEX))
|
||||
#define GPIO_ADC2_CH13 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_08_INDEX))
|
||||
#define GPIO_ADC2_CH14 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_09_INDEX))
|
||||
#define GPIO_ADC2_CH15 (GPIO_PERIPH | GPIO_ALT5 | GPIO_PADMUX(IMXRT_PADMUX_GPIO_AD_B1_10_INDEX))
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_IMXRT_HARDWARE_IMXRT106X_PINMUX_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/lpc17xx_40xx/lpc17_40_adc.h
|
||||
*
|
||||
* Copyright (C) 2020 Actia Nordic AB. All rights reserved.
|
||||
* Author: Thomas Axelsson <thomas.axelsson@actia.se>
|
||||
*
|
||||
* Based on arch/arm/src/lpc_17xx_40xx/imxrt_adc.h
|
||||
*
|
||||
* Copyright (C) 2010, 2012, 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_IMXRT_ADC_H
|
||||
#define __ARCH_ARM_SRC_IMXRT_ADC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: imxrt_adcinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the adc
|
||||
*
|
||||
* Input Parameters:
|
||||
* intf - ADC number (1 or 2)
|
||||
* chanlist - The list of channels
|
||||
* nchannels - Number of channels
|
||||
*
|
||||
* Returned Value:
|
||||
* Valid can device structure reference on success; a NULL on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_IMXRT_ADC
|
||||
FAR struct adc_dev_s *imxrt_adcinitialize(int intf,
|
||||
FAR const uint8_t *chanlist,
|
||||
int nchannels);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_IMXRT_ADC_H */
|
||||
@@ -73,6 +73,10 @@ ifeq ($(CONFIG_DEV_GPIO),y)
|
||||
CSRCS += imxrt_gpio.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_IMXRT_ADC),y)
|
||||
CSRCS += imxrt_adc.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_INPUT_FT5X06),y)
|
||||
CSRCS += imxrt_ft5x06.c
|
||||
endif
|
||||
|
||||
@@ -275,6 +275,18 @@ void imxrt_autoled_initialize(void);
|
||||
int imxrt_gpio_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: imxrt_adc_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC drivers
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_IMXRT_ADC
|
||||
int imxrt_adc_initialize(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: imxrt_ft5x06_register
|
||||
*
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/imxrt/imxrt1060-evk/src/imxrt_adc.c
|
||||
*
|
||||
* Copyright (C) 2020 Actia Nordic AB. All rights reserved.
|
||||
* Author: Thomas Axelsson <thomas.axelsson@actia.se>
|
||||
*
|
||||
* Based on boards/arm/lpc17xx_40xx/mbed/src/lpc17_40_adc.c
|
||||
*
|
||||
* Based on boards/zkit-arm-176/src/up-adc
|
||||
*
|
||||
* Copyright (C) 2013 Zilogic Systems. All rights reserved.
|
||||
* Author: Kannan <code@nuttx.org>
|
||||
*
|
||||
* Based on boards/lpc1720g-eval/src/lpc17_40_adc.c
|
||||
*
|
||||
* Copyright (C) 2012, 2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/analog/adc.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "chip.h"
|
||||
#include "arm_arch.h"
|
||||
|
||||
#include "imxrt_adc.h"
|
||||
|
||||
#ifdef CONFIG_IMXRT_ADC
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#define ADC1_NCHANNELS 3
|
||||
#define ADC2_NCHANNELS 3
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const uint8_t g_chanlist1[ADC1_NCHANNELS] =
|
||||
{
|
||||
/* Arduino Interface pins A0 to A2 */
|
||||
|
||||
15,
|
||||
0,
|
||||
9,
|
||||
};
|
||||
|
||||
static const uint8_t g_chanlist2[ADC2_NCHANNELS] =
|
||||
{
|
||||
/* Arduino Interface pins A3 to A5 */
|
||||
|
||||
10,
|
||||
6,
|
||||
5
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: imxrt_adc_setup
|
||||
*
|
||||
* Description:
|
||||
* Initialize ADC and register the ADC driver.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int imxrt_adc_initialize(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
struct adc_dev_s *adc;
|
||||
int ret;
|
||||
|
||||
/* Check if we have already initialized */
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
/* Call imxrt_adcinitialize() to get an instance of the ADC interface */
|
||||
|
||||
#ifdef CONFIG_IMXRT_ADC1
|
||||
adc = imxrt_adcinitialize(1, g_chanlist1, ADC1_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface for ADC1\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the ADC driver at "/dev/adc1" */
|
||||
|
||||
ret = adc_register("/dev/adc1", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register adc1 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IMXRT_ADC2
|
||||
adc = imxrt_adcinitialize(2, g_chanlist2, ADC2_NCHANNELS);
|
||||
if (adc == NULL)
|
||||
{
|
||||
aerr("ERROR: Failed to get ADC interface for ADC2\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Register the ADC driver at "/dev/adc2" */
|
||||
|
||||
ret = adc_register("/dev/adc2", adc);
|
||||
if (ret < 0)
|
||||
{
|
||||
aerr("ERROR: adc_register adc2 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now we are initialized */
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ADC */
|
||||
@@ -223,6 +223,16 @@ int imxrt_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_IMXRT_ADC
|
||||
/* Initialize ADC and register the ADC driver. */
|
||||
|
||||
ret = imxrt_adc_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: imxrt_adc_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INPUT_FT5X06
|
||||
/* Initialize the FT5X06 touchscreen driver */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user