Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed
adc.h
00001 /* 00002 * adc.h 00003 * 00004 * Created on: 02/07/2011 00005 * Author: francisco 00006 */ 00007 00008 #ifndef ADC_H_ 00009 #define ADC_H_ 00010 00011 00012 #define PCADC (1U<<12) 00013 00014 #define ADC_CCLK_4 0U 00015 #define ADC_CCLK 1U 00016 #define ADC_CCLK_2 2U 00017 #define ADC_CCLK_8 3U 00018 00019 #define PCLK_ADC 24U 00020 00021 #define ADC_CH_0 (1U<<0) 00022 #define ADC_CH_1 (1U<<1) 00023 #define ADC_CH_2 (1U<<2) 00024 #define ADC_CH_3 (1U<<3) 00025 #define ADC_CH_4 (1U<<4) 00026 #define ADC_CH_5 (1U<<5) 00027 #define ADC_CH_6 (1U<<6) 00028 #define ADC_CH_7 (1U<<7) 00029 #define ADC_CLKDIV(val) ((val)<<8) 00030 #define ADC_MODE_BURST (1U<<16) 00031 #define ADC_OPERATIONAL (1U<< 21) 00032 #define ADC_NO_START ~(7U<<24) 00033 #define ADC_START_NOW (1U<<24) 00034 #define ADC_START_ON_PIO2_10 (2U<<24) 00035 #define ADC_START_ON_PIO1_27 (3U<<24) 00036 #define ADC_START_ON_MAT0_1 (4U<<24) 00037 #define ADC_START_ON_MAT0_3 (5U<<24) 00038 #define ADC_START_ON_MAT1_0 (6U<<24) 00039 #define ADC_START_ON_MAT1_1 (7U<<24) 00040 #define ADC_EDGE_FALLING (1U<<27) 00041 #define ADC_EDGE_RAISING ~(1U<<27) 00042 00043 #define ADC_GLOBAL_INT (1U<<8) 00044 #define ADC_INT_CH_0 (1U<<0) 00045 #define ADC_INT_CH_1 (1U<<1) 00046 #define ADC_INT_CH_2 (1U<<2) 00047 #define ADC_INT_CH_3 (1U<<3) 00048 #define ADC_INT_CH_4 (1U<<4) 00049 #define ADC_INT_CH_5 (1U<<5) 00050 #define ADC_INT_CH_6 (1U<<6) 00051 #define ADC_INT_CH_7 (1U<<7) 00052 00053 #define ADC_LAST_CONVERSION() ((LPC_ADC->ADGDR&(0xFFFU<<4))>>4) 00054 #define ADC_LAST_CONVERSION_CHANNEL() ((LPC_ADC->ADGDR&(7U<<24))>>24) 00055 #define ADC_LAST_CONVERSION_DONE() (LPC_ADC->ADGDR&(1U<<31)) 00056 #define ADC_LAST_CONVERSION_OVERUN() (LPC_ADC->ADGDR&(1U<<30)) 00057 #define ADC_CONVERSION_CH(ch) ((LPC_ADC->ADDR[ch]&(0xFFFU<<4))>>4) 00058 #define ADC_CONVERSION_DONE_CH(ch) (LPC_ADC->ADDR[ch]&(1U<<31)) 00059 #define ADC_CONVERSION_OVERUN_CH(ch) (LPC_ADC->ADDR[ch]&(1U<<30)) 00060 00061 #define ADC_CONVERT(val) ((val&(0xFFFU<<4))>>4) 00062 #define ADC_CHANNEL(val) ((val&(7U<<24))>>24) 00063 00064 #ifdef __cplusplus 00065 extern "C" { 00066 #endif 00067 00068 extern void init_adc(int adc_clk); 00069 extern void setup_start(int mode,int edge); 00070 extern void select_channels(int adc_ch); 00071 00072 #ifdef __cplusplus 00073 } 00074 #endif 00075 00076 #endif /* ADC_H_ */
Generated on Fri Jul 22 2022 19:25:55 by
