Hi,
I'm trying to write a program that i can get a different feedback from my development kit using ble_uart_app example, the idea is using switch case so i send different character or string from smartphone here is what i do:
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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,%d\r\n", counter++); //prepare data
length1 = strlen(PrintBuffer); //get data length
err_code = ble_nus_data_send(&m_nus, PrintBuffer, &length1 ,m_conn_handle); //output data via ble
// nrf_delay_ms(100);
break;
case 'W':
my problem is in my switch case there is an error if i put a string as my requirment in 'case' the error says 'charakter constant toolong for its type' and 'warning case label value exceeds maximum value for type' i tried to play with ram but it didn't work. is there any configuration to solve it so i can send more character and getting feedback from the board?
thank you in advance and happy new year
best regards.
Andhika