This is a for debugging \\\\\\\"BLUE USB\\\\\\\". You can connect with HCI mode. How to connect White Wizard Board TANK *White Wizard Board - Motor Driver Board * p 21 - IN_R1 * p 22 - IN_R2 * p 23 - IN_L2 * p 24 - IN_L1
Utils.h@1:c56059923036, 2011-08-31 (annotated)
- Committer:
- halfpitch
- Date:
- Wed Aug 31 11:10:18 2011 +0000
- Revision:
- 1:c56059923036
- Parent:
- 0:a6476c138e84
Rev.B
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
halfpitch | 0:a6476c138e84 | 1 | |
halfpitch | 0:a6476c138e84 | 2 | typedef unsigned char u8; |
halfpitch | 0:a6476c138e84 | 3 | typedef unsigned short u16; |
halfpitch | 0:a6476c138e84 | 4 | typedef unsigned long u32; |
halfpitch | 0:a6476c138e84 | 5 | |
halfpitch | 0:a6476c138e84 | 6 | void DelayMS(int ms); |
halfpitch | 0:a6476c138e84 | 7 | |
halfpitch | 0:a6476c138e84 | 8 | void printfBytes(const char* label,const u8* data, int len); |
halfpitch | 0:a6476c138e84 | 9 | void printHex(const u8* d, int len); |
halfpitch | 0:a6476c138e84 | 10 | |
halfpitch | 0:a6476c138e84 | 11 | #ifndef min |
halfpitch | 0:a6476c138e84 | 12 | #define min(_a,_b) ((_a) < (_b) ? (_a) : (_b)) |
halfpitch | 0:a6476c138e84 | 13 | #endif |
halfpitch | 0:a6476c138e84 | 14 | |
halfpitch | 0:a6476c138e84 | 15 | inline int LE16(const u8* d) |
halfpitch | 0:a6476c138e84 | 16 | { |
halfpitch | 0:a6476c138e84 | 17 | return d[0] | (d[1] << 8); |
halfpitch | 0:a6476c138e84 | 18 | } |
halfpitch | 0:a6476c138e84 | 19 | |
halfpitch | 0:a6476c138e84 | 20 | inline u32 BE32(const u8* d) |
halfpitch | 0:a6476c138e84 | 21 | { |
halfpitch | 0:a6476c138e84 | 22 | return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3]; |
halfpitch | 0:a6476c138e84 | 23 | } |
halfpitch | 0:a6476c138e84 | 24 | |
halfpitch | 0:a6476c138e84 | 25 | inline void BE32(u32 n, u8* d) |
halfpitch | 0:a6476c138e84 | 26 | { |
halfpitch | 0:a6476c138e84 | 27 | d[0] = (u8)(n >> 24); |
halfpitch | 0:a6476c138e84 | 28 | d[1] = (u8)(n >> 16); |
halfpitch | 0:a6476c138e84 | 29 | d[2] = (u8)(n >> 8); |
halfpitch | 0:a6476c138e84 | 30 | d[3] = (u8)n; |
halfpitch | 0:a6476c138e84 | 31 | } |
halfpitch | 0:a6476c138e84 | 32 | |
halfpitch | 0:a6476c138e84 | 33 | inline void BE16(u32 n, u8* d) |
halfpitch | 0:a6476c138e84 | 34 | { |
halfpitch | 0:a6476c138e84 | 35 | d[0] = (u8)(n >> 8); |
halfpitch | 0:a6476c138e84 | 36 | d[1] = (u8)n; |
halfpitch | 0:a6476c138e84 | 37 | } |