diff --git a/driver/uart.c b/driver/uart.c index 402d9a8..60c081f 100644 --- a/driver/uart.c +++ b/driver/uart.c @@ -58,7 +58,7 @@ void MyUART_ActiveIT(USART_TypeDef * UART, uint8_t Prio) uint32_t IRQNumber = MyUART_GetInterruptNum(UART); UART->CR1 |= (USART_CR1_RXNEIE); //Interruption active pour la reception UNIQUEMENT NVIC->IP[IRQNumber] |= (Prio << 0x4); //Prio de l'interruption (p.197 manuel reference RM0008 pour ADC1_IRQn) - NVIC->ISER[1] |= (0x1<<(IRQNumber-32)); //Active l'interruption au niveau NVIC (p.119 manuel programming pour ISER[0]) + NVIC->ISER[1] |= (0x1<<(IRQNumber-32)); //Active l'interruption au niveau NVIC (p.119 manuel programming pour ISER[1]) } void MyUART_Init(MyUART_Struct_Typedef * UARTStructPtr){ @@ -88,7 +88,7 @@ void MyUART_InitGPIO(MyUART_Struct_Typedef * UARTStructPtr) MyGPIO_Struct_TypeDef rxd,txd; if(UARTStructPtr->UART == USART1) { - rxd = (MyGPIO_Struct_TypeDef){GPIOA,10,In_PullUp}; + rxd = (MyGPIO_Struct_TypeDef){GPIOA,10,In_Floating}; txd = (MyGPIO_Struct_TypeDef){GPIOA,9,AltOut_Ppull}; } else if(UARTStructPtr->UART == USART2) { diff --git a/implementation/remote.c b/implementation/remote.c index aa1091e..b464a8a 100644 --- a/implementation/remote.c +++ b/implementation/remote.c @@ -5,8 +5,12 @@ MyUART_Struct_Typedef uartCool = {USART1,9600,lengthBit8,parityNone,stopBit1}; void remote(uint16_t data) { - //MyGPIO_Set(GPIOA,5); - MyUART_Send(&uartCool,data); + MyUART_Send(&uartCool,data); //0x97 -> +100 (1001 0111?) 0x64 -> -100 (0110 0100) + //0xFE -> 2 , 0x02 ->-2 + if(data > 50) + { + MyGPIO_Set(GPIOA,5); + } } void initRemote(void) @@ -16,3 +20,11 @@ void initRemote(void) MyUART_Init_Periph(remote); } +void testRemote(void) +{ + MyUART_Send(&uartCool,'s'); + MyUART_Send(&uartCool,'a'); + MyUART_Send(&uartCool,'l'); + MyUART_Send(&uartCool,'u'); + MyUART_Send(&uartCool,'t'); +} diff --git a/implementation/remote.h b/implementation/remote.h index ba61449..aee32c7 100644 --- a/implementation/remote.h +++ b/implementation/remote.h @@ -6,5 +6,6 @@ void remote(uint16_t data); void initRemote(void); +void testRemote(void); #endif diff --git a/keilproject/Source/Principale.c b/keilproject/Source/Principale.c index cc8f9ec..673048e 100644 --- a/keilproject/Source/Principale.c +++ b/keilproject/Source/Principale.c @@ -10,6 +10,7 @@ int main (void) MyGPIO_Init(&led); //test des leds pour ignorer les contraintes liées aux différents ports initRemote(); + testRemote(); while(1){ }; diff --git a/keilproject/voilier.uvoptx b/keilproject/voilier.uvoptx index e3c06e3..b84204d 100644 --- a/keilproject/voilier.uvoptx +++ b/keilproject/voilier.uvoptx @@ -361,7 +361,7 @@ 0 ST-LINKIII-KEIL_SWO - -U066FFF504955857567155843 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2 + -U066FFF504955857567155843 -O206 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(1BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32F103RB$Flash\STM32F10x_128.FLM) 0 @@ -388,9 +388,9 @@ 0 0 - 31 + 15 1 -
134219614
+
134219676
0 0 0 @@ -399,55 +399,7 @@ 1 .\Source\Principale.c - \\cool_reel\Source/Principale.c\31 -
- - 1 - 0 - 28 - 1 -
134219606
- 0 - 0 - 0 - 0 - 0 - 1 - .\Source\Principale.c - - \\cool_reel\Source/Principale.c\28 -
- - 2 - 0 - 30 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - .\Source\Principale.c - - -
- - 3 - 0 - 14 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - .\Source\Principale.c - - + \\cool_reel\Source/Principale.c\15
@@ -509,14 +461,6 @@ System Viewer\USART1 35905 - - System Viewer\USART2 - 35904 - - - System Viewer\USART3 - 35903 - 1