diff options
Diffstat (limited to '02-usart/include/common.h')
-rw-r--r-- | 02-usart/include/common.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/02-usart/include/common.h b/02-usart/include/common.h index f9cbe06..394dc62 100644 --- a/02-usart/include/common.h +++ b/02-usart/include/common.h @@ -17,6 +17,8 @@ #define __IO volatile #endif +#define CTZ(n) __builtin_ctz(n) + #define bool int #ifndef __cplusplus #define true 1 @@ -39,4 +41,7 @@ typedef __IO uint32_t bits_t; +#define regset(reg, mask, val) \ + (reg = (reg & ~mask) | (val << CTZ(mask))) + #endif /* COMMON_H */ |