void LCD_PutChar( char ch ) { char chStr[ 2 ]; if (( gX >= gNumCols ) || ( ch == '\n' )) { gX = 0; gY++; if ( gY >= gNumLines ) { gY = 0; } } if ( ch != '\n' ) { chStr[ 0 ] = ch; chStr[ 1 ] = 0; OSRAMStringDraw( chStr, gX * 6, gY ); gX++; } } // LCD_PutChar
static void prvSetupHardware( void ) { /* Setup the PLL. */ SysCtlClockSet( SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ ); /* Setup the push button. */ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); GPIODirModeSet(GPIO_PORTC_BASE, mainPUSH_BUTTON, GPIO_DIR_MODE_IN); GPIOIntTypeSet( GPIO_PORTC_BASE, mainPUSH_BUTTON,GPIO_FALLING_EDGE ); IntPrioritySet( INT_GPIOC, configKERNEL_INTERRUPT_PRIORITY ); GPIOPinIntEnable( GPIO_PORTC_BASE, mainPUSH_BUTTON ); IntEnable( INT_GPIOC ); /* Enable the UART. */ SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); /* Set GPIO A0 and A1 as peripheral function. They are used to output the UART signals. */ GPIODirModeSet( GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_DIR_MODE_HW ); /* Configure the UART for 8-N-1 operation. */ UARTConfigSetExpClk( UART0_BASE, SysCtlClockGet(), mainBAUD_RATE, UART_CONFIG_WLEN_8 | UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE ); /* We don't want to use the fifo. This is for test purposes to generate as many interrupts as possible. */ HWREG( UART0_BASE + UART_O_LCR_H ) &= ~mainFIFO_SET; /* Enable Tx interrupts. */ HWREG( UART0_BASE + UART_O_IM ) |= UART_INT_TX; IntPrioritySet( INT_UART0, configKERNEL_INTERRUPT_PRIORITY ); IntEnable( INT_UART0 ); /* Initialise the LCD> */ OSRAMInit( false ); OSRAMStringDraw("www.FreeRTOS.org", 0, 0); OSRAMStringDraw("LM3S811 demo", 16, 1); }
static void vPrintTask( void *pvParameters ) { char *pcMessage; unsigned portBASE_TYPE uxLine = 0, uxRow = 0; for( ;; ) { /* Wait for a message to arrive. */ xQueueReceive( xPrintQueue, &pcMessage, portMAX_DELAY ); /* Write the message to the LCD. */ uxRow++; uxLine++; OSRAMClear(); OSRAMStringDraw( pcMessage, uxLine & 0x3f, uxRow & 0x01); } }