Pulse Oximeter (NONIN) communicates with mbed via Bluetooth dongle and sends Heart Rate and Oxygen Saturation via GPRS module
Dependencies: C12832 GPS GSM mbed
Fork of myBlueUSB_localfix by
Utils.h@3:55a622e3dbb5, 2015-04-14 (annotated)
- Committer:
- samialshorman
- Date:
- Tue Apr 14 21:48:07 2015 +0000
- Revision:
- 3:55a622e3dbb5
- Parent:
- 0:003889bc474f
Nonin (Pulse Oximeter) connected to mbed lpc 1768 by Bluetooth dongle and sends SMS including Heart Rate and Oxygen saturation by GPRS module
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nobukuma | 0:003889bc474f | 1 | #ifndef UTILS_H |
nobukuma | 0:003889bc474f | 2 | #define UTILS_H |
nobukuma | 0:003889bc474f | 3 | |
nobukuma | 0:003889bc474f | 4 | typedef unsigned char u8; |
nobukuma | 0:003889bc474f | 5 | typedef unsigned short u16; |
nobukuma | 0:003889bc474f | 6 | typedef unsigned long u32; |
nobukuma | 0:003889bc474f | 7 | |
nobukuma | 0:003889bc474f | 8 | void DelayMS(int ms); |
nobukuma | 0:003889bc474f | 9 | |
nobukuma | 0:003889bc474f | 10 | void printfBytes(const char* label,const u8* data, int len); |
nobukuma | 0:003889bc474f | 11 | void printHex(const u8* d, int len); |
nobukuma | 0:003889bc474f | 12 | //void printf(const BD_ADDR* addr); |
nobukuma | 0:003889bc474f | 13 | |
nobukuma | 0:003889bc474f | 14 | #ifndef min |
nobukuma | 0:003889bc474f | 15 | #define min(_a,_b) ((_a) < (_b) ? (_a) : (_b)) |
nobukuma | 0:003889bc474f | 16 | #endif |
nobukuma | 0:003889bc474f | 17 | |
nobukuma | 0:003889bc474f | 18 | inline int LE16(const u8* d) |
nobukuma | 0:003889bc474f | 19 | { |
nobukuma | 0:003889bc474f | 20 | return d[0] | (d[1] << 8); |
nobukuma | 0:003889bc474f | 21 | } |
nobukuma | 0:003889bc474f | 22 | |
nobukuma | 0:003889bc474f | 23 | inline u32 BE32(const u8* d) |
nobukuma | 0:003889bc474f | 24 | { |
nobukuma | 0:003889bc474f | 25 | return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3]; |
nobukuma | 0:003889bc474f | 26 | } |
nobukuma | 0:003889bc474f | 27 | |
nobukuma | 0:003889bc474f | 28 | inline void BE32(u32 n, u8* d) |
nobukuma | 0:003889bc474f | 29 | { |
nobukuma | 0:003889bc474f | 30 | d[0] = (u8)(n >> 24); |
nobukuma | 0:003889bc474f | 31 | d[1] = (u8)(n >> 16); |
nobukuma | 0:003889bc474f | 32 | d[2] = (u8)(n >> 8); |
nobukuma | 0:003889bc474f | 33 | d[3] = (u8)n; |
nobukuma | 0:003889bc474f | 34 | } |
nobukuma | 0:003889bc474f | 35 | |
nobukuma | 0:003889bc474f | 36 | inline void BE16(u32 n, u8* d) |
nobukuma | 0:003889bc474f | 37 | { |
nobukuma | 0:003889bc474f | 38 | d[0] = (u8)(n >> 8); |
nobukuma | 0:003889bc474f | 39 | d[1] = (u8)n; |
nobukuma | 0:003889bc474f | 40 | } |
nobukuma | 0:003889bc474f | 41 | |
nobukuma | 0:003889bc474f | 42 | #endif |