To use via PlatformIO:
git clone --recursive https://github.com/aforren1/hand
)platformio init --board teensy35
platformio run
platformio run --target upload
(add -e teensy35_serial_dbg
to target the serial env)platformio run --target clean
Notes:
Make sure Teensy is up to date (platformio platform update
), but let me know if you're compiling on Windows (woes in Windows + Visual Studio Code)
Generate docs via doxygen Doxyfile
in the top-level directory.
setters return an integer (0 on success, > 0 on failure).
Get local versions of all the req libs; we want to be independent of build systems
If a unit needs to maintain a state, it's implemented as a struct
/class
. Otherwise, we use a namespace.
On various Linux distributions, you'll need to run sudo cp inst/49-teensy.rules /etc/udev/rules.d/49-teensy.rules
(see inst/49-teensy.rules
for details).
Keep in mind that some number of packets are buffered on the Teensy/by the OS(?). You may need to clean out stale packets when switching between acquisition/config mode. In one example, 64 packets were buffered.
When writing to the device via HIDAPI on Windows (or at least the python interface), the first byte is the report ID (which I think is 0x0?). For example, to query the sampling frequency, you would send b'\x00gf'
, not b'gf'
.
100
false
false
Below are examples of packets that might be sent, and the results:
b'a' # change to acquisition mode (sampling) (only from config mode)
b'c' # change to config mode (no sampling) (only from acquisition mode)
# can only do the following in config mode:
b'sf' + struct.pack('>f', 1000.0) # set the sampling frequency to 1000 Hz
b'sm' + struct.pack('B', 1) # turn on game mode
b'sg' + struct.pack('>bbbf', -1, -1, 3, 48.0) # set the product of gains across all fingers & channels to 48.0
b'gg' + struct.pack('bbb', 0, 1, 2) # see how that changed the first finger, second channel, output gain