Question
Manual Keyboard Detection
hi,
USB keyboard working fine via HID and i need have small Manual Keyboard Detection by pressing button . it's not compiling
if( HAL_GPIO_ReadPin(GPIOC, button_Pin))
{
if(USBH_HID_GetDeviceType(USBH_HandleTypeDef *phost) == HID_KEYBOARD)
{
HAL_UART_Transmit(&huart2, uart_TX_buf, sizeof(uart_TX_buf), 1000);
HAL_Delay(1000);
}
}
but how it's working inside the Event call back .
void USBH_HID_EventCallback(USBH_HandleTypeDef *phost)
{
if (USBH_HID_GetDeviceType(phost) == HID_KEYBOARD)
{
HID_KEYBD_Info_TypeDef *Keyboard_Info;
Keyboard_Info = USBH_HID_GetKeybdInfo(phost);
char key = USBH_HID_GetASCIICode (Keyboard_Info);
int len = sprintf (uart_buf, "%c\n", key);
HAL_UART_Transmit(&huart2, (uint8_t *)uart_buf, len, 1000);
}
}
