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

How can I recieve nRF51822 Rx data?

I find this function. tx

void ble_send(uint8_t * data, uint8_t length) { ble_nus_send_string(&m_nus, data,length);

}

ble_send(&data_array[0],10);

but I don't find Rx Function

Rx Function defined ble_nus.c

I don't know how do I use Rx Function.....

Parents
  • FormerMember
    0 FormerMember

    From what I can see, you are using the experimental_ble_app_uart example?

    The data will be received in a BLE event. Data written to the RX characteristic will be handled in ble_nus_on_ble_evt -> BLE_GATTS_EVT_WRITE -> on_write(..) -> p_nus->data_handler.

    p_nus->data_handler is set in services_init(..): nus_init.data_handler = nus_data_handler;

    nus_data_handler(..) will transfer the received data over UART (to a terminal):

    /**@brief    Function for handling the data from the Nordic UART Service.
     *
     * @details  This function will process the data received from the Nordic UART BLE Service and send
     *           it to the UART module.
     */
    /**@snippet [Handling the data received over BLE] */
    void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
    {
        for (int i = 0; i < length; i++)
        {
            simple_uart_put(p_data[i]);
        }
        simple_uart_put('\n');
    }
    
Reply Children
No Data
Related