Skip to main content
Bastien1
Associate II
March 12, 2021
Solved

Non-intrusif scanf()

  • March 12, 2021
  • 2 replies
  • 1164 views

Hello,

I'm working on the SPC574S-DISP board, I've set up FreeRTOS and I would like to have a way to do a non-intrusive scanf.

I would like the program to keep running and wait for a key to be pressed to access a submenu.

The problem is that with scanf(), the debug gets stuck.

Can you help me?

Thank you very much in advance 

Regards

Bastien

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    You're going to have to code that yourself, using a character input method that checks if data is available and leaves immediately rather than blocking. When you have data to decode use sscanf() on the string.

    If the menu just needs a character, why even use scanf() for that?

    2 replies

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    March 12, 2021

    You're going to have to code that yourself, using a character input method that checks if data is available and leaves immediately rather than blocking. When you have data to decode use sscanf() on the string.

    If the menu just needs a character, why even use scanf() for that?

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    Bastien1
    Bastien1Author
    Associate II
    March 12, 2021

    Okay thank you for your answer I will try.

    I don't want to use scanf() for my menu because it will send me real time values so it will refresh very often. On top of that I want to be able to navigate from menu to other menu

    Erwan YVIN
    ST Employee
    June 3, 2021