From: Martin Mares Date: Mon, 8 Jul 2019 17:23:09 +0000 (+0200) Subject: Library: Comments X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=d910e34d0deecc4af18cf98377479cdfb78eac31;p=home-hw.git Library: Comments --- diff --git a/lib/util-debug.c b/lib/util-debug.c index e47ff46..ed1076d 100644 --- a/lib/util-debug.c +++ b/lib/util-debug.c @@ -1,3 +1,9 @@ +/* + * Debugging Utilities for STM32 + * + * (c) 2018--2019 Martin Mareš + */ + #include "util.h" #include diff --git a/lib/util.h b/lib/util.h index a84d099..b06b6ad 100644 --- a/lib/util.h +++ b/lib/util.h @@ -1,9 +1,17 @@ +/* + * General Utility Library for STM32 + * + * (c) 2018--2019 Martin Mareš + */ + #include #include #include #include "config.h" +// Types + typedef unsigned int uint; typedef uint8_t byte; typedef uint16_t u16; @@ -11,11 +19,15 @@ typedef int16_t s16; typedef uint32_t u32; typedef int32_t s32; +// Macros + #define MIN(x,y) ((x) < (y) ? (x) : (y)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) #define UNUSED __attribute__((unused)) +// Unaligned access to data + static inline uint get_u16_le(byte *p) { return (p[1] << 8) | p[0];