changing names, adding implementation folder

This commit is contained in:
Yohan Boujon 2023-03-31 10:12:56 +02:00
parent 9564e30a93
commit 7009c70707
6 changed files with 9 additions and 9 deletions

View file

@ -1,6 +1,6 @@
#include "adcdriver.h" #include "adc.h"
void (* pFncADC) (void); /* déclaration dun pointeur de fonction */ void (* pFncADC) (void); /* d<EFBFBD>claration d<>un pointeur de fonction */
void MyADC_Init_Periph (void (* ptrFonction)(void)) void MyADC_Init_Periph (void (* ptrFonction)(void))
{ {
@ -11,7 +11,7 @@ void MyADC_Init(MyADC_Struct_TypeDef * ADCStructPtr)
{ {
RCC->CFGR |= RCC_CFGR_ADCPRE_1; // 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; //We activate the clock first RCC->APB2ENR |= RCC_APB2ENR_ADC1EN; //We activate the clock first
if(ADCStructPtr->channel < 10) //Cycle and channel selection -> permet de regler en fonction de la résistance donnée if(ADCStructPtr->channel < 10) //Cycle and channel selection -> permet de regler en fonction de la r<EFBFBD>sistance donn<6E>e
{ {
ADCStructPtr->ADC->SMPR2 |= (ADCStructPtr->cycle<<(ADCStructPtr->channel*3)); //Channel < 10 ADCStructPtr->ADC->SMPR2 |= (ADCStructPtr->cycle<<(ADCStructPtr->channel*3)); //Channel < 10
@ -20,7 +20,7 @@ void MyADC_Init(MyADC_Struct_TypeDef * ADCStructPtr)
ADCStructPtr->ADC->SMPR1 |= (ADCStructPtr->cycle<<((ADCStructPtr->channel-10)*3)); //Channel > 10 ADCStructPtr->ADC->SMPR1 |= (ADCStructPtr->cycle<<((ADCStructPtr->channel-10)*3)); //Channel > 10
} }
ADCStructPtr->ADC->SQR1 &= ADC_SQR1_L; //Channel sequence length -> 1 conversion (0000) ADCStructPtr->ADC->SQR1 &= ADC_SQR1_L; //Channel sequence length -> 1 conversion (0000)
ADCStructPtr->ADC->SQR3 |= ADCStructPtr->channel; //Sequence Reader, seulement le SQ1 est lu dans notre cas, nous associons un channel à ce dernier. ADCStructPtr->ADC->SQR3 |= ADCStructPtr->channel; //Sequence Reader, seulement le SQ1 est lu dans notre cas, nous associons un channel <EFBFBD> ce dernier.
ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTTRIG; //Activation du trigger externe ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTTRIG; //Activation du trigger externe
ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTSEL; //Event externe choisie : SWSTART ADCStructPtr->ADC->CR2 |= ADC_CR2_EXTSEL; //Event externe choisie : SWSTART
MyADC_ActiveIT(ADCStructPtr->ADC,0); MyADC_ActiveIT(ADCStructPtr->ADC,0);
@ -40,5 +40,5 @@ void ADC1_2_IRQHandler(void)
if (pFncADC != 0) if (pFncADC != 0)
(*pFncADC) (); /* appel indirect de la fonction */ (*pFncADC) (); /* appel indirect de la fonction */
MyADC_Base_Start(ADC1); MyADC_Base_Start(ADC1);
ADC1->SR &= ~ADC_SR_EOC; //Prochaine lecture pouvant être effectuée. ADC1->SR &= ~ADC_SR_EOC; //Prochaine lecture pouvant <EFBFBD>tre effectu<74>e.
} }

View file

@ -1,7 +1,7 @@
#ifndef ADCDRIVER_H #ifndef ADCDRIVER_H
#define ADCDRIVER_H #define ADCDRIVER_H
#include "stm32f10x.h" #include "stm32f10x.h"
#include "gpiodriver.h" #include "gpio.h"
typedef enum{ typedef enum{
cycles1d5 = 0b000, cycles1d5 = 0b000,

View file

@ -1,4 +1,4 @@
#include "gpiodriver.h" #include "gpio.h"
void MyGPIO_Init(MyGPIO_Struct_TypeDef * GPIOStructPtr) void MyGPIO_Init(MyGPIO_Struct_TypeDef * GPIOStructPtr)
{ {

View file

@ -1,4 +1,4 @@
#include "UART.h" #include "uart.h"
#include "gpio.h" #include "gpio.h"
//faire GPIO //faire GPIO
@ -84,7 +84,7 @@ char MyUART_Read(MyUART_Struct_Typedef * UARTStructPtr)
UART1.UART = USART1; // choix UART (USART1, USART2, USART3) UART1.UART = USART1; // choix UART (USART1, USART2, USART3)
UART1.BaudRate = 9600; // Vitesse de communication MAX 118200 UART1.BaudRate = 9600; // Vitesse de communication MAX 118200
UART1.Wlengh = Wlengh8; // longeur du mot (Wlengh8 ,Wlengh9) UART1.Wlengh = Wlengh8; // longeur du mot (Wlengh8 ,Wlengh9)
UART1.Wparity = parity_even; // parité (parity_even, parity_odd, parity_none) UART1.Wparity = parity_even; // parit<EFBFBD> (parity_even, parity_odd, parity_none)
UART1.Wstop = stop1b; // nombre bit de stop (stop1b, stop2b) UART1.Wstop = stop1b; // nombre bit de stop (stop1b, stop2b)
MyUART_Init(&UART1); // initialisation MyUART_Init(&UART1); // initialisation
*/ */