2023-03-31 09:37:30 +02:00
|
|
|
#ifndef ADCDRIVER_H
|
|
|
|
#define ADCDRIVER_H
|
|
|
|
#include "stm32f10x.h"
|
2023-03-31 10:12:56 +02:00
|
|
|
#include "gpio.h"
|
2023-03-31 09:37:30 +02:00
|
|
|
|
|
|
|
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);
|
2023-04-07 15:28:30 +02:00
|
|
|
void MyADC_Init_Periph (void (* ptrFonction)(uint32_t));
|
2023-03-31 09:37:30 +02:00
|
|
|
MyGPIO_Struct_TypeDef GPIOFromADC(MyADC_Struct_TypeDef ADC);
|
|
|
|
|
|
|
|
#define MyADC_Base_Start(ADC) (ADC->CR2 |= ADC_CR2_SWSTART)
|
|
|
|
|
|
|
|
#endif
|