Modificación para implementar SoftSerial
Dependents: neurGAI_Seeed_BLUETOOTH TFG
Fork of BluetoothSerial by
Revision 1:267fd413fd16, committed 2015-12-09
- Comitter:
- gbm
- Date:
- Wed Dec 09 11:16:13 2015 +0000
- Parent:
- 0:f56002898ee8
- Commit message:
- Modificaci?n de BluetoothSerial para implementar comunicaci?n SoftSerial
Changed in this revision
BluetoothSerial.cpp | Show annotated file Show diff for this revision Revisions of this file |
BluetoothSerial.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f56002898ee8 -r 267fd413fd16 BluetoothSerial.cpp --- a/BluetoothSerial.cpp Thu Feb 20 03:30:43 2014 +0000 +++ b/BluetoothSerial.cpp Wed Dec 09 11:16:13 2015 +0000 @@ -2,7 +2,7 @@ #include "BluetoothSerial.h" #include <string.h> -#define LOG(args...) // std::printf(args) +#define LOG(args...) // std::printf(args) BluetoothSerial::BluetoothSerial(PinName tx, PinName rx) : _serial(tx, rx) { @@ -40,7 +40,7 @@ const char *prefix = "CONNECT:"; uint8_t prefix_len = sizeof("CONNECT:") - 1; for (uint8_t i = 0; i < 12; i++) { - int len = readline(_buf, sizeof(_buf)); + int len = readline(_buf, sizeof(_buf), 1); if (len > 0) { LOG("%s\r\n", _buf); if (!memcmp(_buf, prefix, prefix_len)) { // check prefix
diff -r f56002898ee8 -r 267fd413fd16 BluetoothSerial.h --- a/BluetoothSerial.h Thu Feb 20 03:30:43 2014 +0000 +++ b/BluetoothSerial.h Wed Dec 09 11:16:13 2015 +0000 @@ -6,6 +6,7 @@ #define __BLUETOOTH_SERIAL_H__ #include "mbed.h" +#include "SoftSerial.h" #define BLUETOOTH_SERIAL_DEFAULT_BAUD 38400 #define BLUETOOTH_SERIAL_TIMEOUT 10000 @@ -62,7 +63,7 @@ void clear(); int readline(uint8_t *buf, int len, uint32_t timeout = 0); - Serial _serial; + SoftSerial _serial; uint8_t _buf[64]; };