diff --git a/app/src/common.h b/app/src/common.h
index accbc615..ce9ccad4 100644
--- a/app/src/common.h
+++ b/app/src/common.h
@@ -7,6 +7,7 @@
 #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
 #define MIN(X,Y) (X) < (Y) ? (X) : (Y)
 #define MAX(X,Y) (X) > (Y) ? (X) : (Y)
+#define CLAMP(V,X,Y) MIN( MAX((V),(X)), (Y) )
 
 #define container_of(ptr, type, member) \
     ((type *) (((char *) (ptr)) - offsetof(type, member)))