/[avr-libc]/avr-libc/doc/examples/twitest/twitest.c
ViewVC logotype

Diff of /avr-libc/doc/examples/twitest/twitest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by arcanum, Mon Feb 7 23:12:35 2005 UTC revision 1.5 by joerg_wunsch, Tue Sep 6 18:49:15 2005 UTC
# Line 129  ioinit(void) Line 129  ioinit(void)
129   * is empty.   * is empty.
130   */   */
131  int  int
132  uart_putchar(char c)  uart_putchar(char c, FILE *unused)
133  {  {
134    
135    if (c == '\n')    if (c == '\n')
136      uart_putchar('\r');      uart_putchar('\r', 0);
137    loop_until_bit_is_set(UCSRA, UDRE);    loop_until_bit_is_set(UCSRA, UDRE);
138    UDR = c;    UDR = c;
139    return 0;    return 0;
# Line 463  error(void) Line 463  error(void)
463    exit(0);    exit(0);
464  }  }
465    
466    FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
467    
468  void  void
469  main(void)  main(void)
470  {  {
# Line 473  main(void) Line 475  main(void)
475    
476    ioinit();    ioinit();
477    
478    fdevopen(uart_putchar, NULL, 0);    stdout = &mystdout;
479    
480    for (a = 0; a < 256;)    for (a = 0; a < 256;)
481      {      {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26