Arduino Libraries/USBHost/src/hidboot.cpp
/**
 * \brief Handle keyboard locking keys and manage keyboard leds using USB
 * report.
 *
 * \param hid HID device pointer.
 * \param key Locking key.
 *
 * \return 0 on success, error code otherwise.
 */
\brief Handle keyboard locking keys and manage keyboard leds using USB
report.

\param hid HID device pointer.
\param key Locking key.

\return 0 on success, error code otherwise.
\ brief Handle keyboard locking keys and manage keyboard leds using USB report . \ param hid HID device pointer . \ param key Locking key . \ return 0 on success error code otherwise .
uint8_t KeyboardReportParser::HandleLockingKeys(HID *hid, uint8_t key)
{
	uint8_t old_keys = kbdLockingKeys.bLeds;
	switch (key)
	{
		case KEY_NUM_LOCK:
			kbdLockingKeys.kbdLeds.bmNumLock = ~kbdLockingKeys.kbdLeds.bmNumLock;
			break;
		case KEY_CAPS_LOCK:
			kbdLockingKeys.kbdLeds.bmCapsLock = ~kbdLockingKeys.kbdLeds.bmCapsLock;
			break;
		case KEY_SCROLL_LOCK:
			kbdLockingKeys.kbdLeds.bmScrollLock = ~kbdLockingKeys.kbdLeds.bmScrollLock;
			break;
	}
	if (old_keys != kbdLockingKeys.bLeds && hid)
		return (hid->SetReport(0, 0, 2, 0, 1, &kbdLockingKeys.bLeds));
	return 0;
}
uint8_t KeyboardReportParser :: HandleLockingKeys ( HID * hid , uint8_t key ) { uint8_t old_keys = kbdLockingKeys . bLeds ; switch ( key ) { case KEY_NUM_LOCK : kbdLockingKeys . kbdLeds . bmNumLock = ~ kbdLockingKeys . kbdLeds . bmNumLock ; break ; case KEY_CAPS_LOCK : kbdLockingKeys . kbdLeds . bmCapsLock = ~ kbdLockingKeys . kbdLeds . bmCapsLock ; break ; case KEY_SCROLL_LOCK : kbdLockingKeys . kbdLeds . bmScrollLock = ~ kbdLockingKeys . kbdLeds . bmScrollLock ; break ; } if ( old_keys != kbdLockingKeys . bLeds && hid ) return ( hid -> SetReport ( 0 , 0 , 2 , 0 , 1 , & kbdLockingKeys . bLeds ) ) ; return 0 ; }
\brief Handle keyboard locking keys and manage keyboard leds using USB
 report.
\ brief Handle keyboard locking keys and manage keyboard leds using USB report .
/*hid->GetIface()*/