This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Including "app_uart.h" in main program of 'simple_coap_server' example

HI All,

I wonder if someone can help me out. I would like to send serial data by modifying the 'simple_coap_server' main program. I added the following header 'app_uart.h' to make use of the functions but when I compile the program using GCC ('make' command in Windows), I get No such file or directory #include "app_uart.h". What I don't understand is that the file is in the directory and that I can compile the 'UART' example using GCC successfully without any problems. Any thoughts please, maybe I'm missing something?

Roger

Parents
  • Hello Jørgen,

    Seems like there is something still missing which I don't fully understand. The 'simple_coap_server' compiles with no error after including $(SDK_ROOT)/components/libraries/uart \ in the INC_FOLDER of the Makefile. However, after including the following code from the 'UART' example to the main of 'simple_coap_server' example':

    int main(void) {
    
    uint32_t err_code;
    
    const app_uart_comm_params_t comm_params =
      {
          RX_PIN_NUMBER,
          TX_PIN_NUMBER,
          RTS_PIN_NUMBER,
          CTS_PIN_NUMBER,
          APP_UART_FLOW_CONTROL_ENABLED,
          false,
          UART_BAUDRATE_BAUDRATE_Baud115200
      };
    
    APP_UART_FIFO_INIT(&comm_params,
                         UART_RX_BUF_SIZE,
                         UART_TX_BUF_SIZE,
                         uart_error_handle,
                         APP_IRQ_PRIORITY_LOWEST,
                         err_code);
    
    APP_ERROR_CHECK(err_code);
    
    printf("\r\nStart: \r\n");
    
    while (true)
    {
        uint8_t cr;
        while (app_uart_get(&cr) != NRF_SUCCESS);
        while (app_uart_put(cr) != NRF_SUCCESS);
    
        if (cr == 'q' || cr == 'Q')
        {
            printf(" \r\nExit!\r\n");
    
            while (true)
            {
                // Do nothing.
            }
    
        }
    
    }
    

    I get the following error: image description

    It seems that the functions of "app_uart.h" used in main are still undefined. In the 'UART' example, I also checked that the headers and source files in the Makefile, are also included in the 'simple_coap_server' Makefile, but I still get an undefined reference to the functions.

    Are there perhaps any other files that need to be included? Any thoughts?

    Roger

  • Thanks again. Very helpful.

Reply Children
No Data
Related