This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

scanf does not work

Hello,

I have include stdio.h library file and configure uart . Used printf to print data over uart to terminal. Now I wants same thing reverse get data(scanf) from terminal (via uart). But I am failing to get data.

Can any one help me how can I get data from terminal(via uart) ?

Regards, Rajneesh

Parents Reply
  • Hi,

    Well the function app_uart_get() uses the UART driver

    uint32_t app_uart_get(uint8_t * p_byte)
    {
        ASSERT(p_byte);
        // If FIFO was full new request to receive one byte was not scheduled. Must be done here.
        if (FIFO_LENGTH(m_rx_fifo) == m_rx_fifo.buf_size_mask)
        {
            uint32_t err_code = nrf_drv_uart_rx(rx_buffer,1);
            if (err_code != NRF_SUCCESS)
            {
                return NRF_ERROR_NOT_FOUND;
            }
        }
        return app_fifo_get(&m_rx_fifo, p_byte);
    }
    

    And the UART driver is just an interface for the hardware registers.

Children
No Data
Related