int main(){ WDTCTL = WDTPW | WDTHOLD; clock_config(); serial_config(); serial_print_string("ASCII TABLE:\n"); char strVal[4]; for(char i = ' '; i < 127; i++){ itoa(i, strVal, 10); serial_print_string(strVal); serial_print_string(": "); serial_print_byte((char)i); serial_print_byte('\n'); } serial_print_byte('\n'); __enable_interrupt(); __bis_SR_register(LPM4_bits); return 0; }
void serial_init( ) { // Set the baud rate to 9600 bits per second. Each byte takes ten bit // times, so you can get at most 960 bytes per second at this speed. serial_set_baud_rate(USB_COMM, 9600); // Start receiving bytes in the ring buffer. serial_receive_ring(USB_COMM, receive_buffer, sizeof(receive_buffer)); memset( my_received_buffer, 0, sizeof(my_received_buffer)); serial_print_string( "USB Serial Initialized" ); serial_print_string( "" ); print_menu(); }
void serial_print( char *format, ... ) { va_list args; va_start( args, format ); memset( myBuffer, 0, BUFFER_SIZE ); vsnprintf( myBuffer, BUFFER_SIZE, format, args ); serial_print_string( myBuffer ); }
void debug_print( uint8_t dbgLvl, char *format, ... ) { if ( dbgLvl > gDebugLevel) { return; } va_list args; va_start( args, format ); memset( myBuffer, 0, BUFFER_SIZE ); vsnprintf( myBuffer, BUFFER_SIZE, format, args ); serial_print_string( myBuffer ); }