[En-Nut-Discussion] How to close nicely device USART... ???

SPIJTAG info at spijtag.com
Mon Apr 9 03:22:37 CEST 2007


How to close nicely device USART (for AVR) ???
In my program I use "devUsartAvr0".
But later I want to use "devAhdlc0".
(It is necessary for work with PPP)

*** Example:

NutRegisterDevice(&devUsartAvr1, 0, 0);
usart1 = fopen("uart1", "r+");
......
printf("Close uart0...");
if ( fclose(usart0)!=0)
{    printf("FAIL\n"); }
else {   printf("OK\n");    }
......
printf("Init HDLC device...");
if ( NutRegisterDevice(&devAhdlc0, 0, 0) == 0)
{  printf("OK\n"); }
else { printf("FAIL\n");}

*** Return:

Close uart0...OK
Init HDLC device...FAIL







More information about the En-Nut-Discussion mailing list