https://github.com/int-brain-lab/tycmd-wrapper
  
  
    A Python wrapper for tycmd 
    https://github.com/int-brain-lab/tycmd-wrapper
  
firmware firmware-tools microcontroller python teensy teensy-board
        Last synced: 7 months ago 
        JSON representation
    
A Python wrapper for tycmd
- Host: GitHub
- URL: https://github.com/int-brain-lab/tycmd-wrapper
- Owner: int-brain-lab
- License: mit
- Created: 2024-06-30T13:45:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-06T15:16:23.000Z (about 1 year ago)
- Last Synced: 2025-03-11T11:53:15.263Z (8 months ago)
- Topics: firmware, firmware-tools, microcontroller, python, teensy, teensy-board
- Language: Python
- Homepage: https://int-brain-lab.github.io/tycmd-wrapper/
- Size: 3.2 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
- 
            Metadata Files:
            - Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
 
Awesome Lists containing this project
README
          tycmd-wrapper
=============
A Python wrapper for [tycmd](https://koromix.dev/tytools) by 
[Niels Martignène](https://github.com/Koromix/) - a tool for managing 
[Teensy USB Development Boards](https://www.pjrc.com/teensy/) by PJRC.
Examples
--------
### Identifying a firmware file
To identify which models are compatible with a specific firmware file, use the `identify()` method.
```python
import tycmd
compatible_models = tycmd.identify('blink.hex')
```
Models compatible with the firmware file will be returned as a list of strings:
```python
['Teensy 4.0', 'Teensy 4.0 (beta 1)']
```
### List Available Boards
To list all available boards, use the `list_boards()` method.
```python
import tycmd
boards = list_boards()
```
Details for the available boards will be returned as a list of python dictionaries.
```python
[
    {
        '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()` method.
You can specify a board by its port or by its serial number.
```python
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](https://int-brain-lab.github.io/tycmd-wrapper).

[](https://coveralls.io/github/int-brain-lab/tycmd-wrapper)
[](https://github.com/int-brain-lab/tycmd-wrapper/actions)
[](https://pypi.org/project/tycmd-wrapper/)