Hi,
I try to modify ble_app_uart so i can get a feed back from the boar if send something I use switch case for my use case, I'm working with eclipse
here what I do:
static void nus_data_handler(ble_nus_evt_t * p_evt)
{
uint32_t err_code;
uint64_t counter = 0;
uint16_t length1 = 0;
char PrintBuffer[256] = {0};
// p_evt->type == BLE_NUS_EVT_RX_DATA;
for (uint32_t i = 0; i < p_evt->params.rx_data.length; i++)
{
switch (p_evt->params.rx_data.p_data[i])
{
case 'M':
memset(PrintBuffer,128,sizeof(PrintBuffer)); //clear PrintBuffer buffer
sprintf(PrintBuffer, "Good Morning"); //prepare data
length1 = strlen(PrintBuffer); //get data length
err_code = ble_nus_data_send(&m_nus, (uint8_t *) PrintBuffer, &length1 ,m_conn_handle); //output data via ble
// nrf_delay_ms(100);
break;
case 'W':
memset(PrintBuffer,128,sizeof(PrintBuffer)); //clear PrintBuffer buffer
sprintf(PrintBuffer, "Hello World"); //prepare data
length1 = strlen(PrintBuffer); //get data length
err_code = ble_nus_data_send(&m_nus, (uint8_t *) PrintBuffer, &length1 ,m_conn_handle); //output data via ble
// nrf_delay_ms(100);
break;
case 'A':
memset(PrintBuffer,128,sizeof(PrintBuffer)); //clear PrintBuffer buffer
sprintf(PrintBuffer, "huebsch"); //prepare data
length1 = strlen(PrintBuffer); //get data length
err_code = ble_nus_data_send(&m_nus, (uint8_t *) PrintBuffer, &length1 ,m_conn_handle); //output data via ble
// nrf_delay_ms(100);
break;
default:
// err_code=app_uart_put(p_evt->params.rx_data.p_data[i]);
break;
}
}
}
but I got the following error:
_build/nrf52840_xxaa/main.cpp.o:(.sdh_ble_observers2+0x0): undefined reference to `ble_nus_on_ble_evt' _build/nrf52840_xxaa/main.cpp.o: In function `nus_data_handler(ble_nus_evt_t*)': D:\MicroswarmRepo\Nordic SDK\nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\microswarm_v1\pca10059\s140\armgcc/../../../main.cpp:197: undefined reference to `ble_nus_data_send' D:\MicroswarmRepo\Nordic SDK\nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\microswarm_v1\pca10059\s140\armgcc/../../../main.cpp:204: undefined reference to `ble_nus_data_send' D:\MicroswarmRepo\Nordic SDK\nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\microswarm_v1\pca10059\s140\armgcc/../../../main.cpp:211: undefined reference to `ble_nus_data_send' _build/nrf52840_xxaa/main.cpp.o: In function `services_init()': D:\MicroswarmRepo\Nordic SDK\nRF5_SDK_15.2.0_9412b96\examples\ble_peripheral\microswarm_v1\pca10059\s140\armgcc/../../../main.cpp:238: undefined reference to `ble_nus_init' collect2.exe: error: ld returned 1 exit status make: *** [../../../../../../components/toolchain/gcc/Makefile.common:294: _build/nrf52840_xxaa.out] Error 1 "make VERBOSE=1 all" terminated with exit code 2. Build might be incomplete.
anyone know how to fix these?