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 TrapezoidControl QEI
Diff: Communication/Controller/Mu/Mu.cpp
- Revision:
- 0:669ef71cba68
- Child:
- 1:b1219d8ca117
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Communication/Controller/Mu/Mu.cpp Sat Sep 08 06:05:22 2018 +0000
@@ -0,0 +1,33 @@
+#include "Mu.h"
+
+namespace MU {
+ Serial MuUart(MU_TX, MU_RX);
+
+ namespace {
+ char Group[][4] = {"01", "02", "03", "04"};
+ char Channel[][4] = {"08", "14", "1F", "2E"};
+ char DI[][4] = {"10", "20", "40", "80"};
+ char EI[][4] = {"01", "02", "04", "08"};
+ }
+
+ void Mu::SendCommand(char *command, char *value, uint8_t valueLength) {
+ MuUart.putc('@');
+ MuUart.putc(command[0]);
+ MuUart.putc(command[1]);
+ while(valueLength--) {
+ MuUart.putc(*value);
+ value++;
+ }
+ MuUart.putc('\r');
+ MuUart.putc('\n');
+ }
+
+ void Mu::Initialize(uint8_t select) {
+ MuUart.baud(19200);
+
+ Mu::SendCommand("GI",Group[select],2);
+ Mu::SendCommand("CH",Channel[select],2);
+ Mu::SendCommand("DI",DI[select],2);
+ Mu::SendCommand("EI",EI[select],2);
+ }
+}