local fix version of myBlueUSB (http://mbed.org/users/networker/code/myBlueUSB/). - merge deleted files which are required to compile. - enable echo back of received data via RFCOMM.
Dependencies: AvailableMemory FatFileSystem mbed myUSBHost
Utils.h@2:9f25a7fa1a54, 2013-12-08 (annotated)
- Committer:
- nobukuma
- Date:
- Sun Dec 08 21:52:09 2013 +0000
- Revision:
- 2:9f25a7fa1a54
- Parent:
- 0:003889bc474f
???BT??????????????????; ?????????????????
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 |