How to send any HID key code via BLE

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
gocchan
Level 2
Level 2
5 questions asked 25 sign-ins 10 replies posted

Hi,

I want to implement the process of sending an arbitrary key code based on the sample code HID_Dual_Mode_Keyboard.

I tried to implement the following code, but even though WICED_BT_GATT_SUCCESS is returned in wiced_blehidd_send_report(), no characters are entered in the peer device (PC).

* If the sample code has not been changed, "a1" is entered.

Would you tell me how to implement?

 

 

#define SEND_DATA_LENGTH 8
static uint8_t m_send_data[SEND_DATA_LENGTH] = {0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00}; /* 'h' */

/*
 * Handle interrupt generated due to change in the GPIO state
 */
static void hal_gpio_app_interrrupt_handler(void *data, uint8_t pin)
{
    static bool led_state = false;

    if (wiced_blehidd_is_link_encrypted() != WICED_FALSE)
    {
        if (wiced_blehidd_send_report(0x0000, 0x00, WICED_HID_REPORT_TYPE_INPUT, m_send_data, SEND_DATA_LENGTH) == WICED_BT_GATT_SUCCESS)
        {
            /* LED ON */
        }
    }
}

static void gpios_init(void)
{
    wiced_hal_gpio_register_pin_for_interrupt(0, hal_gpio_app_interrrupt_handler, NULL); /* D2 button */
    wiced_hal_gpio_configure_pin(0, WICED_GPIO_BUTTON_SETTINGS(GPIO_EN_INT_RISING_EDGE), GPIO_PIN_OUTPUT_LOW);
}

wiced_result_t app_start(void)
{
    ...
#if 0
    key_init(NUM_KEYSCAN_ROWS, NUM_KEYSCAN_COLS, APP_pollReportUserActivity, APP_keyDetected);
#else
    debug_init();
#endif
    ...
}

 

 

 

HW: CYW920735Q60EVB-01

PC: Windows 10

IDE: Eclipse IDE for ModusToolbox Version 2.2.0

SW: Based on HID_Dual_Mode_Keyboard.

Regards, Gotoda

 

0 Likes
1 Solution
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

Have you checked https://github.com/cypresssemiconductorco/mtb-example-btsdk-hid-dual-mode-keyboard app? It has both BT as well as BLE support and separate initializations.

 

Thanks,

-Dheeraj

View solution in original post

0 Likes
3 Replies
SheetalJ
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 500 likes received

Hi Gotoda,

We will check this issue and update you soon.

 

0 Likes
gocchan
Level 2
Level 2
5 questions asked 25 sign-ins 10 replies posted

Hi, 

I will change the question once.

I want to disable BLE_SUPPORT and enable BR_EDR_SUPPORT.

Where can I set it?

Regards, Gotoda

 

0 Likes
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

Have you checked https://github.com/cypresssemiconductorco/mtb-example-btsdk-hid-dual-mode-keyboard app? It has both BT as well as BLE support and separate initializations.

 

Thanks,

-Dheeraj

0 Likes