Example #1
0
/**
 * \brief Initialize the ports for USART in order to display strings to the LCD, and terminal.
 */
void initializeUSART() {
	// Turn on the serial port for debugging or for other USART reasons.
	usartOpen(USART_0, BAUD_RATE_115200, portSERIAL_BUFFER_TX, portSERIAL_BUFFER_RX);

	// Turn on the LCD port
	usartOpen(USART_1, BAUD_RATE_9600, portSERIAL_BUFFER_TX, portSERIAL_BUFFER_RX);

	// Turn on the Gainspan port (wireless interface)
	usartOpen(USART_2, BAUD_RATE_9600, portSERIAL_BUFFER_TX, portSERIAL_BUFFER_RX);
}
Example #2
0
/*!\brief Initialize the LCD for communication, called before any printing
 * can be done.
 *
 *\details This function must be called once before trying to print on the LCD,
 * or else the LCD will not receive commands sent to it. In technical detail,
 * to be able to communicate with and print on the LCD, we have to set the
 * Data Register DDRD, and then set PortD pin 3 as output compare, since the
 * LCD is connected to pin 3 on Chico™.
 *
 */
void initLCD (void) {
	// Open the USART port for writing.
	usartOpen(LCD_ADDRESS, 9600, portSERIAL_BUFFER_TX, portSERIAL_BUFFER_RX);
	// Set the data register for the LCD.
	DDRD |= _BV(DDD3);
	// Point at pin 3, where the LCD is connected.
	PORTD |= _BV(PORTD3);
	// Turn on the display.
	lcdCommand(TURN_ON_DISPLAY);
	// Clear the LCD, in case it has any previous content.
	lcdCommand(CLEAR_LCD);
}