Hi, all
I'm using nRF52832 pca10040, s132.
Like 'ble_app_hrs' example, I changed the 'ble_app_uart' example to send data using app_timer.
In the example of 'hrs', they changed Hexa to Decimal using 'hrm_encode'. Am I right?
But what I want is.. when I send decimal data, I want 'uart_c' to receive the same decimal data.
'uart_c' successfully receive data but cannot read correctly.
I want to know why.
And I also want to understand things like situations that are transformed in the process of sending and receiving data.
This is uart example. (I added)
uint8_t heart_rate; heart_rate = 123; len = sizeof(heart_rate); memset(&hvx_params, 0, sizeof(hvx_params)); hvx_params.handle = p_nus->tx_handles.value_handle; hvx_params.type = BLE_GATT_HVX_NOTIFICATION; hvx_params.offset = 0; hvx_params.p_len = len; hvx_params.p_data = heart_rate; err_code = sd_ble_gatts_hvx(conn_handle, &hvx_params);
and I edited 'uart_c' example like this..
static void ble_nus_chars_received_uart_print(uint8_t * p_data, uint16_t data_len)
{
ret_code_t ret_val;
NRF_LOG_DEBUG("Receiving data.");
NRF_LOG_HEXDUMP_DEBUG(p_data, data_len);
for (uint32_t i = 0; i < data_len; i++)
{
printf("%d\r\n", p_data[i]);
// do
// {
// ret_val = app_uart_put(p_data[i]);
// if ((ret_val != NRF_SUCCESS) && (ret_val != NRF_ERROR_BUSY))
// {
// NRF_LOG_ERROR("app_uart_put failed for index 0x%04x.", i);
// APP_ERROR_CHECK(ret_val);
// }
// } while (ret_val == NRF_ERROR_BUSY);
}
....
}
This is result.

( I think this is how it should be done. )
tx_evt
1
2
3
0
Best Regards,
lyrics