open-ameba/sdk/example_sources/log_uart_char_loopback/src/main.c
Drasko DRASKOVIC eeb7f808ae Change SDK dir name. Use OpenOCD only.
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
2017-05-14 18:47:13 +02:00

40 lines
893 B
C

/*
* Routines to access hardware
*
* Copyright (c) 2013 Realtek Semiconductor Corp.
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*/
#include "device.h"
#include "log_uart_api.h"
log_uart_t uobj;
void uart_send_string(log_uart_t *uobj, char *pstr)
{
unsigned int i=0;
while (*(pstr+i) != 0) {
log_uart_putc(uobj, *(pstr+i));
i++;
}
}
void main(void)
{
// sample text
char rc;
// Initial Log UART: BaudRate=115200, 8-bits, No Parity, 1 Stop bit
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
uart_send_string(&uobj, "UART API Demo...\r\n");
uart_send_string(&uobj, "Hello World!\r\n");
while(1){
uart_send_string(&uobj, "\r\n8195a$");
rc = log_uart_getc(&uobj);
log_uart_putc(&uobj, rc);
}
}