Arduino Libraries/USBHost/src/hidboot.cpp
/**
 * \brief Manage keyboard OEM to ASCII conversion.
 *
 * \param mod Keyboard modifier.
 * \param key Key value to convert.
 *
 * \return Keyboard corresponding ASCII value on success, 0 otherwise.
 */
\brief Manage keyboard OEM to ASCII conversion.
\param mod Keyboard modifier.
\param key Key value to convert.

\return Keyboard corresponding ASCII value on success, 0 otherwise.
\ brief Manage keyboard OEM to ASCII conversion . \ param mod Keyboard modifier . \ param key Key value to convert . \ return Keyboard corresponding ASCII value on success 0 otherwise .
uint8_t KeyboardReportParser::OemToAscii(uint8_t mod, uint8_t key)
{
	uint8_t shift = (mod & 0x22);
	if (key > 0x03 && key < 0x1e)
	{
		if ( (kbdLockingKeys.kbdLeds.bmCapsLock == 0 && (mod & 2)) ||
			 (kbdLockingKeys.kbdLeds.bmCapsLock == 1 && (mod & 2) == 0) )
			return (key - 4 + 'A');
		else
			return (key - 4 + 'a');
	}
	else if (key > 0x1d && key < 0x27)
	{
		if (shift)
			return (numKeys[key - 0x1e]);
		else
			return (key - 0x1e + '1');
	}
	else if (key > 0x58 && key < 0x62)
	{
		if (kbdLockingKeys.kbdLeds.bmNumLock == 1)
			return (key - 0x59 + '1');
	}
	else if (key > 0x2c && key < 0x39)
		return ((shift) ? symKeysUp[key-0x2d] : symKeysLo[key-0x2d]);
	else if (key > 0x53 && key < 0x59)
		return padKeys[key - 0x54];
	else
	{
		switch (key)
		{
			case KEY_SPACE:		return (0x20);
			case KEY_ENTER:		return (0x13);
			case KEY_ZERO:		return ((shift) ? ')' : '0');
			case KEY_ZERO2:		return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '0' : 0);
			case KEY_PERIOD:	return ((kbdLockingKeys.kbdLeds.bmNumLock == 1) ? '.' : 0);
		}
	}
	return 0;
}
uint8_t KeyboardReportParser :: OemToAscii ( uint8_t mod , uint8_t key ) { uint8_t shift = ( mod & 0x22 ) ; if ( key > 0x03 && key < 0x1e ) { if ( ( kbdLockingKeys . kbdLeds . bmCapsLock == 0 && ( mod & 2 ) ) || ( kbdLockingKeys . kbdLeds . bmCapsLock == 1 && ( mod & 2 ) == 0 ) ) return ( key - 4 + ' ' ) ; else return ( key - 4 + ' ' ) ; } else if ( key > 0x1d && key < 0x27 ) { if ( shift ) return ( numKeys [ key - 0x1e ] ) ; else return ( key - 0x1e + ' ' ) ; } else if ( key > 0x58 && key < 0x62 ) { if ( kbdLockingKeys . kbdLeds . bmNumLock == 1 ) return ( key - 0x59 + ' ' ) ; } else if ( key > 0x2c && key < 0x39 ) return ( ( shift ) ? symKeysUp [ key - 0x2d ] : symKeysLo [ key - 0x2d ] ) ; else if ( key > 0x53 && key < 0x59 ) return padKeys [ key - 0x54 ] ; else { switch ( key ) { case KEY_SPACE : return ( 0x20 ) ; case KEY_ENTER : return ( 0x13 ) ; case KEY_ZERO : return ( ( shift ) ? ' ' : ' ' ) ; case KEY_ZERO2 : return ( ( kbdLockingKeys . kbdLeds . bmNumLock == 1 ) ? ' ' : 0 ) ; case KEY_PERIOD : return ( ( kbdLockingKeys . kbdLeds . bmNumLock == 1 ) ? ' ' : 0 ) ; } } return 0 ; }
\brief Manage keyboard OEM to ASCII conversion.
\ brief Manage keyboard OEM to ASCII conversion .
// [a-z] // Upper case letters // Lower case letters // Numbers // Keypad Numbers