tycmd-wrapper#

A thin Python wrapper for tycmd by Niels Martignène - a tool for managing Teensy USB Development Boards by PJRC.

Installation#

pip install tycmd-wrapper

This will install tycmd-wrapper along with the necessary tycmd binary for your system.

tycmd-wrapper requires Python 3.10 or later. Supported platforms are:

  • Linux (x86_64, arm64)

  • macOS (Intel, Apple Silicon)

  • Windows (x86_64)

Examples#

Identifying a firmware file#

To identify which models are compatible with a specific firmware file, use the identify() function.

import tycmd

compatible_models = tycmd.identify('blink.hex')

Models compatible with the firmware file will be returned as a list of strings:

['Teensy 4.0', 'Teensy 4.0 (beta 1)']

List Available Boards#

To list all available boards, use the list_boards() function.

import tycmd

boards = tycmd.list_boards()

Details for the available boards will be returned as a list of python dictionaries.

[
    {
        'action': 'add',
        'tag': '3576040-Teensy',
        'serial': '3576040',
        'description': 'USB Serial',
        'model': 'Teensy 3.1',
        'location': 'usb-1-4',
        'capabilities': ['unique', 'run', 'reboot', 'serial'],
        'interfaces': [['Serial', '/dev/ttyACM1']],
    },
    {
        'action': 'add',
        'tag': '14014980-Teensy',
        'serial': '14014980',
        'description': 'USB Serial',
        'model': 'Teensy 4.0',
        'location': 'usb-1-3',
        'capabilities': ['unique', 'run', 'rtc', 'reboot', 'serial'],
        'interfaces': [['Serial', '/dev/ttyACM0']],
    },
]

Uploading a firmware file#

To upload a firmware file to a board, use the upload() function. You can specify a board by its port or by its serial number.

import tycmd
import logging

logging.basicConfig(level=logging.INFO)
tycmd.upload('blink.hex', port='/dev/ttyACM0')

The upload progress will be logged:

INFO:tycmd:Uploading to board '14014980-Teensy' (Teensy 4.0)
INFO:tycmd:Triggering board reboot
INFO:tycmd:Firmware: blink40.hex
INFO:tycmd:Flash usage: 19 kiB (1.0%)
INFO:tycmd:Uploading...
INFO:tycmd:Sending reset command (with RTC)

Full Documentation#

The full API documentation is available here.

License Coverage CI PyPI