BoardRepo electronics project sharing
100%
Open file
fluxpad Fluxpad view

Imported from GitHub: sssata/fluxpad · commit 8b2e752 · license GPL-3.0

Description

Analog keypad with hall effect switches and rapid trigger for osu!

README

FLUXPAD Serial Communication Protocol

Summary

The fluxpad exposes a virtual serial port over USB when plugged in to allow communication with the Flux app and other programs on the PC.

Messages to and from the fluxpad is generally serialized in JSON format. No nested objects are permitted, since the { and } characters function as message start and message end markers.

All communication is initialized by the PC, except for when the fluxpad is in datastream mode.

Normal Mode

This is used for the majority of communication. The PC sends a request message to the fluxpad, and the fluxpad will reply with a response message.

Every request message is either a write request or a read request. The type of request is denoted by the "cmd" key of the json message.

Write Request

This message is used to write data to the fluxpad. The value of "cmd" is "w".

Example: Set actuation and release hysteresis of key 2 to 0.2 mm

{
    "cmd": "w",
    "key": 2,
    "h_a": 0.2,
    "h_r": 0.2,
}

Example: Set key 0 keyboard character "a"

{
    "cmd": "w",
    "key": 2,
    "k_t": 0.1,
    "k_c": 0.2,
}

Read Request

This message is used to read data from the fluxpad. The value of "cmd" is "r".

Example: Read key type and key code of key 0 Request

{
    "cmd": "r",
    "key": 0,  // These values are unused and can be anything
    "k_t": 0,
    "k_c": 0,
}

Response

{
    "cmd": "r",
    "key": 0,  // These values are the actual values from the read
    "k_t": 1,
    "k_c": 4,
}

Message Keys

This is a list of valid keys that can appear in a request message

JSON KeyName [units or range]DescriptionTypeNotes
tknMessage Token [uint32]Message token that the response will echo (write only)int
keyKey ID [0,5]Key ID that the following keys applies tostring
k_tKey Type [0,1]HID Usage Page, Keyboard=0, Consumer=1int
k_cKey Code [0,255]HID Key Usage ID (keycode)int
h_aActuate Hysteresis [mm]Actuation hysteresis (Analog key only)number
h_rRelease Hysteresis [mm]Release hysteresis (Analog key only)number
p_aActuate Point [mm]Actuation point (Analog key only)number
p_rRelease Point [mm]Release point (Analog key only)number
rtRapid TriggerEnable or disable rapid trigger (Analog key only)bool
adcRaw ADC [0,4095]Raw ADC counts (read only)number
htHeight [mm]Calculated height of key ADC (read only)number
d_aActuate Debounce [ms]Actuation debouce timeinteger
d_rRelease Debounce [ms]Actuation debouce timeinteger
a_sADC Samples [0,32]Number of ADC samples to take per loopinteger
c_uCalibration ADC UpCalibration ADC value of key in up positionnumber
c_dCalibration ADC DownCalibration ADC value of key in down positionnumber
l_mLighting Mode [0,4]Lighting mode, Off, Fade, Flash, Staticnumber
l_bLighting Brightness [0,255]Brightness of per-key lightinginteger
l_dLighting Duration [us]Lighting duration in flash mode or fade half life in fade mod, usnumber
rgb_mRGB Mode [0,3]RGB Lighting Mode, 0=Off, 1=Static, 2=Rainbowinteger
rgb_bRGB Brightness [0,255]RGB Lighting Speed, for Static. Cycles per as a 32 bit number.integer
rgb_sRGB Speed [0,3]RGB Lighting Speed, for Rainbow. Cycles per minute.integer
rgb_c1RGB Colour [0,2^32]RGB Light 1 (right) Colour, for Static. RGB Colour as a 32 bit number.integer
rgb_c2RGB Colour [0,2^32]RGB Light 2 (center) Colour, for Static. Cycles per as a 32 bit number.integer
rgb_c3RGB Colour [0,2^32]RGB Light 3 (left) Colour, for Static. Cycles per as a 32 bit number.integer
clearClear Flash MemoryFactory reset the flash memory. Enter integer 1234 to clear.integer

| dstrm | Datastream mode | Datastream mode enable or disable | bool | dstrm_freq | Datastream Frequency [hz] | Datastream mode message frequency | int

Datastream Mode