Menu
  • Use Cases
  • Stacks
  • Stackbuilder
  • MyStacks
  • Support
  • About Us
  • Contact
  • Use Cases
  • Stacks
  • Stackbuilder
  • MyStacks
  • Support
  • About Us
  • Contact
  • View Cart

Keyboard / Mouse hardware block

The Interstacks USB Keyboard/Mouse hardware block lets you connect a USB keyboard or mouse to your stack. It can also interface with many USB touch panels integrated into displays. Simply plug a USB Keyboard into the USB Host connector on the back of the block and type a key. A message with the character that was typed will be sent out the “Keyboard” output terminal. It is also possible to do advanced keyboard, mouse, and touch panel event handling via the “Raw Event” output terminals (see details in specification data below).

To set properties in Stackbuilder: Select the Keyboard block by clicking on it once. Click in the “Property Editor” in the bottom right, in the “Initial Value” column for the property you want to edit (if a character or string, use quotes).

Connector on back is a USB Host connector

Block properties and terminals

Properties
Type (uuid): Module Type, read only
Version (int): Firmware Version, read only
Device (int): Number indicating what is connected to USB port. Read only. 0x00 Nothing, 0x01 Hub, 0x02 Keyboard, 0x04 Mouse, 0x08 Vendor specific HID device e.g. Touch Panel, 0x10 FTDI serial.
Mouse_mode (int): Mouse mode. If 0, waits for request before sending mouse data. if > 1, sends continuously. if 1, just sends one mouse position.
FTDI_Baud (int): FTDI baud rate.
Key_Repeat_Delay (int): Key repeat delay, in msec, delay before keys are repeated, default=0
Key_Repeat_Interval (int): Key repeat value in msec, delay between repeated keys, default=0
Mouse_Rate (int): Raw mouse report rate, in mouse samples, default=100. Only affects raw mouse output.
Touch_Rate (int): Raw touch report rate, in touch samples, default=100. Only affects raw mouse output.
Touch_Max_X (int): Max x value in raw touch report, in pixels
Touch_Max_Y (int): Max y value in raw touch report, in pixels

Terminals
“Properties” – in (List or Property Name string): To set property. Send property name, Value. For example [’N’,’netname’]. To get property, just send property name. For example. ’N’
“PResponse” – out (List or True) : On set, responds with True when done. On get, responds with list. For example [’N’, ‘netname’].

“Keyboard” – out (character string): Send processed keyboard character. String of length 1.

“Mouse” – in: if poll rate (prop ‘P’) > 1 continuously sends out o2. if 0, waits for request on i2
“Mouse” – out (list [‘X’ or ‘Y’, int ]): send relative x,y mouse position data. One char string “X”, int. or “Y”, int.

“Mouse Buttons” – out (character string) “0”-“7” mouse buttons. “0” if released and none. sends on state change. Universal spec for mouse buttons is bits are ORed together. Left is 1, right is 2, middle is 4, left and right 3, all 3 pressed is 7.

Raw Event output terminals for advanced use
“Raw Keyboard Events” – out (int): outputs a 4 byte, packed int for keyboard events.
Format of packed int is — mmhhuuuu mm – encodes key event and modifier mask, 1 byte hh – raw hid usage code, 1 byte uuuu – code mapping, 2 bytes mm bit definitions – WASC.xxEE
W Windows key mask, 1=pressed 0=not pressed A Alt key mask, 1=pressed 0=not pressed S Shift key mask, 1=pressed 0=not pressed C Ctrl key mask, 1=pressed 0=not pressed xx – future use EE – event type (00-key press, 01-key release, 10-modifier change, 11-not defined)

“Raw Mouse/Touch Events” – out (int): format of the raw mouse/touch output is a 4 byte, packed int
Mouse format of packed int is — XX.bb.xx.yy
Touch format of packed int is — Xxxx.Xyyy

Mouse – XX.bb.xx.yy
XX – flags bit definition TCxxx.xxxx, all x’s are don’t care T bit – message type, 0=mouse msg, 1=touch msg C bit – connect type, 1=disconnected, 0=connected bb – button state byte xx – x move byte yy – y move byte

Touch – Axxx.Byyy Axxx – high order 4bits is flags, xxx is 12bits of x position A flags TCEx
T bit – message type, 0=mouse msg, 1=touch msg C bit – connect type, 1=disconnected, 0=connected E bit – event type, 1=down event, 0=up event x bit – don’t care Byyy – high order bit (0x8000) is touch event is valid, yyy is 12bits of y position

Refer to documentation on many other topics at interstacks.com/knowledge-base.
Please email info@interstacks.com with any questions.

Popular Articles

  • MyStacks Cloud Dashboard
  • Internet communication with HTTP block
  • Download and install Stackbuilder

Contact Us

Contact us with any questions or help with deploying your IoT projects.

CONTACT US

Connect

  • Facebook
  • Twitter
  • LinkedIn
  • Email

Sign up for the latest Interstacks news.

Join Our Newsletter
  Thank you for Signing Up
  Please correct the marked field(s) below.
1,false,1,First Name,2
Email:
1,true,6,Subscriber Email,2
Name:
1,false,1,Last Name,2

Copyright © 2023 Interstacks. All rights reserved. Privacy Policy | Terms and Conditions

Site by Imagebox