void usart0_put_pgm_string(const char *FlashString) { int i = 0; /// The 'for' logic terminates if the byte is '\0' or if i = 60. /// '\0' is 'null' and terminates C strings /// The 80 prevents too much overrun if we get a bad pointer /// and it limits the string size for( i = 0 ; pgm_read_byte(&FlashString[i]) && (i <= USART0_TRANSMIT_BUFFER_LEN - 1);) { // Put it into the transmit buffer usart0_put_char(pgm_read_byte(&FlashString[i++])); } }
int usart0_put_char(char data, FILE *stream) { // Recursive function to prepend a carriage return before a new line if(data == '\n') { usart0_put_char('\r',stream); } // Wait if a byte is being transmitted while((UCSR0A&(1<<UDRE0)) == 0) { ; } // Transmit data UDR0 = data; return 0; }