2022-07-30 02:27 AM
I have a blue pill which I wish to turn its PA0 pin to ADC mode and then back to GPIO and once again to ADC. I used the code GPIO->MODER which seems doesnt work for F103. any idea how can I do it?
2022-07-30 11:53 PM
And what exactly makes you believe that it doesn't work?
2022-07-31 02:46 AM
as in configuration files MODER is not defined in the GPIO structure. also I have tried that out, gave me errors so I coudnt compile the program.
here is my so far approuch
RCC->APB2ENR |=0x0204;//10 0000 0100..Enable Clock for ADC1 and GPIOA
RCC->CFGR=0x8000;//PCLK divided by 6
GPIOA->CRL=0x00000000;//Configure GPIOA as analog input
ADC1->SMPR2=0x0007;//239.5 Cycle
ADC1->CR2=0x0003;//enable for first time
HAL_Delay(1);
ADC1->CR2=0x0003;//enable for second time
HAL_Delay(1);
to turn PA0 to ADC. but the thing is it is not yet enabled...
any ideas?