Changed fdevopen in avr-libc v1.4.0

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In avr-libc v1.2.x an fdevopen call worked this way:
fdevopen(usart_putc, usart_getc, 0);

Using USART function like this
int usart_putc(char data);
int usart_getc(void);

Now in avr-libc v1.4.0 the fdevopen function has been changed to:

FILE * fdevopen (int(*put)(char, FILE *), int(*get)(FILE *))

Which seems to require USART functions like this one:
int uart_putchar(char c, FILE *stream)

What is the reason for this change?
Why do we need an extra FILE pointer in USART functions?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> What is the reason for this change?

See

http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html

Subsection ``Outline of the chosen API'', last paragraph.

See also the note about __STDIO_FDEVOPEN_COMPAT_12 in the
documentation about fdevopen().

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.