![]() |
LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
|
Data Structures | |
struct | IP_ADC_001_Type |
10 or 12-bit ADC register block structure More... | |
Macros | |
#define | ADC_DR_RESULT(n) ((((n) >> 6) & 0x3FF)) |
ADC register support bitfields and mask. | |
#define | ADC_DR_DONE(n) (((n) >> 31)) |
#define | ADC_DR_OVERRUN(n) ((((n) >> 30) & (1UL))) |
#define | ADC_CR_CH_SEL(n) ((1UL << (n))) |
#define | ADC_CR_CLKDIV(n) ((((n) & 0xFF) << 8)) |
#define | ADC_CR_BURST ((1UL << 16)) |
#define | ADC_CR_BITACC(n) ((((n) & 0x7) << 17)) |
#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_CTOUT15 ((2UL << 24)) |
#define | ADC_CR_START_CTOUT8 ((3UL << 24)) |
#define | ADC_CR_START_ADCTRIG0 ((4UL << 24)) |
#define | ADC_CR_START_ADCTRIG1 ((5UL << 24)) |
#define | ADC_CR_START_MCOA2 ((6UL << 24)) |
#define | ADC_CR_EDGE ((1UL << 27)) |
Enumerations | |
enum | IP_ADC_Status { ADC_DR_DONE_STAT, ADC_DR_OVERRUN_STAT, ADC_DR_ADINT_STAT } |
ADC status register used for IP drivers. More... | |
Functions | |
void | IP_ADC_Init (IP_ADC_001_Type *pADC, uint32_t adcRate, uint32_t adcPerClock, uint8_t bitsAccuracy) |
Initialize for ADC. | |
void | IP_ADC_DeInit (IP_ADC_001_Type *pADC) |
Shutdown ADC. | |
void | IP_ADC_SetBurstMode (IP_ADC_001_Type *pADC, FunctionalState NewState) |
Set burst mode for ADC. | |
Status | IP_ADC_Get_Val (IP_ADC_001_Type *pADC, uint8_t channel, uint16_t *data) |
Get the ADC value. | |
FlagStatus | IP_ADC_GetStatus (IP_ADC_001_Type *pADC, uint8_t channel, uint32_t StatusType) |
Get ADC Channel status from ADC data register. | |
void | IP_ADC_EdgeStartConfig (IP_ADC_001_Type *pADC, uint8_t edge_mode) |
Set the edge start condition. | |
void | IP_ADC_SetChannelNumber (IP_ADC_001_Type *pADC, uint8_t channel, FunctionalState NewState) |
Enable/Disable ADC channel number. | |
void | IP_ADC_SetStartMode (IP_ADC_001_Type *pADC, uint8_t start_mode) |
Set start mode for ADC. | |
void | IP_ADC_Int_Enable (IP_ADC_001_Type *pADC, uint8_t channel, FunctionalState NewState) |
Enable/Disable interrupt for ADC channel. | |
#define ADC_CR_BITACC | ( | n | ) | ((((n) & 0x7) << 17)) |
#define ADC_CR_BURST ((1UL << 16)) |
#define ADC_CR_CH_SEL | ( | n | ) | ((1UL << (n))) |
#define ADC_CR_CLKDIV | ( | n | ) | ((((n) & 0xFF) << 8)) |
#define ADC_CR_EDGE ((1UL << 27)) |
#define ADC_CR_PDN ((1UL << 21)) |
#define ADC_CR_START_ADCTRIG0 ((4UL << 24)) |
#define ADC_CR_START_ADCTRIG1 ((5UL << 24)) |
#define ADC_CR_START_CTOUT15 ((2UL << 24)) |
#define ADC_CR_START_CTOUT8 ((3UL << 24)) |
#define ADC_CR_START_MASK ((7UL << 24)) |
#define ADC_CR_START_MCOA2 ((6UL << 24)) |
#define ADC_CR_START_MODE_SEL | ( | SEL | ) | ((SEL << 24)) |
#define ADC_CR_START_NOW ((1UL << 24)) |
#define ADC_DR_DONE | ( | n | ) | (((n) >> 31)) |
#define ADC_DR_OVERRUN | ( | n | ) | ((((n) >> 30) & (1UL))) |
#define ADC_DR_RESULT | ( | n | ) | ((((n) >> 6) & 0x3FF)) |
enum IP_ADC_Status |
void IP_ADC_DeInit | ( | IP_ADC_001_Type * | pADC | ) |
void IP_ADC_EdgeStartConfig | ( | IP_ADC_001_Type * | pADC, |
uint8_t | edge_mode | ||
) |
Status IP_ADC_Get_Val | ( | IP_ADC_001_Type * | pADC, |
uint8_t | channel, | ||
uint16_t * | data | ||
) |
FlagStatus IP_ADC_GetStatus | ( | IP_ADC_001_Type * | pADC, |
uint8_t | channel, | ||
uint32_t | StatusType | ||
) |
Get ADC Channel status from ADC data register.
pADC | : The base of ADC peripheral on the chip |
channel | : Channel number, should be 0..7 |
StatusType | : Register to read, ADC_DR_DONE_STAT, ADC_DR_OVERRUN_STAT, or ADC_DR_ADINT_STAT |
void IP_ADC_Init | ( | IP_ADC_001_Type * | pADC, |
uint32_t | adcRate, | ||
uint32_t | adcPerClock, | ||
uint8_t | bitsAccuracy | ||
) |
Initialize for ADC.
pADC | : The base of ADC peripheral on the chip |
adcRate | : Sample rate of A/D converter |
adcPerClock | : The APB clock |
bitsAccuracy | : The accuracy of LSB value, should be ADC_10BITS -> ADC_3BITS |
void IP_ADC_Int_Enable | ( | IP_ADC_001_Type * | pADC, |
uint8_t | channel, | ||
FunctionalState | NewState | ||
) |
void IP_ADC_SetBurstMode | ( | IP_ADC_001_Type * | pADC, |
FunctionalState | NewState | ||
) |
void IP_ADC_SetChannelNumber | ( | IP_ADC_001_Type * | pADC, |
uint8_t | channel, | ||
FunctionalState | NewState | ||
) |
void IP_ADC_SetStartMode | ( | IP_ADC_001_Type * | pADC, |
uint8_t | start_mode | ||
) |