aboutsummaryrefslogtreecommitdiff
path: root/include/libopenstm32/tools.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libopenstm32/tools.h')
-rw-r--r--include/libopenstm32/tools.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/libopenstm32/tools.h b/include/libopenstm32/tools.h
index 54c3ce7..2a7a0f1 100644
--- a/include/libopenstm32/tools.h
+++ b/include/libopenstm32/tools.h
@@ -51,7 +51,7 @@
* TODO: We may need a faster implementation of that one?
*/
#define TOG_SET_REG_BIT_MSK(REG, MSK, BIT) \
-{ \
+do { \
register u16 toggle_mask = GET_REG(REG) & MSK; \
register u16 bit_selector; \
for (bit_selector = 1; bit_selector; bit_selector <<= 1) { \
@@ -59,6 +59,6 @@
toggle_mask ^= bit_selector; \
} \
SET_REG(REG, toggle_mask); \
-}
+} while(0)
#endif