X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=Inc%2Futil.h;h=827cc9c4a09082cf23336f38c7de54c5b3de9ace;hb=dc36490487b59b620ccaac0de36f1ebfa254e7d3;hp=07a677bb97cf3845b520d93b567f447c465ca2dd;hpb=2d024d38ea3094cf50ef92e00589fb56a066ea9a;p=home-hw.git diff --git a/Inc/util.h b/Inc/util.h index 07a677b..827cc9c 100644 --- a/Inc/util.h +++ b/Inc/util.h @@ -1,4 +1,5 @@ #include +#include typedef unsigned int uint; typedef uint8_t byte; @@ -10,6 +11,17 @@ typedef int32_t s32; #define MIN(x,y) ((x) < (y) ? (x) : (y)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) +static inline uint get_u16_le(byte *p) +{ + return (p[1] << 8) | p[0]; +} + +static inline void put_u16_le(byte *p, u16 x) +{ + p[0] = x; + p[1] = x >> 8; +} + // debug.c #define DEBUG_SEMIHOSTING