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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Utils.h Source File

Utils.h

00001 #ifndef UTILS_H
00002 #define UTILS_H
00003 
00004 typedef unsigned char u8;
00005 typedef unsigned short u16;
00006 typedef unsigned long u32;
00007 
00008 void DelayMS(int ms);
00009 
00010 void printfBytes(const char* label,const u8* data, int len);
00011 void printHex(const u8* d, int len);
00012 //void printf(const BD_ADDR* addr);
00013 
00014 #ifndef min
00015 #define min(_a,_b) ((_a) < (_b) ? (_a) : (_b))
00016 #endif
00017 
00018 inline int LE16(const u8* d)
00019 {
00020     return d[0] | (d[1] << 8);
00021 }
00022 
00023 inline u32 BE32(const u8* d)
00024 {
00025     return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
00026 }
00027 
00028 inline void BE32(u32 n, u8* d)
00029 {
00030     d[0] = (u8)(n >> 24);
00031     d[1] = (u8)(n >> 16);
00032     d[2] = (u8)(n >> 8);
00033     d[3] = (u8)n;
00034 }
00035 
00036 inline void BE16(u32 n, u8* d)
00037 {
00038     d[0] = (u8)(n >> 8);
00039     d[1] = (u8)n;
00040 }
00041 
00042 #endif