update macros and headers

This commit is contained in:
hugogogo
2025-03-08 16:13:30 +01:00
parent 18be7948dd
commit 1be3750300
2 changed files with 5 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
{
"files.associations": {
"io.h": "c",
"delay.h": "c"
"delay.h": "c",
"interrupt.h": "c"
}
}

View File

@@ -5,6 +5,9 @@
// mathematics
#define DIV_ROUND_CLOSEST(n, d) ((((n) < 0) == ((d) < 0)) ? (((n) + (d)/2)/(d)) : (((n) - (d)/2)/(d))) // https://stackoverflow.com/a/18067292
// text
#define SWITCH_CASE(ch) (((ch) >= 'A' && (ch) <= 'Z') || ((ch) >= 'a' && (ch) <= 'z') ? ((ch) ^ (1 << 5)) : (ch))
// stringify
#define STRINGIFY_HELPER(x) #x
#define STRINGIFY(x) STRINGIFY_HELPER(x)
@@ -115,9 +118,6 @@
#define INTERRUPT_ENABLE_CHANNEL_A (1 << OCIE1A)
#define INTERRUPT_DISABLE_CHANNEL_A (0 << OCIE1A)
// text
#define SWITCH_CASE(ch) (((ch) >= 'A' && (ch) <= 'Z') || ((ch) >= 'a' && (ch) <= 'z') ? ((ch) ^ (1 << 5)) : (ch))
// END MACROS
void uart_init() {