33 lines
590 B
C
33 lines
590 B
C
#include "remote.h"
|
|
#include "gpio.h"
|
|
|
|
MyUART_Struct_Typedef uartCool = {USART1,9600,lengthBit8,parityNone,stopBit1};
|
|
|
|
void remote(uint8_t data)
|
|
{
|
|
MyUART_Send(&uartCool,data);
|
|
int8_t signedData = (int8_t)data;
|
|
if(signedData > 0)
|
|
{
|
|
MyGPIO_Set(GPIOA,5);
|
|
}
|
|
else {
|
|
MyGPIO_Reset(GPIOA,5);
|
|
}
|
|
}
|
|
|
|
void initRemote(void)
|
|
{
|
|
MyUART_InitGPIO(&uartCool);
|
|
MyUART_Init(&uartCool);
|
|
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');
|
|
}
|