They work the same…
USB Host, we already provide an event which gives characters.
USB Client, we do not provide this. I am not seeing good use for it, do you have an example on why it is needed? Because the way I see it is you will have an interrupt input for a button for example, then you will do something like:
void myPinInterrupt()
{
Send(Key.A);
}
…etc
Transfer from keys to chars is not straightforward but it is not complicated either. For example, you have to keep track and account for Caps lock, shit key, num lock and provide correct numbers vs capital vs small letters…etc
Wait wait, I guess we have a misunderstanding here.
I meant that the example in the ebook gives an example of using the usb client function instead of the usb host function which i would like to use.
Ebook:
Usb client
28.4 keyboard page 140.
The example shows the other way round (sending keys instead of reading and converting)
USBC_Keyboard kb = USBClientController.StandardDevices.StartKeyboard();
// Check if connected to PC
if (USBClientController.GetState() ==
USBClientController.State.Running)
{
// We need shift down for capital "H"
kb.KeyDown(USBC_Key.LeftShift);
kb.KeyTap(USBC_Key.H);
kb.KeyUp(USBC_Key.LeftShift);
// Now "ello world"
kb.KeyTap(USBC_Key.E);
kb.KeyTap(USBC_Key.L);
kb.KeyTap(USBC_Key.L);
kb.KeyTap(USBC_Key.O);
kb.KeyTap(USBC_Key.Space);
kb.KeyTap(USBC_Key.W);
kb.KeyTap(USBC_Key.O);
kb.KeyTap(USBC_Key.R);
kb.KeyTap(USBC_Key.L);
kb.KeyTap(USBC_Key.D);
// The "!"
kb.KeyDown(USBC_Key.LeftShift);
kb.KeyTap(USBC_Key.D1);
kb.KeyUp(USBC_Key.LeftShift);
// Send an enter key
kb.KeyTap(USBC_Key.Enter);
}