]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - include/common.h
Merge branch 'cmdline_edit'
[z180-stamp.git] / include / common.h
index b0dd038e8775df2be44988733a352c2f07266dab..10c4417d8b0c147de15a20e142a81fb93265a9d6 100644 (file)
@@ -1,3 +1,9 @@
+/*
+ * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
 #ifndef COMMON_H
 #define COMMON_H
 
@@ -46,6 +52,12 @@ struct bits {
 #define FSTR(X) ((const FLASH char[]) { X } )
 #define ARRAY_SIZE(x)  (sizeof(x) / sizeof((x)[0]))
 
+#define MIN(a,b)    ({ typeof (a) _a = (a);                                    \
+                                               typeof (b) _b = (b);                                   \
+                                               _a < _b ? _a : _b; })
+#define MAX(a,b)    ({ typeof (a) _a = (a);                                    \
+                                               typeof (b) _b = (b);                                   \
+                                               _a > _b ? _a : _b; })
 
 #ifdef __AVR__
 #define Stat GPIOR0
@@ -53,7 +65,7 @@ struct bits {
 extern volatile uint_least8_t Stat;
 #endif /* __AVR__ */
 
-#define S_10MS_TO      (1<<0)
+#define S_10MS_TO              (1<<0)
 #define S_MSG_PENDING  (1<<1)
 #define S_CON_PENDING  (1<<2)