![](/media/cache/profiles/83bdd5a91e556ca3b57aafab83ee8ef5.50x50_q85.jpg)
for PS3 Controller Special thanks to robo8080 http://blog.goo.ne.jp/roboz80/e/10e7bf38d3a63b996ca2894e9fb5e3b6
Dependencies: FatFileSystem mbed
Fork of PS3_BlueUSB by
Utils.h@1:469717149e71, 2015-09-23 (annotated)
- Committer:
- ds074704261
- Date:
- Wed Sep 23 09:02:41 2015 +0000
- Revision:
- 1:469717149e71
- Parent:
- 0:99a111b75cb4
hotfix
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
BartJanssens | 0:99a111b75cb4 | 1 | |
BartJanssens | 0:99a111b75cb4 | 2 | typedef unsigned char u8; |
BartJanssens | 0:99a111b75cb4 | 3 | typedef unsigned short u16; |
BartJanssens | 0:99a111b75cb4 | 4 | typedef unsigned long u32; |
BartJanssens | 0:99a111b75cb4 | 5 | |
BartJanssens | 0:99a111b75cb4 | 6 | void DelayMS(int ms); |
BartJanssens | 0:99a111b75cb4 | 7 | |
BartJanssens | 0:99a111b75cb4 | 8 | void printfBytes(const char* label,const u8* data, int len); |
BartJanssens | 0:99a111b75cb4 | 9 | void printHex(const u8* d, int len); |
BartJanssens | 0:99a111b75cb4 | 10 | |
BartJanssens | 0:99a111b75cb4 | 11 | #ifndef min |
BartJanssens | 0:99a111b75cb4 | 12 | #define min(_a,_b) ((_a) < (_b) ? (_a) : (_b)) |
BartJanssens | 0:99a111b75cb4 | 13 | #endif |
BartJanssens | 0:99a111b75cb4 | 14 | |
BartJanssens | 0:99a111b75cb4 | 15 | inline int LE16(const u8* d) |
BartJanssens | 0:99a111b75cb4 | 16 | { |
BartJanssens | 0:99a111b75cb4 | 17 | return d[0] | (d[1] << 8); |
BartJanssens | 0:99a111b75cb4 | 18 | } |
BartJanssens | 0:99a111b75cb4 | 19 | |
BartJanssens | 0:99a111b75cb4 | 20 | inline u32 BE32(const u8* d) |
BartJanssens | 0:99a111b75cb4 | 21 | { |
BartJanssens | 0:99a111b75cb4 | 22 | return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3]; |
BartJanssens | 0:99a111b75cb4 | 23 | } |
BartJanssens | 0:99a111b75cb4 | 24 | |
BartJanssens | 0:99a111b75cb4 | 25 | inline void BE32(u32 n, u8* d) |
BartJanssens | 0:99a111b75cb4 | 26 | { |
BartJanssens | 0:99a111b75cb4 | 27 | d[0] = (u8)(n >> 24); |
BartJanssens | 0:99a111b75cb4 | 28 | d[1] = (u8)(n >> 16); |
BartJanssens | 0:99a111b75cb4 | 29 | d[2] = (u8)(n >> 8); |
BartJanssens | 0:99a111b75cb4 | 30 | d[3] = (u8)n; |
BartJanssens | 0:99a111b75cb4 | 31 | } |
BartJanssens | 0:99a111b75cb4 | 32 | |
BartJanssens | 0:99a111b75cb4 | 33 | inline void BE16(u32 n, u8* d) |
BartJanssens | 0:99a111b75cb4 | 34 | { |
BartJanssens | 0:99a111b75cb4 | 35 | d[0] = (u8)(n >> 8); |
BartJanssens | 0:99a111b75cb4 | 36 | d[1] = (u8)n; |
BartJanssens | 0:99a111b75cb4 | 37 | } |