31 lines
726 B
C
31 lines
726 B
C
#ifndef ADCDRIVER_H
|
|
#define ADCDRIVER_H
|
|
#include "stm32f10x.h"
|
|
#include "gpio.h"
|
|
|
|
typedef enum{
|
|
cycles1d5 = 0b000,
|
|
cycles7d5 = 0b001,
|
|
cycles13d5 = 0b010,
|
|
cycles28d5 = 0b011,
|
|
cycles41d5 = 0b100,
|
|
cycles55d5 = 0b101,
|
|
cycles71d5 = 0b110,
|
|
cycles239d5 = 0b111
|
|
} MyADC_Cycle_t;
|
|
|
|
typedef struct
|
|
{
|
|
ADC_TypeDef * ADC; //ADC 1 or 2
|
|
uint8_t channel; //channel 0 -> 17
|
|
MyADC_Cycle_t cycle; //channel cycle
|
|
} MyADC_Struct_TypeDef;
|
|
|
|
void MyADC_Init(MyADC_Struct_TypeDef * ADCStructPtr);
|
|
void MyADC_ActiveIT(ADC_TypeDef * ADC, uint8_t Prio);
|
|
void MyADC_Init_Periph (void (* ptrFonction)(void));
|
|
MyGPIO_Struct_TypeDef GPIOFromADC(MyADC_Struct_TypeDef ADC);
|
|
|
|
#define MyADC_Base_Start(ADC) (ADC->CR2 |= ADC_CR2_SWSTART)
|
|
|
|
#endif
|