cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I am making a CUSTOM HID Keyboard application with the stm32f103 processor, when I add the media keys (volume reduction, increase, etc.) to my project, the function that reads the status of the following leds with event_idx does not work. HELP!

AYılm.1
Associate II

this is leds status code ;

static int8_t CUSTOM_HID_OutEvent_FS(uint8_t event_idx, uint8_t state)

{

 /* USER CODE BEGIN 6 */

if( (event_idx & 0x01) == 0x01 )

{

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10, GPIO_PIN_RESET);

}

else if( (event_idx & 0x01) != 0x01 )

{

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_10, GPIO_PIN_SET);

}

if( (event_idx & 0x02) == 0x02 )

{

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_15, GPIO_PIN_RESET);

}

else if( (event_idx & 0x02) != 0x02 )

{

HAL_GPIO_WritePin(GPIOA,GPIO_PIN_15, GPIO_PIN_SET);

}

 return (USBD_OK);

 /* USER CODE END 6 */

}

this is report descriptor for keyboard and consumer keys

__ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END =

{

 /* USER CODE BEGIN 0 */

 0x05, 0x01,          // USAGE_PAGE (Generic Desktop)

 0x09, 0x06,          // USAGE (Keyboard)

 0xa1, 0x01,          // COLLECTION (Application)

 0x05, 0x07,          //  USAGE_PAGE (Keyboard)

 0x85, 0x01, // Report ID (1)

 0x19, 0xe0,          //  USAGE_MINIMUM (Keyboard LeftControl)

 0x29, 0xe7,          //  USAGE_MAXIMUM (Keyboard Right GUI)

 0x15, 0x00,          //  LOGICAL_MINIMUM (0)

 0x25, 0x01,          //  LOGICAL_MAXIMUM (1)

 0x75, 0x01,          //  REPORT_SIZE (1)

 0x95, 0x08,          //  REPORT_COUNT (8)

 0x81, 0x02,          //  INPUT (Data,Var,Abs)

 0x95, 0x01,          //  REPORT_COUNT (1)

 0x75, 0x08,          //  REPORT_SIZE (8)

 0x81, 0x03,          //  INPUT (Cnst,Var,Abs)

 0x95, 0x05,          //  REPORT_COUNT (5)

 0x75, 0x01,          //  REPORT_SIZE (1)

 0x05, 0x08,          //  USAGE_PAGE (LEDs)

 0x19, 0x01,          //  USAGE_MINIMUM (Num Lock)

 0x29, 0x05,          //  USAGE_MAXIMUM (Kana)

 0x91, 0x02,          //  OUTPUT (Data,Var,Abs)

 0x95, 0x01,          //  REPORT_COUNT (1)

 0x75, 0x03,          //  REPORT_SIZE (3)

 0x91, 0x03,          //  OUTPUT (Cnst,Var,Abs)

 0x95, 0x06,          //  REPORT_COUNT (6)

 0x75, 0x08,          //  REPORT_SIZE (8)

 0x15, 0x00,          //  LOGICAL_MINIMUM (0)

 0x25, 0x65,          //  LOGICAL_MAXIMUM (101)

 0x05, 0x07,          //  USAGE_PAGE (Keyboard)

 0x19, 0x00,          //  USAGE_MINIMUM (Reserved (no event indicated))

 0x29, 0x65,          //  USAGE_MAXIMUM (Keyboard Application)

 0x81, 0x00,          //  INPUT (Data,Ary,Abs)

 0xC0,  /*   END_COLLECTION       */

0x05, 0x0C, // Usage Page (Consumer)

0x09, 0x01, // Usage (Consumer Control)

0xA1, 0x01, // Collection (Application)

0x85, 0x02, // Report ID (2)

0x05, 0x0C, // Usage Page (Consumer)

0x15, 0x00, // Logical Minimum (0)

0x25, 0x01, // Logical Maximum (1)

0x75, 0x01, // Report Size (1)

0x95, 0x08, // Report Count (8)

0x09, 0x79, // Usage (Scan Next Track)

0x09, 0x7A, // Usage (Scan Previous Track)

0x09, 0xB7, // Usage (Stop)

0x09, 0xB8, // Usage (Eject)

0x09, 0xCD, // Usage (Play/Pause)

0x09, 0xE2, // Usage (Mute)

0x09, 0xE9, // Usage (Volume Increment)

0x09, 0xEA, // Usage (Volume Decrement)

0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)

0xc0       // End Collection*/

};

What is the reason, urgent help is needed. I made the descriptor declaration as report 1 keyboard and report 2 media and,

While sending the notification IDs in my main file, I send 0x01 keyboard 0x02 media in the order in which each key comes.

0 REPLIES 0