summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/arm/src/lpc17xx/lpc17_adc.h')
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_adc.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h b/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h
index 5a1bef14a..ecca04446 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h
@@ -46,6 +46,20 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+/* Configuration ************************************************************/
+/* If CONFIG_ADC_CHANLIST is enabled, then the platform specific code must do
+ * two things: (1) define CONFIG_ADC_NCHANNELS in the configuration file and
+ * (2) provide an array g_adc_chanlist[] with the channel numbers matching
+ * the ADC0_MASK within the board-specific library.
+ */
+
+#ifdef CONFIG_ADC_CHANLIST
+# if !defined(CONFIG_ADC_NCHANNELS)
+# error "CONFIG_ADC_CHANLIST must defined in this configuration"
+# elif CONFIG_ADC_NCHANNELS < 1
+# error "The value of CONFIG_ADC_NCHANNELS is invalid"
+# endif
+#endif
/****************************************************************************
* Public Types
@@ -55,12 +69,33 @@
* Public Data
****************************************************************************/
-#ifndef __ASSEMBLY__
-#ifdef __cplusplus
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
extern "C"
{
+#else
+#define EXTERN extern
#endif
+
+/* The errata that states: "A/D Global Data register should not be used with
+ * burst mode or hardware triggering". The configuration option
+ * CONFIG_ADC_CHANLIST is a workaround for this errata. If this option is
+ * selected, then the ADC driver will grab from the individual channel
+ * registers rather than from the global data register as this is the stated
+ * workaround in the errata.
+ *
+ * If this option is enabled, then the platform specific code must do two
+ * things: (1) define CONFIG_ADC_NCHANNELS in the configuration file and
+ * (2) provide an array g_adc_chanlist[] with the channel numbers matching
+ * the ADC0_MASK within the board-specific library.
+ */
+
+#ifdef CONFIG_ADC_CHANLIST
+EXTERN uint8_t g_adc_chanlist[CONFIG_ADC_NCHANNELS];
+#endiff
+
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -80,6 +115,7 @@ extern "C"
FAR struct adc_dev_s *lpc17_adcinitialize(void);
#endif
+#undef EXTERN
#ifdef __cplusplus
}
#endif