Project clean

This commit is contained in:
Cedric Chanfreau 2023-04-07 14:09:20 +02:00
parent 6687cffd8f
commit 5de107765d
2 changed files with 1 additions and 83 deletions

View file

@ -88,7 +88,6 @@ void USART3_IRQHandler(void)
}
}
void UART_interruption (MyUART_Struct_Typedef * UART)
{
UART->UART->CR1 |= USART_CR1_RXNEIE;

View file

@ -4,92 +4,11 @@
#include "Driver_ADC.h"
char data[] = "Hello World";
int i = 0;
int len = sizeof(data) - 1; // -1 pour ne pas envoyer le caractère nul
void ADC_interrup(void);
int main (void){
//Déclaration d'une LED et d'un BP par structure GPIO
MyGPIO_Struct_TypeDef LED;
MyGPIO_Struct_TypeDef BP;
MyUART_Struct_Typedef UART;
//Déclaration d'un Timer 500 ms
MyTimer_Struct_TypeDef TIM500ms;
//Déclaration ADC de Test
MyADC_Struct_TypeDef ADCTEST;
//Config LED PA5
LED.GPIO_Conf = Out_Ppull;
LED.GPIO_Pin = 5;
LED.GPIO = GPIOA;
MyGPIO_Init (&LED) ;
//Config BP PC13
BP.GPIO_Conf = In_Floating;
BP.GPIO_Pin = 13;
BP.GPIO = GPIOC;
//Init BP & LED
MyGPIO_Init (&LED);
MyGPIO_Init (&BP);
//Init Timer 2 et Test
TIM500ms.Timer = TIM2;
TIM500ms.PSC = 7200; // =0.5ms(calculé à partir de la fréquence du micro)
TIM500ms.ARR = 5000;
MyTimer_Base_Init(&TIM500ms);
//InitUART
UART.UART = USART1;
/*
TIM2->DIER |= 1<< 0 ; //INTERRUPTION PERIPH
//TIM2->DIER |= TIM_DIER_UIE ;
NVIC->ISER[0] |= 1<<TIM2_IRQn ; //INTERRUPTION COEUR
NVIC->IP[TIM2_IRQn] = 2<< 4 ;
*/
MyTimer_Base_Start(TIM500ms.Timer);
//Boucle infinie de la réponse de la LED à l'état BP
MyTimer_PWM(&TIM500ms, 50);
//NVIC_EnableIRQ(USART1_IRQn);// Activer les interruptions
UART_InitGPIO(&UART);
// Envoyer les données
for (i = 0; i < len; i++) {
UART_send(data[i]);
}
//UART_read(data[i], &UART);
//ADC
//TEST ADC//
ADCTEST.ADC = ADC1;
ADCTEST.Channel = 0;
MyADC_Base_Init(&ADCTEST);
MyADC_Base_Interuption(ADCTEST.ADC);
MyADC_Init_Periph(ADC_interrup);
while(1){
MyADC_Base_Start(ADCTEST.ADC);
}
}
/*
void TIM2_IRQHandler (void)
{
MyGPIO_Toggle(GPIOA,5);
TIM2->SR &= ~(1<<0);
}
*/
void Timer_interup(void)
{
MyGPIO_Toggle(GPIOA,5);
}
//Interruption du programme par trigger de l'ADC
void ADC_interrup()
{
}