From 82c9f0406ca867d00486a826a0261f5a351e22dd Mon Sep 17 00:00:00 2001 From: liuyihui Date: Thu, 27 Apr 2023 23:20:47 +0800 Subject: [PATCH] style: fix adc --- src/adc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/adc.c b/src/adc.c index 931573f..51c80af 100644 --- a/src/adc.c +++ b/src/adc.c @@ -9,12 +9,12 @@ void ADC0_Init() { // USE AD0 (ADC0_SE4a) PORTE->PCR[21] |= PORT_PCR_MUX(0x0); - ADC0->CFG1 = ADC_CFG1_ADLSMP_MASK // Sample time 0 = Short, 1 = Long - | ADC_CFG1_MODE(0b01); // Conversion mode 00 = 8-bit, 01 = 12-bit, 10 = 10-bit, 11 = 16-bit - ADC0->SC3 = ADC_SC3_ADCO_MASK // Continuous Conversion if AVGE = 1 - | ADC_SC3_AVGE_MASK // Hardware average - | ADC_SC3_AVGS(0x01); // Hardware average 00 = 4 samples, 01 = 8, 10 = 16, 11 = 32 - ADC0->SC1[0] = ADC_SC1_ADCH(0b00100); // Input channel select, AD4a is selected as input + ADC0->CFG1 = ADC_CFG1_ADLSMP_MASK // Sample time 0 = Short, 1 = Long + | ADC_CFG1_MODE(0x01); // Conversion mode 00 = 8-bit, 01 = 12-bit, 10 = 10-bit, 11 = 16-bit + ADC0->SC3 = ADC_SC3_ADCO_MASK // Continuous Conversion if AVGE = 1 + | ADC_SC3_AVGE_MASK // Hardware average + | ADC_SC3_AVGS(0x01); // Hardware average 00 = 4 samples, 01 = 8, 10 = 16, 11 = 32 + ADC0->SC1[0] = ADC_SC1_ADCH(0x04); // Input channel select, AD4a is selected as input } int16_t ADC0_TR_DATA() {