monome / ii

ii protocol (i2c for synth modules)
12 stars 0 forks source link

Convention for matched Get and Set commands #6

Open trentgill opened 4 years ago

trentgill commented 4 years ago

Many devices support both get & set for the same command. The convention is that setters use the 0x00..0x7F range, and they are mirrored by getters in the 0x80..0xFF range. At the low level this means you can check the msb to determine if it's a get or set.

The convention is also that it is the last argument of the set-args, that is to be queried. eg:

SET( a, b, c )
GET( a, b ) -> c

set_pitch( instrument, voice, pitch )
get_pitch( instrument, voice ) -> pitch

The benefit from an implementation perspective is a single description of a command can be used to generate both getters & setters, by stating that the command supports this convention. See the crow descriptor for W/ for an example where the get = true flag states both get&set should be generated.

scanner-darkly commented 4 years ago

should also account for the cases where only getters are supported (such as getting an input state from ansible or a CV input value from TXo)