Skip to content
benjaminaigner edited this page Mar 11, 2016 · 7 revisions

Communication API

The FLipmouse firmware provides 4 different USB HID device classes:

  • Mouse
  • Keyboard
  • Joystick (currently unused)
  • Serial CDC

All configuration is done via the serial interface, which provides the persistent configuration of all functionalities and in addition a live mode (e.g. write "mouse move" to the serial port and the firmware moves the mouse cursor).

The serial port configuration is 115200 8N1 (even these settings are not necessary due to the USB encapsulation).

Following commands are currently available:

Command Parameter Description
AT -- returns OK
AT ID -- returns the current version string
AT BM number (1-11) set the button, which corresponds to the next command. The button assignments are described on the bottom
USB HID commands
AT CL -- Click left mouse button
AT CR -- Click right mouse button
AT CM -- Click middle mouse button
AT CD -- Doubleclick left mouse button
AT PL -- Press+hold left mouse button
AT PR -- Press+hold right mouse button
AT PM -- Press+hold middle mouse button
AT RL -- Release left mouse button
AT RR -- Release right mouse button
AT RM -- Release middle mouse button
AT WU -- Move mouse wheel up
AT WD -- Move mouse wheel down
AT WS number (1-) Set mousewheel stepsize (e.g.: "AT WS 3" sets the stepsize to 3 rows)
AT MX number Move mouse (X direction), e.g. AT MX -25
AT MY number Move mouse (Y direction), e.g. AT MY 10
AT KW string Keyboard write (e.g. "AT KW Hi" types "Hi"
AT KP string Key press (e.g. "AT KP KEY_UP" presses the up arrow key), a full list of supported key identifiers is provided on the bottom
AT KR string Key release (e.g. "AT KR KEY_UP" releases the up arrow key)
AT RA -- Release all keys
Storage commands
AT SA string save current configuration at the next free EEPROM slot under the give name (e.g. "AT SA mouse" stores a slot with the name "mouse"
AT LO string load a configuration from the EEPROM (e.g. "AT LO mouse")
AT LA -- load all slots and print the configuration
AT LI -- list all available slots
AT NE -- load next slot (wrap around after the last slot)
AT DE -- delete all EEPROM slots
AT NC -- do nothing
AT E0 -- disable debug output
AT E1 -- enable debug output
Mouthpiece settings
AT MM number (0,1) use the mouthpiece either as mouse cursor (AT MM 1) or as the alternative function (AT MM 0)
AT SW -- switch between cursor and alternative mode
AT SR -- start reporting out the raw sensor values
AT ER -- stop reporting the sensor values
AT CA -- trigger zeropoint calibration
AT AX number (0-100) acceleration x-axis
AT AY number (0-100) acceleration y-axis
AT DX number (0-10000) deadzone x-axis
AT DY number (0-10000) deadzone y-axis
AT TS number (0-512) sip action threshold
AT TP number (512-1023) puff action threshold
AT SM number (512-1023) special mode threshold
AT HM number (0-512) hold mode threshold
AT GU number (0-100) "up" sensor gain
AT GD number (0-100) "down sensor gain
AT GL number (0-100) "left sensor gain
AT GR number (0-100) "right" sensor gain
Infrared commands
AT IR string record a new infrared command, store it with the given name
AT IP string replay a recorded IR command, stored with the given name
AT IC string clear an IR command, defined by the name
AT IL list all available stored IR commands

Button assignments

The FLipmouse has 1 internal push-button and 2 jack plugs for external buttons. In addition some other functions are mapped to virtual buttons, so they can be configured the same. Following number mapping is used for the AT BM command:

1: internal button1 / Special UP 2: external button2 / Special LEFT 3: external button3 / Special RIGHT 4: alternative UP 5: alternative DOWN 6: alternative LEFT 7: alternative RIGHT 8: SIP (pressure lower than sip threshold) 9: Special SIP 10: PUFF (pressure bigger than puff threshold) 11: Special PUFF

Key identifiers

The key identifiers are necessary to determine which key should be pressed or released by either the "AT KP" or the "AT KR" command. Following keys are possible:

KEY_A   KEY_B   KEY_C   KEY_D    KEY_E   KEY_F   KEY_G   KEY_H   KEY_I   KEY_J    KEY_K    KEY_L
KEY_M   KEY_N   KEY_O   KEY_P    KEY_Q   KEY_R   KEY_S   KEY_T   KEY_U   KEY_V    KEY_W    KEY_X 
KEY_Y   KEY_Z   KEY_1   KEY_2    KEY_3   KEY_4   KEY_5   KEY_6   KEY_7   KEY_8    KEY_9    KEY_0
KEY_F1  KEY_F2  KEY_F3  KEY_F4   KEY_F5  KEY_F6  KEY_F7  KEY_F8  KEY_F9  KEY_F10  KEY_F11  KEY_F12	

KEY_RIGHT   KEY_LEFT       KEY_DOWN        KEY_UP      KEY_ENTER    KEY_ESC   KEY_BACKSPACE   KEY_TAB	
KEY_HOME    KEY_PAGE_UP    KEY_PAGE_DOWN   KEY_DELETE  KEY_INSERT   KEY_END	  KEY_NUM_LOCK    KEY_SCROLL_LOCK
KEY_SPACE   KEY_CAPS_LOCK  KEY_PAUSE       KEY_SHIFT   KEY_CTRL     KEY_ALT   KEY_RIGHT_ALT   KEY_GUI 
KEY_RIGHT_GUI