Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos 4DGL-uLCD-SE RPCInterface
Diff: main.cpp
- Revision:
- 13:f1649dc31b04
- Parent:
- 12:f1856a0b8ced
- Child:
- 14:5b3f49d7bf19
--- a/main.cpp Tue Nov 12 19:21:49 2019 +0000 +++ b/main.cpp Tue Nov 12 19:27:35 2019 +0000 @@ -4,20 +4,26 @@ #include "mbed_rpc.h" #include "uLCD_4DGL.h" +/* Example RPC commands that have currently been implemented + +/writeLCD/run Hello_world +/setTime/run 1256729737 + +*/ + uLCD_4DGL uLCD(p9,p10,p11); // serial tx, serial rx, reset pin; Serial bluetooth(p13,p14); Serial pc(USBTX, USBRX); -Mutex stdio_mutex; -Mutex lcd_mutex; +Mutex stdio_mutex; //mutex used when accessing stdio functions +Mutex lcd_mutex; //mutex used when accessing the bluetooth serial object -Thread bluetooth_thread; -Thread time_thread; +Thread bluetooth_thread; //thread responsible for receiving rpc commands over bluetooth +Thread time_thread; //thread responsible for updating the lcd with the current time +//rpc function prototypes void writeLCD(Arguments *in, Reply *out); void setTime (Arguments *in, Reply *out); - -//rpc function prototypes RPCFunction rpcWriteLCD(&writeLCD, "writeLCD"); RPCFunction rpcSetTime(&setTime, "setTime"); @@ -58,12 +64,12 @@ while(true) { //Thread::wait(20); - if (pc.readable() == true) { + if (pc.readable() == true) { //comment out when using bluetooth to receive rpc commands //if (bluetooth.readable() == true) { stdio_mutex.lock(); - buf[buf_pos] = pc.getc(); + buf[buf_pos] = pc.getc(); //comment out when using bluetooth to receive rpc commands //buf[buf_pos] = bluetooth.getc(); stdio_mutex.unlock();