forked from trocache/RefKEIL
Renamed adcdriver, added base struct
This commit is contained in:
parent
d015a139e1
commit
271f6ee4d7
5 changed files with 13 additions and 8 deletions
|
@ -1 +0,0 @@
|
||||||
#include "adc.h"
|
|
|
@ -1,5 +0,0 @@
|
||||||
#ifndef ADCDRIVER_H
|
|
||||||
#define ADCDRIVER_H
|
|
||||||
#include "stm32f10x.h"
|
|
||||||
|
|
||||||
#endif
|
|
1
ProjetsKEIL/Drivers/adcdriver.c
Normal file
1
ProjetsKEIL/Drivers/adcdriver.c
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#include "adcdriver.h"
|
10
ProjetsKEIL/Drivers/adcdriver.h
Normal file
10
ProjetsKEIL/Drivers/adcdriver.h
Normal 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
|
|
@ -15,8 +15,8 @@ int main (void)
|
||||||
MyGPIO_Init(&led);
|
MyGPIO_Init(&led);
|
||||||
MyGPIO_Init(&adc);
|
MyGPIO_Init(&adc);
|
||||||
|
|
||||||
RCC->CFGR |= (0x2<<ADCPRE); // ADC Prescaler : divided by 6 -> 72MHz to 12MHz
|
RCC->CFGR |= RCC_CFGR_ADCPRE_1;// ADC Prescaler : divided by 6 -> 72MHz to 12MHz
|
||||||
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN;
|
RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; //We activate the clock first
|
||||||
|
|
||||||
|
|
||||||
//ADC1->CR1 |= (0x0<<24); //Resolution 12bit -> 00
|
//ADC1->CR1 |= (0x0<<24); //Resolution 12bit -> 00
|
||||||
|
|
Loading…
Reference in a new issue