From 55eed5ecb8b6097f3eddd7fe8591c9825b1f8cda Mon Sep 17 00:00:00 2001 From: tainfante Date: Sun, 21 Jan 2018 20:23:59 +0100 Subject: [PATCH] updated sending data --- src/main.c | 7 ++++++- src/uart.c | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index ad2a455..778d1e8 100644 --- a/src/main.c +++ b/src/main.c @@ -101,6 +101,8 @@ int main() //time - 36 bits result + uint16_t receivedData; + alt_putstr("KCC Project!\n"); // register the timer irq to be serviced by handle_timer_interrupt() function @@ -108,7 +110,10 @@ int main() while (1) { - SendLong(time); + receivedData=ReceiveData(); + if(receivedData==66){ + SendLong(time); + } PIO_SetBit(LED_PORT, LED_0); delayMs(400); diff --git a/src/uart.c b/src/uart.c index 985a98c..2a42e70 100644 --- a/src/uart.c +++ b/src/uart.c @@ -15,6 +15,11 @@ static void sendByte(char byte) IOWR_ALT_UP_RS232_DATA(UART_0_BASE, byte); } +uint16_t ReceiveData(USART_TypeDef* USARTx){ + + IORD_ALT_UP_RS232_DATA(UART_0_BASE); +} + void sendStrig(char* s) { while(*s)