Voilier/Drivers/Sources/Driver_ADC.c
2023-03-27 14:33:50 +02:00

27 lines
618 B
C

#include "Driver_ADC.h"
void MyADC_Base_Init(MyADC_Struct_TypeDef * ADC){
RCC->CFGR |= RCC_CFGR_ADCPRE_DIV6; //Division par 6 de la clock (72MHz) pour l'ADC (14MHz max)
if(ADC->ADC == ADC1){
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; //Enable Clock ADC1
ADC1->CR2 |= ADC_CR2_ADON; //Enable ADC1
ADC1->SQR1&= ADC_SQR1_L;
ADC1->SQR3|= 8;
}else if(ADC->ADC == ADC2){
RCC->APB2ENR |= RCC_APB2ENR_ADC2EN; //Enable Clock ADC1
ADC1->CR2 |= ADC_CR2_ADON; //Enable ADC1
ADC1->SQR1&= ADC_SQR1_L;
ADC1->SQR3|= 8;
}
}
void MyADC_Base_Start(ADC_TypeDef * ADC){
}
void MyADC_Base_Stop(ADC_TypeDef * ADC){
}