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: TextLCD MbedJSONValue libMotiv picojson mbed-rtos mbed
Fork of Mbed_MotiVControllerBox by
Diff: Controller.cpp
- Revision:
- 0:2279181caaa1
diff -r 000000000000 -r 2279181caaa1 Controller.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Controller.cpp Sat Oct 25 00:11:12 2014 +0000
@@ -0,0 +1,56 @@
+#include <string>
+#include "TextLCD.h"
+#include "Controller.h"
+
+Controller::Controller(TextLCD *lcd):
+ _status(WAITING)
+{
+ _lcd = lcd;
+ //setStatus(WAITING);
+ displayStatus();
+}
+
+Controller::cStatus Controller::getStatus()
+{
+ return _status;
+}
+
+string Controller::statusString()
+{
+ switch(_status) {
+ case READY:
+ return "ready";
+
+ case WAITING:
+ return "waiting";
+
+ case BUSY:
+ return "busy";
+
+ case ERROR:
+ return "error";
+
+ default:
+ return "unknown";
+ }
+}
+
+void Controller::setStatus(cStatus status)
+{
+ _status = status;
+ displayStatus();
+}
+
+void Controller::displayStatus()
+{
+ _lcd->locate(0,0);
+ _lcd->clearLine();
+ _lcd->locate(0,0);
+ _lcd->printf("Status: %s", statusString());
+}
+
+void Controller::displWriteLine(int row, char c)
+{
+ _lcd->locate(0,row);
+ _lcd->printf("%c", c);
+}
\ No newline at end of file
