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: Adafruit-PWM-Servo-Driver MPU6050 RS300 mbed
Diff: SCI.cpp
- Revision:
- 12:6cd135bf03bd
- Child:
- 13:711f74b2fa33
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SCI.cpp Sun Feb 03 04:53:44 2013 +0000
@@ -0,0 +1,60 @@
+#include "mbed.h"
+#include "SCI.h"
+
+SCI::SCI(PinName tx, PinName rx)
+{
+ serial = new Serial(tx, rx);
+}
+
+SCI::~SCI()
+{
+ delete serial;
+}
+
+char SCI::getid()
+{
+ char comm, id;
+ comm = getc_nowait();
+ if (comm == 'A') {
+ serial->putc(comm);
+ serial->printf("command");
+ id = getc_wait();
+ }
+ return id;
+}
+
+char SCI::getc_wait()
+{
+ while (!serial->readable()) {
+ serial->printf("waiting..");
+ }
+ return serial->getc();
+}
+
+char SCI::getc_nowait()
+{
+ uint8_t buf = 0;
+ if (serial->readable()) {
+ buf = serial->getc();
+ }
+ return buf;
+}
+
+/*uint16_t readint(void)
+{
+ uint8_t buff[16];
+ buff[0] = pc->getc();
+ buff[1] = pc->getc();
+ uint16_t val;
+ val = (uint16_t)(buff[1] << 8) | (uint16_t)buff[0];
+ return val;
+}
+
+void sendint(uint16_t val)
+{
+ uint8_t buff[16];
+ buff[0] = (uint8_t)(val & 0x00FF);
+ buff[1] = (uint8_t)(val >> 8);
+ pc.putc(buff[0]);
+ pc.putc(buff[1]);
+}*/
\ No newline at end of file