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 myUSBHost AvailableMemory
Dependents: mbed_TANK_Kinect myBlueUSB_ros ftusbClass
Diff: btserial.h
- Revision:
- 6:567607a9a79f
- Parent:
- 3:50196dce45f8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/btserial.h Sat Jun 11 19:45:42 2011 +0000
@@ -0,0 +1,31 @@
+#ifndef BTSERIAL_H
+#define BTSERIAL_H
+#include "mbed.h"
+#include "RFCOMM.h"
+
+class btserial {
+ static const int bufsize = 127;
+ int sock;
+ unsigned char sendbuf[bufsize], recbuf[bufsize];
+ int sendptr, recptrin, recptrout, free;
+ static void cb(int socket, SocketState state, const unsigned char *data, int len, void* userData);
+ void stash(const unsigned char *data, int len);
+ bool open;
+public:
+ btserial(char ba[6], char ch);//outgoing
+ btserial(char ch);//incoming
+ void baud(int);
+ void format(int, Serial::Parity, int);
+ int putc(int);
+ int getc();
+ int readable() {
+ if (!open) return -1;
+ return bufsize-free;
+ }
+ int writeable() {
+ if (!open) return -1;
+ return bufsize - sendptr;
+ }
+};
+
+#endif
\ No newline at end of file