diff options
author | Christian Cunningham <cc@localhost> | 2021-12-04 17:09:22 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2021-12-04 17:09:22 -0700 |
commit | 1c6cd8e1ea53275cc44b2a0ee5a8448cbc4a3f0d (patch) | |
tree | 8ba9eed6acebbd0940898e5c46b35caed7e03792 /src/drivers/uart.c | |
parent | 0ee2aaaa26441e37ed27e6c83cf9b65202596a4e (diff) |
Restructured project
Diffstat (limited to 'src/drivers/uart.c')
-rw-r--r-- | src/drivers/uart.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/drivers/uart.c b/src/drivers/uart.c new file mode 100644 index 0000000..f7f15c2 --- /dev/null +++ b/src/drivers/uart.c @@ -0,0 +1,22 @@ +#include "uart.a.h" + +void uart_hexn(unsigned long c_val) { + uart_hex(c_val); + uart_char(0x0a); +} + +void uart_10(unsigned long val) { + unsigned long t = val; + unsigned long c; + char buffer[11] = "0000000000\0"; + char* dptr = buffer + 9; + for(int i = 0; i <= 10; i++) { + c = t%10; + *dptr = 0x30 + (c&0xF); + t /= 10; + if (t==0) + break; + dptr -= 1; + } + uart_string(dptr); +} |