主導機 mbed用のプログラムです

Dependencies:   mbed

Fork of F3RC_syudou_master by F3RC1班

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Utils.h Source File

Utils.h

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