Update revision to use TI's mqtt and Freertos.
Dependencies: mbed client server
Fork of cc3100_Test_mqtt_CM3 by
Diff: cli_uart.cpp
- Revision:
- 0:dbe5e7db3c45
- Child:
- 3:a8c249046181
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/cli_uart.cpp Sat Jun 06 13:32:15 2015 +0000
@@ -0,0 +1,62 @@
+
+#include "mbed.h"
+#include "myBoardInit.h"
+#include "cli_uart.h"
+#include "osi.h"
+#include "stdio.h"
+
+OsiLockObj_t g_printLock;
+#if (THIS_BOARD == Seeed_Arch_Max)
+Serial uart(PA_9, PA_10);
+#elif (THIS_BOARD == EA_MBED_LPC4088)
+Serial uart(p37, p31);
+#elif (THIS_BOARD == MBED_BOARD_LPC1768)
+Serial uart(p13, p14);
+#endif
+
+int Uart_Write(unsigned char *inBuff)
+{
+ uint16_t ret, ecount, usLength = strlen((const char *)inBuff);
+ ecount = 0;
+ ret = 0;
+
+ while(!(uart.writeable())){ecount++;if(ecount>3000)break;};
+
+ if(uart.writeable()) {
+
+ if(inBuff == NULL) {
+ printf("Uart Write buffer empty\r\n");
+ return -1;
+ }
+
+ RTOS_MUTEX_ACQUIRE(&g_printLock);
+ ret = usLength;
+
+ while (usLength) {
+ uart.putc(*inBuff);
+ usLength--;
+ inBuff++;
+ }
+
+ RTOS_MUTEX_RELEASE(&g_printLock);
+ } else {
+ printf("Uart Write failed [uart not writeable] now trying printf\r\n");
+ while (usLength) {
+ printf("%c",*inBuff);
+ usLength--;
+ inBuff++;
+ }
+ return -1;
+ }
+
+ return (int)ret;
+
+}
+
+void CLI_Configure(void)
+{
+ uart.baud(115200);
+
+ RTOS_MUTEX_CREATE(&g_printLock);
+
+}
