Part Number:LAUNCHXL-CC2650
Tool/software:TI-RTOS
Hello,
I have a board which receives chars from UART connection.
I want to transfer those chars through BLE, I based on the hid_emu_kbd example project - I wish my project to pair with another BLE supporting device, and send it with the HidEmuKbd_sendReport function from the example project.
Currently what I did was to init UART in HidEmuKbd_init, creating a UART Params struct and opening UART with UART_open.
Board_initUART(); /* Create a UART with data processing off. */ UART_Params_init(&uartParams); uartParams.readDataMode = UART_DATA_BINARY; uartParams.readReturnMode = UART_RETURN_FULL; uartParams.readEcho = UART_ECHO_OFF; uartParams.baudRate = 115200; uartParams.readMode = UART_MODE_CALLBACK; uartParams.readCallback = &readCallbackFxn; uart = UART_open(Board_UART0, &uartParams);
In the struct, I defined a read callback function (currently I want to send C instead of what I read).
static void readCallbackFxn(UART_Handle handle, void *rxBuf, size_t size)
{
uint8_t keycode = *((uint8_t*)(rxBuf));
HidEmuKbd_sendReport(HID_KEYBOARD_C);
HidEmuKbd_sendReport(KEY_NONE);
is_read_req = 0;
SimpleBLECentral_startReadHandler();
}
Then in HidEmuKbd_taskFxn, I do an UART_read, inside the for loop. This calls SimpleBLECentral_startReadHandler:
static void SimpleBLECentral_startReadHandler()
{
// Store the event.
events |= HIDEMUKBD_READ_EVT;
// Wake up the application.
Semaphore_post(sem);
}
When I have no wire in the UART rx pin, the BLE works good (I am also debugging using the buttons on board, sending A and B)
Once I connect to UART, the project stucks and even the buttons don't work.
What am I am doing wrong? Is there another configuration I should use in order to accomplish my purpose?
Thanks