geforkt von trocache/RefKEIL
Renamed adcdriver, added base struct
Dieser Commit ist enthalten in:
Ursprung
d015a139e1
Commit
271f6ee4d7
5 geänderte Dateien mit 13 neuen und 8 gelöschten Zeilen
|
@ -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
Normale Datei
1
ProjetsKEIL/Drivers/adcdriver.c
Normale Datei
|
@ -0,0 +1 @@
|
|||
#include "adcdriver.h"
|
10
ProjetsKEIL/Drivers/adcdriver.h
Normale Datei
10
ProjetsKEIL/Drivers/adcdriver.h
Normale Datei
|
@ -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(&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
|
||||
|
|
Laden …
In neuem Issue referenzieren