void realhex (unsigned char c) { if (c > 9) mon_putc (c + 'A' - 10); else mon_putc (c + '0'); }
void realhex (unsigned char value) { if (value < 10) mon_putc (value + '0'); else mon_putc (value + 'A' - 10); }
void puts (char * string) { while (*string) { mon_putc (*string); string++; } }
void main() { serialinit(); serialtransmit('a'); serialreceive(); mon_putc('A'); while(1) serialtransmit(serialreceive()); }
void number (int value, int max) { int i; for (i = max; i > 0; i /= 10) { mon_putc (value / i + '0'); value %= i; } }
/* Display the given character on the IDP's LED */ void leddisplay (unsigned char c) { int i; unsigned char * ledreg = (unsigned char *) 0x00D00003; #ifdef DEBUG puts ("LED: "); mon_putc (c); puts ("\n\r"); #endif /* Search for the correct code to display */ for (i = 0; i < LEDCODES; i++) if (ledcodes [2 * i] == c) *ledreg = ledcodes [2 * i + 1]; }
write(int handle, void * buffer, unsigned int len) { portBASE_TYPE semStatus = xSemaphoreTake(consolePrintfSem, 2000/portTICK_RATE_MS); if(semStatus != pdPASS){return 0;} int i = 0; switch (handle) { case STDOUT: case STDERR: while (i < len) mon_putc(((char*)buffer)[i++]); break; } xSemaphoreGive(consolePrintfSem); return (len); // number of characters written }
main () { char c; while ((c = mon_getc ()) != 4) mon_putc (c); }