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