/**@brief Function for handling app_uart events. * * @details This function will receive a single character from the app_uart module and append it to * a string. The string will be be sent over BLE when the last character received was a * 'new line' '\n' (hex 0x0A) or if the string has reached the maximum data length. */ /**@snippet [Handling the data received over UART] */ void uart_event_handle(app_uart_evt_t * p_event)
I'm under the impression that this piece of the given example is an interrupt handler. Am I correct? If yes, then there another snippet:
do { uint16_t length = (uint16_t)index; err_code = ble_nus_data_send(&m_nus, data_array, &length, m_conn_handle); if ( (err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY) && (err_code != NRF_ERROR_NOT_FOUND) ) { APP_ERROR_CHECK(err_code); } } while (err_code == NRF_ERROR_BUSY);
So, is there a while loop inside an iterrupt?
Could you please correct me if my assumptions are wrong and explain what is going on inside NUS in the case it was busy and how will it become available while the code is looping unless, of course, there are nested interrupt and their priorities are capable of managing such condition.
Thanks.