My end goal is to create a ANSI compatible console so that rather than a just a basic 'run command' interface it's more of a 'GUI' (or at least building blocks to do so.
First Milestone: Print the number of the serial port and an incrementing number on ALL serial. I took my Usb<->Serial device and poked around all of the called out pins and, much to my surprise, it worked!
Code: Select all
// Activates the UART driver 1, PA9(TX) and PA10(RX) are routed to USART1.
// Activates the UART driver 2, PA2(TX) and PA3(RX) are routed to USART2.
// Activates the UART driver 3, PB10(TX) and PB11(RX) are routed to USART3.
// Activates the UART driver 4, PC10(TX) and PC11(RX) are routed to UART4.
// Activates the UART driver 5, PC12(TX) and PD2(RX) are routed to UART5.
// Activates the UART driver 6, PC6(TX) and PC7(RX) are routed to USART6.
Code: Select all
while (TRUE) {
i++;
if (SDU1.config->usbp->state == USB_ACTIVE) {
chprintf((BaseSequentialStream *)&SDU1, "Serial USB: %d\r\n", i);
}
chprintf((BaseSequentialStream *)&SD1, "Serial 1: %d\r\n", i);
chprintf((BaseSequentialStream *)&SD2, "Serial 2: %d\r\n", i);
chprintf((BaseSequentialStream *)&SD3, "Serial 3: %d\r\n", i);
chprintf((BaseSequentialStream *)&SD4, "Serial 4: %d\r\n", i);
chprintf((BaseSequentialStream *)&SD5, "Serial 5: %d\r\n", i);
chprintf((BaseSequentialStream *)&SD6, "Serial 6: %d\r\n", i);
chThdSleepMilliseconds(1000);
}
Milestone 2: Print out different ANSI escape sequences to change the color, background and font. http://ascii-table.com/ansi-escape-sequences.php
Picture of how it appears in 2 different consoles with default settings. Eclipse terminal is on the left (white background), PuTTY is on the right (black background)