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: BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
print.h
00001 // print.h - print value of a characteristic 00002 // 00003 // Synopsis: 00004 // 00005 // See also: CHARACTERISTIC, GET, SET 00006 // 00007 #ifndef _PRINT_H_ 00008 #define _PRINT_H_ 00009 00010 #include "ble/Gap.h" 00011 #include "bricks/o.h" 00012 #include "bricks/types.h" 00013 #include "bricks/characteristic.h" 00014 00015 //============================================================================== 00016 // Some Callbacks 00017 //============================================================================== 00018 00019 inline void print(O&o, Characteristic<Buffer> &chr, const char *name) 00020 { 00021 Serial out(USBTX, USBRX); // serial port to PC terminal 00022 00023 Buffer data; uint8_t *p = data; 00024 get(o,chr,data); 00025 00026 out.printf("%s: %02x-%02x-%02x-%02x-%02x-",name,(int)(p[0]),(int)(p[1]),(int)(p[2]),(int)(p[3]),(int)(p[4])); 00027 out.printf("%02x-%02x-%02x-%02x-%02x\r\n",(int)(p[5]),(int)(p[6]),(int)(p[7]),(int)(p[8]),(int)(p[9])); 00028 } 00029 00030 inline void print(O&o, Characteristic<Bool> &chr, const char *name) 00031 { 00032 Serial out(USBTX, USBRX); // serial port to PC terminal 00033 Bool data; 00034 00035 get(o,chr,data); 00036 out.printf("%s: %02x\r\n",name,(int)data); 00037 } 00038 00039 // we provide also some PRINT methods for non Characteristics. If the value of 00040 // a characteristic needs to be printed the value must be fetched before with 00041 // the GET function. 00042 00043 inline void print(O&o, Bool data, const char *name) 00044 { 00045 Serial out(USBTX, USBRX); // serial port to PC terminal 00046 out.printf("%s: %02x\r\n",(int)&data); 00047 } 00048 00049 #endif // _PRINT_H_
Generated on Tue Jul 12 2022 21:31:05 by
1.7.2
