uc-sdk
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lpc17xx_adc.h File Reference

Contains all macro definitions and function prototypes support for ADC firmware library on LPC17xx. More...

#include "LPC17xx.h"
#include "lpc_types.h"

Go to the source code of this file.

Macros

#define ADC_CR_CH_SEL(n)   ((1UL << n))
 
#define ADC_CR_CLKDIV(n)   ((n<<8))
 
#define ADC_CR_BURST   ((1UL<<16))
 
#define ADC_CR_PDN   ((1UL<<21))
 
#define ADC_CR_START_MASK   ((7UL<<24))
 
#define ADC_CR_START_MODE_SEL(SEL)   ((SEL<<24))
 
#define ADC_CR_START_NOW   ((1UL<<24))
 
#define ADC_CR_START_EINT0   ((2UL<<24))
 
#define ADC_CR_START_CAP01   ((3UL<<24))
 
#define ADC_CR_START_MAT01   ((4UL<<24))
 
#define ADC_CR_START_MAT03   ((5UL<<24))
 
#define ADC_CR_START_MAT10   ((6UL<<24))
 
#define ADC_CR_START_MAT11   ((7UL<<24))
 
#define ADC_CR_EDGE   ((1UL<<27))
 
#define ADC_GDR_RESULT(n)   (((n>>4)&0xFFF))
 
#define ADC_GDR_CH(n)   (((n>>24)&0x7))
 
#define ADC_GDR_OVERRUN_FLAG   ((1UL<<30))
 
#define ADC_GDR_DONE_FLAG   ((1UL<<31))
 
#define ADC_GDR_CH_MASK   ((7UL<<24))
 
#define ADC_INTEN_CH(n)   ((1UL<<n))
 
#define ADC_INTEN_GLOBAL   ((1UL<<8))
 
#define ADC_DR_RESULT(n)   (((n>>4)&0xFFF))
 
#define ADC_DR_OVERRUN_FLAG   ((1UL<<30))
 
#define ADC_DR_DONE_FLAG   ((1UL<<31))
 
#define ADC_STAT_CH_DONE_FLAG(n)   ((n&0xFF))
 
#define ADC_STAT_CH_OVERRUN_FLAG(n)   (((n>>8)&0xFF))
 
#define ADC_STAT_INT_FLAG   ((1UL<<16))
 
#define ADC_ADCOFFS(n)   (((n&0xF)<<4))
 
#define ADC_TRIM(n)   (((n&0xF)<<8))
 
#define PARAM_ADCx(n)   (((uint32_t *)n)==((uint32_t *)LPC_ADC))
 
#define PARAM_ADC_START_ON_EDGE_OPT(OPT)   ((OPT == ADC_START_ON_RISING)||(OPT == ADC_START_ON_FALLING))
 
#define PARAM_ADC_DATA_STATUS(OPT)   ((OPT== ADC_DATA_BURST)||(OPT== ADC_DATA_DONE))
 
#define PARAM_ADC_RATE(rate)   ((rate>0)&&(rate<=200000))
 
#define PARAM_ADC_CHANNEL_SELECTION(SEL)
 
#define PARAM_ADC_START_OPT(OPT)
 
#define PARAM_ADC_TYPE_INT_OPT(OPT)
 

Enumerations

enum  ADC_CHANNEL_SELECTION {
  ADC_CHANNEL_0 = 0, ADC_CHANNEL_1, ADC_CHANNEL_2, ADC_CHANNEL_3,
  ADC_CHANNEL_4, ADC_CHANNEL_5, ADC_CHANNEL_6, ADC_CHANNEL_7
}
 ADC enumeration. More...
 
enum  ADC_START_OPT {
  ADC_START_CONTINUOUS =0, ADC_START_NOW, ADC_START_ON_EINT0, ADC_START_ON_CAP01,
  ADC_START_ON_MAT01, ADC_START_ON_MAT03, ADC_START_ON_MAT10, ADC_START_ON_MAT11
}
 Type of start option. More...
 
enum  ADC_START_ON_EDGE_OPT { ADC_START_ON_RISING = 0, ADC_START_ON_FALLING }
 Type of edge when start conversion on the selected CAP/MAT signal. More...
 
enum  ADC_TYPE_INT_OPT {
  ADC_ADINTEN0 = 0, ADC_ADINTEN1, ADC_ADINTEN2, ADC_ADINTEN3,
  ADC_ADINTEN4, ADC_ADINTEN5, ADC_ADINTEN6, ADC_ADINTEN7,
  ADC_ADGINTEN
}
 
  • ADC type interrupt enum
More...
 
enum  ADC_DATA_STATUS { ADC_DATA_BURST = 0, ADC_DATA_DONE }
 ADC Data status. More...
 

Functions

void ADC_Init (LPC_ADC_TypeDef *ADCx, uint32_t rate)
 
void ADC_DeInit (LPC_ADC_TypeDef *ADCx)
 
void ADC_BurstCmd (LPC_ADC_TypeDef *ADCx, FunctionalState NewState)
 
void ADC_PowerdownCmd (LPC_ADC_TypeDef *ADCx, FunctionalState NewState)
 
void ADC_StartCmd (LPC_ADC_TypeDef *ADCx, uint8_t start_mode)
 
void ADC_ChannelCmd (LPC_ADC_TypeDef *ADCx, uint8_t Channel, FunctionalState NewState)
 
void ADC_EdgeStartConfig (LPC_ADC_TypeDef *ADCx, uint8_t EdgeOption)
 
void ADC_IntConfig (LPC_ADC_TypeDef *ADCx, ADC_TYPE_INT_OPT IntType, FunctionalState NewState)
 
uint16_t ADC_ChannelGetData (LPC_ADC_TypeDef *ADCx, uint8_t channel)
 
FlagStatus ADC_ChannelGetStatus (LPC_ADC_TypeDef *ADCx, uint8_t channel, uint32_t StatusType)
 
uint32_t ADC_GlobalGetData (LPC_ADC_TypeDef *ADCx)
 
FlagStatus ADC_GlobalGetStatus (LPC_ADC_TypeDef *ADCx, uint32_t StatusType)
 

Detailed Description

Contains all macro definitions and function prototypes support for ADC firmware library on LPC17xx.

Version
3.0
Date
18. June. 2010
Author
NXP MCU SW Application Team

Software that is described herein is for illustrative purposes only which provides customers with programming information regarding the products. This software is supplied "AS IS" without any warranties. NXP Semiconductors assumes no responsibility or liability for the use of the software, conveys no license or title under any patent, copyright, or mask work right to the product. NXP Semiconductors reserves the right to make changes in the software without notification. NXP Semiconductors also make no representation or warranty that such application will be suitable for the specified use without further testing or modification.

Definition in file lpc17xx_adc.h.