voilier-team-1/implementation/remote.c

31 lines
600 B
C
Raw Normal View History

#include "remote.h"
#include "../driver/gpio.h"
MyUART_Struct_Typedef uartCool = {USART1,9600,lengthBit8,parityNone,stopBit1};
void remote(uint16_t data)
{
2023-04-04 15:26:37 +02:00
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)
{
MyUART_InitGPIO(&uartCool);
MyUART_Init(&uartCool);
MyUART_Init_Periph(remote);
}
2023-04-04 15:26:37 +02:00
void testRemote(void)
{
MyUART_Send(&uartCool,'s');
MyUART_Send(&uartCool,'a');
MyUART_Send(&uartCool,'l');
MyUART_Send(&uartCool,'u');
MyUART_Send(&uartCool,'t');
}