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.
Dependents: telemetry_car_demo telemetry_demo_FRDM-TFC telemetry_example_01 telemetry_indexed_data_demo ... more
Diff: driver.cpp
- Revision:
- 2:b7a3ac7bcec8
- Parent:
- 1:e51abb43c074
diff -r e51abb43c074 -r b7a3ac7bcec8 driver.cpp
--- a/driver.cpp Thu Jan 28 10:00:45 2016 +0000
+++ b/driver.cpp Thu Feb 11 08:10:08 2016 +0000
@@ -1,7 +1,7 @@
-#include "MODSERIAL.h"
+#include "BufferedSerial.h"
#include "driver.hpp"
-static MODSERIAL pc(USBTX, USBRX);
+static BufferedSerial pc(USBTX, USBRX);
// Physical driver
@@ -11,21 +11,17 @@
return 1;
}
-int32_t readable()
-{
- return pc.rxBufferGetCount();
-}
-
int32_t write(void * buf, uint32_t sizeToWrite)
{
- char * ptr = (char *)buf;
- for(uint32_t i = 0 ; i < sizeToWrite ; i++)
- {
- pc.putc(ptr[i]);
- }
+ pc.write(buf,sizeToWrite);
return 0;
}
+int32_t readable()
+{
+ return pc.readable();
+}
+
int32_t writeable()
{
return pc.writeable();
@@ -33,7 +29,7 @@
// C++ interface
-Telemetry::Telemetry(TM_state* userData)
+Telemetry::Telemetry(TM_state* userData, uint32_t bauds)
{
transport.read = read;
transport.write = write;
@@ -42,7 +38,7 @@
init_telemetry(userData, &transport);
- pc.baud(9600);
+ pc.baud(bauds);
}
uint32_t Telemetry::cast(TM_msg * m, char * buf, size_t bufSize)