diff --git a/ProjetsKEIL/Drivers/adc.c b/ProjetsKEIL/Drivers/adc.c deleted file mode 100644 index 65e55ff..0000000 --- a/ProjetsKEIL/Drivers/adc.c +++ /dev/null @@ -1 +0,0 @@ -#include "adc.h" diff --git a/ProjetsKEIL/Drivers/adc.h b/ProjetsKEIL/Drivers/adc.h deleted file mode 100644 index 434becb..0000000 --- a/ProjetsKEIL/Drivers/adc.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef ADCDRIVER_H -#define ADCDRIVER_H -#include "stm32f10x.h" - -#endif diff --git a/ProjetsKEIL/Drivers/adcdriver.c b/ProjetsKEIL/Drivers/adcdriver.c new file mode 100644 index 0000000..e676215 --- /dev/null +++ b/ProjetsKEIL/Drivers/adcdriver.c @@ -0,0 +1 @@ +#include "adcdriver.h" diff --git a/ProjetsKEIL/Drivers/adcdriver.h b/ProjetsKEIL/Drivers/adcdriver.h new file mode 100644 index 0000000..ba3bdcf --- /dev/null +++ b/ProjetsKEIL/Drivers/adcdriver.h @@ -0,0 +1,10 @@ +#ifndef ADCDRIVER_H +#define ADCDRIVER_H +#include "stm32f10x.h" + +typedef struct +{ + GPIO_TypeDef * ADC; //ADC 1 or 2 +} MyADC_Struct_TypeDef; + +#endif diff --git a/ProjetsKEIL/adc/Source/Principale.c b/ProjetsKEIL/adc/Source/Principale.c index 10fb923..b7caf48 100644 --- a/ProjetsKEIL/adc/Source/Principale.c +++ b/ProjetsKEIL/adc/Source/Principale.c @@ -15,8 +15,8 @@ int main (void) MyGPIO_Init(&led); MyGPIO_Init(&adc); - RCC->CFGR |= (0x2< 72MHz to 12MHz - RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; + RCC->CFGR |= RCC_CFGR_ADCPRE_1;// ADC Prescaler : divided by 6 -> 72MHz to 12MHz + RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; //We activate the clock first //ADC1->CR1 |= (0x0<<24); //Resolution 12bit -> 00