/***********************************************************************************//*!
 * \brief Print a string stored in program memory to specific USART.
 *
 * Prints a string stored in the program memory to the USART identified by usartId.  Special functions
 * are required to access the string stored in program memory.
 * @param usartId - USART identifier.
 * @param str - String for transmitting over USART.
 */
void usart_fprint_P(USART_ID usartId, PGM_P str)
{
	uint16_t i = 0;
	size_t stringlength;

	stringlength = strlen_P(str);

	while(i < stringlength)
		usartWrite(usartId, pgm_read_byte(&str[i++]));
}
/*************************************************************************************//*!
 * \brief Print string to specific USART
 *
 * Transmits a given string to the USART.
 * @param usartId - USART identifier
 * @param str - String to transmit via the USART.
******************************************************************************************/
void usart_fprint(USART_ID usartId, uint8_t * str)
{
	uint16_t i = 0;
	size_t stringlength;

	stringlength = strlen((char *)str);

	while(i < stringlength)
		usartWrite(usartId, str[i++]);
}
Beispiel #3
0
/*!\brief Send a command to the LCD.
 *
 *\details Send a given command to the LCD. First, we tell the LCD that we are
 * sending a command, and then we send it. This allows us to clear the LCD,
 * move the cursor, turn it on and off, and more.
 *
 * @param command Integer of the command to be performed.
 */
void lcdCommand (int command) {
	// Notify the LCD that we are going to send a command.
	usartWrite(LCD_ADDRESS, SEND_COMMAND);
	// Send the given command.
	usartWrite(LCD_ADDRESS, command);
}
// Write a single byte into the Tx send buffer
void usartPut(uint8_t data)
{
    usartWrite((char*)&data, 1);
}
Beispiel #5
0
void usartPrint(const char *str) {
    int i = 0;
    while (str[i])
        usartWrite(str[i++]);
}