You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
981 B
69 lines
981 B
#include "main.hpp"
|
|
#include "delay.h"
|
|
#include "stm32f0xx_csl.h"
|
|
#include "usart.h"
|
|
#include "ascii.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
uint8_t i = 0;
|
|
uint8_t a = '0';
|
|
stmStart();
|
|
|
|
delayInitMs(8000000, 1000);
|
|
|
|
pinConfig(pinB3, output, pushPull, def_res, def_speed);
|
|
pinConfig(pinA0, input, def_stage, pullDown, def_speed);
|
|
usartInit( usart2,
|
|
pinA2,
|
|
pinA15,
|
|
115200,
|
|
eight,
|
|
NO_PARITY_CTRL,
|
|
noFlowControl);
|
|
|
|
// print_Usart(usart2, ASCII_clear);
|
|
print_Usart(usart2, "Wellcome to our KED project\n\r");
|
|
|
|
|
|
for(i = 0 ; i < 10 ; i++)
|
|
{
|
|
delayMs(100);
|
|
pinToggle(pinB3);
|
|
delayMs(100);
|
|
}
|
|
|
|
pinWrite(pinB3,0);
|
|
|
|
//usartSendChar(usart2, a);
|
|
while(1)
|
|
{
|
|
a = usartGetChar(usart2);
|
|
usartSendChar(usart2, a);
|
|
|
|
if(a == '1')
|
|
{
|
|
pinWrite(pinB3,1);
|
|
}
|
|
else
|
|
{
|
|
pinWrite(pinB3,0);
|
|
}
|
|
|
|
/*
|
|
if(pinRead(pinA0))
|
|
{
|
|
pinWrite(pinB3,1);
|
|
}
|
|
else
|
|
{
|
|
pinWrite(pinB3,0);
|
|
}
|
|
*/
|
|
delayMs(100);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|