Convenience macros used across the project.
More...
|
| #define | BCD_TO_DEC(BCD) |
| | Converts a BCD-encoded byte to its decimal equivalent.
|
| #define | DEC_TO_BCD(DEC) |
| | Converts a decimal value to its BCD-encoded byte equivalent.
|
| #define | DELAY(ms) |
| | Blocking delay using the system tick counter.
|
Convenience macros used across the project.
◆ BCD_TO_DEC
| #define BCD_TO_DEC |
( |
| BCD | ) |
|
Value:(((BCD) >> 4) * 10 + ((BCD) & 0x0F))
Converts a BCD-encoded byte to its decimal equivalent.
- Parameters
-
| BCD | A byte where the upper nibble holds the tens digit and the lower nibble holds the units digit. |
Definition at line 47 of file common.h.
◆ DEC_TO_BCD
| #define DEC_TO_BCD |
( |
| DEC | ) |
|
Value:(((DEC / 10) << 4) | (DEC % 10))
Converts a decimal value to its BCD-encoded byte equivalent.
- Parameters
-
| DEC | A decimal integer value (0–99). |
Definition at line 54 of file common.h.
◆ DELAY
Value: do { \
} \
} while (0)
uint32_t systick_get_ms(void)
Returns the number of milliseconds elapsed since SysTick was initialized.
Blocking delay using the system tick counter.
Spins until ms milliseconds have elapsed since the macro was entered. Requires systick_get_ms() to be available in scope.
- Parameters
-
| ms | Number of milliseconds to wait. |
Definition at line 65 of file common.h.
65#define DELAY(ms) \
66 do { \
67 uint32_t delay_start_time = systick_get_ms(); \
68 while ((systick_get_ms() - delay_start_time) < (ms)) { \
69 } \
70 } while (0)