14 #include "sys/clock.h"
21 xDMAHandle adc_dma=0xff;
22 unsigned int *adc_dma_dest;
26 void adc_init(
void) __banked
29 while (!
SLEEP&(HFRC_STB)) {}
34 while (!
SLEEP&(XOSC_STB)) {}
50 adc_dma=dma_config2(ADC_DMA_CONFIG_CHANNEL, &ADC_SHADOW,
DMA_NOINC, adc_dma_dest,
DMA_NOINC, 1, 1,
DMA_VLEN_LEN,
DMA_RPT,
DMA_T_ADC_CHALL, 0);
55 void adc_single_shot(
void) __banked
60 int16_t adc_convert_result(int16_t data) __banked {
61 data = (0xfffc&data)>>2;
65 int16_t adc_get_last_conv() __banked {
67 result = (ADCH<<8)|(ADCL);
68 result = (0xfffc&result)>>2;