[SOLVED] Re-direct scanf to USART

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

  • [SOLVED] Re-direct scanf to USART

    Hi,
    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
  • Hello,

    with the new Embedded Studio versions the projects are usually based on the new SEGGER run time library.
    You can check what your project is based on in the project options.

    For SEGGER RTL we recommend the following guide:
    wiki.segger.com/Embedded_Studio_Library_IO

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.