diff --git a/.vscode/settings.json b/.vscode/settings.json index baa76ba..af4ab8e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "files.associations": { "io.h": "c", - "delay.h": "c" + "delay.h": "c", + "interrupt.h": "c" } } diff --git a/module02/ex04/main.c b/module02/ex04/main.c index d059e96..0207079 100644 --- a/module02/ex04/main.c +++ b/module02/ex04/main.c @@ -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() {