Re-direct scanf to USART

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Re-direct scanf to USART

      I'm trying to use scanf or scanf like function to read USART

      I've tried the guide on libc_customizing_putchar and got custom uart3_printf working. But I'm getting stuck while trying to create uart3_scanf .

      Source Code

      1. int uart3_scanf(const char *fmt, ...)
      2. {
      3. __stream_scanf_t iod;
      4. va_list a;
      5. int n;
      6. va_start(a, fmt);
      7. iod.is_string = 0;
      8. iod.getc_fn = uart3__getc;
      9. iod.ungetc_fn = uart3_ungetc;
      10. n = __vfscanf((__scanf_t *)&iod, (const unsigned char *)fmt, a);
      11. va_end(a);
      12. return n;
      13. }
      Display All

      I keep getting undefined symbol: __vfscanf. If I check the definition of __vfscanf in <__vfprintf.h> int __vfscanf(__scanf_t *p, __MEMSPACE const unsigned char *fmt, ARGTYPE argv)

      Not sure what I'm doing wrong. I'm fairly new to embedded and C, sorry if I'm missing something obvious.
      Any help or guidance to further reading even is greatly appreciated.

      attaching a copy of my main.c