From 30ceea84e7967e8a1a7876ff71027519a0308d5b Mon Sep 17 00:00:00 2001 From: Cedric Date: Fri, 7 Apr 2023 13:30:06 +0200 Subject: [PATCH] UART DONE --- Drivers/Include/Driver_UART.h | 1 + Drivers/Sources/Driver_UART.c | 6 ++- GPIO_Test/GPIO_Test.uvoptx | 73 ++--------------------------------- 3 files changed, 9 insertions(+), 71 deletions(-) diff --git a/Drivers/Include/Driver_UART.h b/Drivers/Include/Driver_UART.h index fc9e08a..23134ad 100644 --- a/Drivers/Include/Driver_UART.h +++ b/Drivers/Include/Driver_UART.h @@ -15,6 +15,7 @@ void USART1_IRQHandler(void); void USART2_IRQHandler(void); void USART3_IRQHandler(void); void UART_InitGPIO(MyUART_Struct_Typedef * UART); +void UART_interruption (MyUART_Struct_Typedef * UART); diff --git a/Drivers/Sources/Driver_UART.c b/Drivers/Sources/Driver_UART.c index 3d98d55..87bcfd3 100644 --- a/Drivers/Sources/Driver_UART.c +++ b/Drivers/Sources/Driver_UART.c @@ -23,8 +23,10 @@ void UART_init(MyUART_Struct_Typedef * UART) UART->UART->BRR = 72000000/(UART->baudrate); USART1->CR1 |= USART_CR1_TE; // Autoriser la transmission USART1->CR1 |= USART_CR1_RE; // Activer la réception - USART1->CR1 |= USART_CR1_TCIE; // Activer l'interruption de transmission + // USART1->CR1 |= USART_CR1_TCIE; // Activer l'interruption de transmission USART1->CR1 |= USART_CR1_RXNEIE; // Activer l'interruption de réception + UART_interruption(UART); + } void UART_send(char data) @@ -46,7 +48,7 @@ char UART_read(char data, MyUART_Struct_Typedef * UART) return 0; } - + void USART1_IRQHandler(void) { if (USART1->SR & USART_SR_RXNE) // si une donnée a été reçue diff --git a/GPIO_Test/GPIO_Test.uvoptx b/GPIO_Test/GPIO_Test.uvoptx index 6dd6ca4..c7434e3 100644 --- a/GPIO_Test/GPIO_Test.uvoptx +++ b/GPIO_Test/GPIO_Test.uvoptx @@ -125,7 +125,7 @@ 0 DLGDARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1357,482,1778,909,1)(121=-1,-1,-1,-1,0)(122=546,289,967,716,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=911,135,1505,886,0)(131=997,343,1591,1094,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=1345,64,1793,478,1)(161=1383,268,1831,682,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) + (1010=75,104,451,661,1)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(100=-1,-1,-1,-1,0)(110=-1,-1,-1,-1,0)(111=-1,-1,-1,-1,0)(1011=-1,-1,-1,-1,0)(180=-1,-1,-1,-1,0)(120=1357,482,1778,909,1)(121=-1,-1,-1,-1,0)(122=546,289,967,716,0)(123=-1,-1,-1,-1,0)(140=-1,-1,-1,-1,0)(240=-1,-1,-1,-1,0)(190=-1,-1,-1,-1,0)(200=-1,-1,-1,-1,0)(170=-1,-1,-1,-1,0)(130=911,135,1505,886,0)(131=997,343,1591,1094,0)(132=-1,-1,-1,-1,0)(133=-1,-1,-1,-1,0)(160=798,177,1246,591,1)(161=1383,268,1831,682,0)(162=-1,-1,-1,-1,0)(210=-1,-1,-1,-1,0)(211=-1,-1,-1,-1,0)(220=-1,-1,-1,-1,0)(221=-1,-1,-1,-1,0)(230=-1,-1,-1,-1,0)(234=-1,-1,-1,-1,0)(231=-1,-1,-1,-1,0)(232=-1,-1,-1,-1,0)(233=-1,-1,-1,-1,0)(150=-1,-1,-1,-1,0)(151=-1,-1,-1,-1,0) 0 @@ -143,72 +143,7 @@ -U -O206 -S8 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) - - - 0 - 0 - 38 - 0 -
134219492
- 0 - 0 - 0 - 0 - 0 - 1 - U:\INSA\Microcontrôleur\Projet_Voilier_grp\Voilier\Drivers\Sources\Driver_UART.c - - \\GPIO_Test\../Drivers/Sources/Driver_UART.c\38 -
- - 1 - 0 - 39 - 0 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - ..\Drivers\Sources\Driver_UART.c - - -
- - 2 - 0 - 54 - 0 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - ..\Drivers\Sources\Driver_UART.c - - -
- - 3 - 0 - 67 - 0 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - ..\Drivers\Sources\Driver_UART.c - - -
-
+ 0 @@ -458,7 +393,7 @@ 1 1 1 - 1 + 0 0 0 ..\Drivers\Sources\Driver_GPIO.c @@ -482,7 +417,7 @@ 1 3 1 - 0 + 1 0 0 ..\Drivers\Sources\Driver_UART.c