add integer debugging

This commit is contained in:
j3d1 2018-12-04 13:20:42 +01:00
parent a759cabb5b
commit e0181cc3e8
3 changed files with 17 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#define _HAL_H_
void debug(int);
void debug(const char* str);
void hal_init_screen(int w, int h);
void hal_poll_input(bool *ptr);

View file

@ -8,3 +8,18 @@
#ifdef AVR
#include "hal/avr.cpp"
#endif
void debug(int n){
const char hex[]="0123456789ABCDEF";
char buf[]="0x00000000\n";
buf[2]=hex[(n>>28)&0xF];
buf[3]=hex[(n>>24)&0xF];
buf[4]=hex[(n>>20)&0xF];
buf[5]=hex[(n>>16)&0xF];
buf[6]=hex[(n>>12)&0xF];
buf[7]=hex[(n>>8)&0xF];
buf[8]=hex[(n>>4)&0xF];
buf[9]=hex[(n>>0)&0xF];
debug(buf);
}