test
Dependencies: mbed KondoServoLibrary Encoder
Utils.h@21:0f12ee2322e4, 2020-03-12 (annotated)
- Committer:
- koheim
- Date:
- Thu Mar 12 07:32:03 2020 +0000
- Revision:
- 21:0f12ee2322e4
- Parent:
- 0:736c76a75def
a;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirokimineshita | 0:736c76a75def | 1 | |
hirokimineshita | 0:736c76a75def | 2 | typedef unsigned char u8; |
hirokimineshita | 0:736c76a75def | 3 | typedef unsigned short u16; |
hirokimineshita | 0:736c76a75def | 4 | typedef unsigned long u32; |
hirokimineshita | 0:736c76a75def | 5 | |
hirokimineshita | 0:736c76a75def | 6 | void DelayMS(int ms); |
hirokimineshita | 0:736c76a75def | 7 | |
hirokimineshita | 0:736c76a75def | 8 | void printfBytes(const char* label,const u8* data, int len); |
hirokimineshita | 0:736c76a75def | 9 | void printHex(const u8* d, int len); |
hirokimineshita | 0:736c76a75def | 10 | |
hirokimineshita | 0:736c76a75def | 11 | #ifndef min |
hirokimineshita | 0:736c76a75def | 12 | #define min(_a,_b) ((_a) < (_b) ? (_a) : (_b)) |
hirokimineshita | 0:736c76a75def | 13 | #endif |
hirokimineshita | 0:736c76a75def | 14 | |
hirokimineshita | 0:736c76a75def | 15 | |
hirokimineshita | 0:736c76a75def | 16 | inline int LE16(const u8* d) |
hirokimineshita | 0:736c76a75def | 17 | { |
hirokimineshita | 0:736c76a75def | 18 | return d[0] | (d[1] << 8); |
hirokimineshita | 0:736c76a75def | 19 | } |
hirokimineshita | 0:736c76a75def | 20 | |
hirokimineshita | 0:736c76a75def | 21 | inline u32 BE32(const u8* d) |
hirokimineshita | 0:736c76a75def | 22 | { |
hirokimineshita | 0:736c76a75def | 23 | return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3]; |
hirokimineshita | 0:736c76a75def | 24 | } |
hirokimineshita | 0:736c76a75def | 25 | |
hirokimineshita | 0:736c76a75def | 26 | inline void BE32(u32 n, u8* d) |
hirokimineshita | 0:736c76a75def | 27 | { |
hirokimineshita | 0:736c76a75def | 28 | d[0] = (u8)(n >> 24); |
hirokimineshita | 0:736c76a75def | 29 | d[1] = (u8)(n >> 16); |
hirokimineshita | 0:736c76a75def | 30 | d[2] = (u8)(n >> 8); |
hirokimineshita | 0:736c76a75def | 31 | d[3] = (u8)n; |
hirokimineshita | 0:736c76a75def | 32 | } |
hirokimineshita | 0:736c76a75def | 33 | |
hirokimineshita | 0:736c76a75def | 34 | inline void BE16(u32 n, u8* d) |
hirokimineshita | 0:736c76a75def | 35 | { |
hirokimineshita | 0:736c76a75def | 36 | d[0] = (u8)(n >> 8); |
hirokimineshita | 0:736c76a75def | 37 | d[1] = (u8)n; |
hirokimineshita | 0:736c76a75def | 38 | } |