![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Bluetooth Connected TOF Sensor
Dependencies: BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
Diff: bricks/print.h
- Revision:
- 27:32267cee7cb8
- Parent:
- 24:0f08f68579bd
diff -r fd06c8b57d16 -r 32267cee7cb8 bricks/print.h --- a/bricks/print.h Sat Jan 07 15:38:15 2017 +0000 +++ b/bricks/print.h Sat Jan 14 08:43:14 2017 +0000 @@ -8,21 +8,42 @@ #define _PRINT_H_ #include "ble/Gap.h" -#include "bricks/blob.h" +#include "bricks/o.h" +#include "bricks/types.h" +#include "bricks/characteristic.h" //============================================================================== // Some Callbacks //============================================================================== - inline void print(Blob &blue, GattCharacteristic &chr, const char *name) + inline void print(O&o, Characteristic<Buffer> &chr, const char *name) { Serial out(USBTX, USBRX); // serial port to PC terminal Buffer data; uint8_t *p = data; - blue.get(chr,data); + get(o,chr,data); out.printf("%s: %02x-%02x-%02x-%02x-%02x-",name,(int)(p[0]),(int)(p[1]),(int)(p[2]),(int)(p[3]),(int)(p[4])); out.printf("%02x-%02x-%02x-%02x-%02x\r\n",(int)(p[5]),(int)(p[6]),(int)(p[7]),(int)(p[8]),(int)(p[9])); } + inline void print(O&o, Characteristic<Bool> &chr, const char *name) + { + Serial out(USBTX, USBRX); // serial port to PC terminal + Bool data; + + get(o,chr,data); + out.printf("%s: %02x\r\n",name,(int)data); + } + +// we provide also some PRINT methods for non Characteristics. If the value of +// a characteristic needs to be printed the value must be fetched before with +// the GET function. + + inline void print(O&o, Bool data, const char *name) + { + Serial out(USBTX, USBRX); // serial port to PC terminal + out.printf("%s: %02x\r\n",(int)&data); + } + #endif // _SET_H_ \ No newline at end of file