voilier-team-1/keilproject/Source/Principale.c

38 lines
1 KiB
C
Raw Normal View History

2023-03-22 15:28:54 +01:00
#include "stm32f10x.h"
#include "../../driver/MyI2C.h"
#include "../../driver/MySPI.h"
#include "../../implementation/remote.h"
#include "../../driver/gpio.h"
2023-03-22 15:28:54 +01:00
int main (void)
{
//rxd input pull up, txd output none
MyGPIO_Struct_TypeDef led = {GPIOA,5,Out_PullUp}; //led
MyGPIO_Struct_TypeDef rxd1 = {GPIOA,10,In_PullUp};
MyGPIO_Struct_TypeDef txd1 = {GPIOA,9,AltOut_Ppull};
MyGPIO_Struct_TypeDef rxd2 = {GPIOA,3,In_Floating};
MyGPIO_Struct_TypeDef txd2 = {GPIOA,2,AltOut_Ppull};
MyGPIO_Struct_TypeDef rxd3 = {GPIOB,11,In_PullUp};
MyGPIO_Struct_TypeDef txd3 = {GPIOB,10,AltOut_Ppull};
MyUART_Struct_Typedef uartCool = {USART3,9600,lengthBit8,parityNone,stopBit1};
MyGPIO_Init(&led);
MyGPIO_Init(&rxd1);
MyGPIO_Init(&txd1);
MyGPIO_Init(&rxd2);
MyGPIO_Init(&txd2);
MyGPIO_Init(&rxd3);
MyGPIO_Init(&txd3);
MyUART_Init(&uartCool);
while(1){
if(MyUART_Read(&uartCool) == 0x61)
{
MyGPIO_Set(GPIOA,5);
MyUART_Send(&uartCool,'k');
MyUART_Send(&uartCool,'o');
MyUART_Send(&uartCool,'\n');
}
};
2023-03-22 15:28:54 +01:00
}