Closed laukik-hase closed 3 years ago
Yes, will replace that if else block by switch statement but I'm not sure about default statement This is the mapping of esp32 pins to ADC channel, default case will be too large. Do we want to make this function universal @laukik-hase ? ADC1_CH0 – GPIO36 ADC1_CH1 – GPIO37 ADC1_CH2 – GPIO38 ADC1_CH3 – GPIO39 ADC1_CH4 – GPIO32 ADC1_CH5- GPIO33 ADC1_CH6 – GPIO34 ADC1_CH7 – GPIO35 ADC2_CH0 – GPIO4 ADC2_CH1 – GPIO0 ADC2_CH2 – GPIO2 ADC2_CH3 – GPIO15 ADC2_CH4 – GPIO13 ADC2_CH5 – GPIO12 ADC2_CH6 – GPIO14 ADC2_CH7 – GPIO27 ADC2_CH8 – GPIO25 ADC2_CH9 – GPIO26
@ombhilare999 As in your else case, you can just break in the default case.
Fixed in 2d63fcf3f5e5489aae242629211e041012deee8e
https://github.com/SRA-VJTI/sra-board-component/blob/d58505f71440e80b5fe426d02a260f7a3d6b5264/src/adc.c#L16
Can this if..else.. block be replaced by a switch statement with a default statement handling cases of channels other than LSA?