mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-29 09:30:58 +00:00
37 lines
650 B
C
37 lines
650 B
C
|
#include <mc1322x.h>
|
||
|
#include <board.h>
|
||
|
|
||
|
const uint8_t hex[16]={'0','1','2','3','4','5','6','7',
|
||
|
'8','9','a','b','c','d','e','f'};
|
||
|
|
||
|
void putc(char c) {
|
||
|
while(*UT1CON == 31); /* wait for there to be room in the buffer */
|
||
|
*UART1_DATA = c;
|
||
|
}
|
||
|
|
||
|
void puts(char *s) {
|
||
|
while(s && *s!=0) {
|
||
|
putc(*s++);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void put_hex(uint8_t x)
|
||
|
{
|
||
|
putc(hex[x >> 4]);
|
||
|
putc(hex[x & 15]);
|
||
|
}
|
||
|
|
||
|
void put_hex16(uint16_t x)
|
||
|
{
|
||
|
put_hex((x >> 8) & 0xFF);
|
||
|
put_hex((x) & 0xFF);
|
||
|
}
|
||
|
|
||
|
void put_hex32(uint32_t x)
|
||
|
{
|
||
|
put_hex((x >> 24) & 0xFF);
|
||
|
put_hex((x >> 16) & 0xFF);
|
||
|
put_hex((x >> 8) & 0xFF);
|
||
|
put_hex((x) & 0xFF);
|
||
|
}
|