aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/include
diff options
context:
space:
mode:
Diffstat (limited to 'wirish/include')
-rw-r--r--wirish/include/wirish/ext_interrupts.h4
-rw-r--r--wirish/include/wirish/wirish.h9
-rw-r--r--wirish/include/wirish/wirish_math.h3
3 files changed, 11 insertions, 5 deletions
diff --git a/wirish/include/wirish/ext_interrupts.h b/wirish/include/wirish/ext_interrupts.h
index ce1ca03..7b82c40 100644
--- a/wirish/include/wirish/ext_interrupts.h
+++ b/wirish/include/wirish/ext_interrupts.h
@@ -106,7 +106,7 @@ void detachInterrupt(uint8 pin);
*
* @see noInterrupts()
*/
-static __always_inline void interrupts() {
+static inline void interrupts() {
nvic_globalirq_enable();
}
@@ -120,7 +120,7 @@ static __always_inline void interrupts() {
*
* @see interrupts()
*/
-static __always_inline void noInterrupts() {
+static inline void noInterrupts() {
nvic_globalirq_disable();
}
diff --git a/wirish/include/wirish/wirish.h b/wirish/include/wirish/wirish.h
index 610aa3f..606aac0 100644
--- a/wirish/include/wirish/wirish.h
+++ b/wirish/include/wirish/wirish.h
@@ -58,8 +58,13 @@
/* Wiring macros and bit defines */
-#define true 0x1
-#define false 0x0
+// These may have been defined if stdbool.h was included
+#ifndef true
+# define true 0x1
+#endif
+#ifndef false
+# define false 0x0
+#endif
#define LSBFIRST 0
#define MSBFIRST 1
diff --git a/wirish/include/wirish/wirish_math.h b/wirish/include/wirish/wirish_math.h
index 39f16a0..ff264dc 100644
--- a/wirish/include/wirish/wirish_math.h
+++ b/wirish/include/wirish/wirish_math.h
@@ -93,7 +93,8 @@ static inline long map(long value, long fromStart, long fromEnd,
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
-#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
+#define round(x) ((x)>=0?(long)((x)+(double)0.5):(long)((x)-(double)0.5))
+#define roundf(x) ((x)>=0?(long)((x)+(float)0.5):(long)((x)-(float)0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))