Renamed adcdriver, added base struct

This commit is contained in:
Yohan Boujon 2023-03-22 17:01:14 +01:00
parent d015a139e1
commit 271f6ee4d7
5 changed files with 13 additions and 8 deletions

View file

@ -1 +0,0 @@
#include "adc.h"

View file

@ -1,5 +0,0 @@
#ifndef ADCDRIVER_H
#define ADCDRIVER_H
#include "stm32f10x.h"
#endif

View file

@ -0,0 +1 @@
#include "adcdriver.h"

View file

@ -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

View file

@ -15,8 +15,8 @@ int main (void)
MyGPIO_Init(&led);
MyGPIO_Init(&adc);
RCC->CFGR |= (0x2<<ADCPRE); // ADC Prescaler : divided by 6 -> 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