aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/uart.c
blob: f6fe79b45c75d5336eb5bb25487f6b4c389cb915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <drivers/uart.h>

void uart_10(unsigned long val)
{
	unsigned long t = val;
	unsigned long c;
	static 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);
}

void uart_hexn(unsigned long c_val)
{
	uart_hex(c_val);
	uart_char('\n');
}