]> mj.ucw.cz Git - home-hw.git/blobdiff - lib/util.h
Power daemon: A new daemon for relaying power meter data to MQTT
[home-hw.git] / lib / util.h
index b06b6add070627072e181fbfb9d04bc793a06185..b37c527f603f9003373c97bd4f85d0f753f4ac70 100644 (file)
@@ -23,6 +23,7 @@ typedef int32_t s32;
 
 #define MIN(x,y) ((x) < (y) ? (x) : (y))
 #define MAX(x,y) ((x) > (y) ? (x) : (y))
+#define CLAMP(x,min,max) ({ typeof(x) _t=x; (_t < min) ? min : (_t > max) ? max : _t; })
 
 #define UNUSED __attribute__((unused))
 
@@ -76,8 +77,11 @@ static inline void put_u32_le(byte *p, u32 x)
        p[0] = x & 0xff;
 }
 
-// debug.c
+// util-debug.c
 
 void debug_printf(const char *fmt, ...);
 void debug_puts(const char *s);
 void debug_putc(int c);
+
+void debug_led(bool light);
+void debug_led_toggle(void);