#ifndef __ADC_H_
#define __ADC_H_
#include "lpc17xx.h"
/*
typedef struct
{
__IO uint32_t ADCR;
__IO uint32_t ADGDR;
uint32_t RESERVED0;
__IO uint32_t ADINTEN;
__I uint32_t ADDR0;
__I uint32_t ADDR1;
__I uint32_t ADDR2;
__I uint32_t ADDR3;
__I uint32_t ADDR4;
__I uint32_t ADDR5;
__I uint32_t ADDR6;
__I uint32_t ADDR7;
__I uint32_t ADSTAT;
__IO uint32_t ADTRM;
} LPC_ADC_TypeDef;
#define LPC_ADC ((LPC_ADC_TypeDef *) LPC_ADC_BASE )
*/
typedef struct{
union{
struct{
unsigned SEL:8;
unsigned CLKDIV:8;
unsigned BURST:1;
unsigned :4;
unsigned PDN:1;
unsigned :2;
unsigned START:3;
unsigned EDGE:1;
};
uint32_t IADCR;
};
}defADCR;
typedef struct{
union{
struct{
unsigned :4;
unsigned RESULT:12;
unsigned :8;
unsigned CHN:3;
unsigned :3;
unsigned OVERRUN:1;
unsigned DONE:1;
};
unsigned IADGDR;
};
}defADGDR;
typedef enum{
no_start=0,
now=1,
p210=2,
p127=3,
mat01=4,
mat03=5,
mat10=6,
mat11=7,
}enumstarter;
typedef enum{
rising=0,
falling=1,
}enumedge;
typedef struct{
union{
struct{
unsigned :4;
unsigned RESULT:12;
unsigned :14;
unsigned OVERRUN:1;
unsigned DONE:1;
};
uint32_t IADDR;
};
}defADDR;
typedef struct{
union{
struct{
unsigned INTEN0:1;
unsigned INTEN1:1;
unsigned INTEN2:1;
unsigned INTEN3:1;
unsigned INTEN4:1;
unsigned INTEN5:1;
unsigned INTEN6:1;
unsigned INTEN7:1;
unsigned ADGINTEN:1;
};
uint8_t ints;
uint32_t IINT;
};
}defINT;
#define ADCR ((defADCR *)&LPC_ADC->ADCR)
#define ADGDR ((defADGDR *)&LPC_ADC->ADGDR)
#define ADDR0 ((defADDR*)&LPC_ADC->ADDR0)
#define ADDR1 ((defADDR*)&LPC_ADC->ADDR1)
#define ADDR2 ((defADDR*)&LPC_ADC->ADDR2)
#define ADDR3 ((defADDR*)&LPC_ADC->ADDR3)
#define ADDR4 ((defADDR*)&LPC_ADC->ADDR4)
#define ADDR5 ((defADDR*)&LPC_ADC->ADDR5)
#define ADDR6 ((defADDR*)&LPC_ADC->ADDR6)
#define ADDR7 ((defADDR*)&LPC_ADC->ADDR7)
#define ADC_INT ((defINT*)&LPC_ADC->ADINTEN)
#endif