Skip to main content

A library to control input modules on the Framework 16 Laptop

Project description

Framework Laptop 16 - Input Module Software

This repository contains a python library and scripts to control the (non-keyboard) input modules, which is currently just the LED Matrix.

Installing

Pre-requisites: Python with pip

python3 -m pip install framework16_inputmodule

Control from the host

To build your own application see the: API command documentation

Permissions on Linux

To ensure that the input module's port is accessible, install the udev rule and trigger a reload:

sudo cp release/50-framework-inputmodule.rules /etc/udev/rules.d/
sudo udevadm control --reload && sudo udevadm trigger
Common commands:
Listing available devices
> ledmatrixctl
More than 1 compatible device found. Please choose with --serial-dev ...
Example on Windows: --serial-dev COM3
Example on Linux:   --serial-dev /dev/ttyACM0
/dev/ttyACM1
  VID:     0x32AC
  PID:     0x0020
  SN:      FRAKDEBZ0100000000
  Product: LED Matrix Input Module
/dev/ttyACM0
  VID:     0x32AC
  PID:     0x0020
  SN:      FRAKDEBZ0100000000
  Product: LED Matrix Input Module
Apply command to single device

When there are multiple devices you need to select which one to control.

# Example on Linux
> ledmatrixctl --serial-dev /dev/ttyACM0 --percentage 33

# Example on Windows
> ledmatrixctl --serial-dev COM5 --percentage 33

Graphical Application

Launch the graphical application

# Either via the commandline
ledmatrixctl --gui

# Or using the standanlone application
ledmatrixgui

Other example commands

# Show current time and keep updating it
ledmatrixctl --clock

# Draw PNG or GIF
ledmatrixctl --image stripe.gif
ledmatrixctl --image stripe.png

# Change brightness (0-255)
ledmatrixctl --brightness 50

All commandline options

> ledmatrixctl --help
options:
  -h, --help            show this help message and exit
  -l, --list            List all compatible devices
  --bootloader          Jump to the bootloader to flash new firmware
  --sleep, --no-sleep   Simulate the host going to sleep or waking up
  --is-sleeping         Check current sleep state
  --brightness BRIGHTNESS
                        Adjust the brightness. Value 0-255
  --get-brightness      Get current brightness
  --animate, --no-animate
                        Start/stop vertical scrolling
  --get-animate         Check if currently animating
  --pwm {29000,3600,1800,900}
                        Adjust the PWM frequency. Value 0-255
  --get-pwm             Get current PWM Frequency
  --pattern {...}       Display a pattern
  --image IMAGE         Display a PNG or GIF image in black and white only)
  --image-grey IMAGE_GREY
                        Display a PNG or GIF image in greyscale
  --camera              Stream from the webcam
  --video VIDEO         Play a video
  --percentage PERCENTAGE
                        Fill a percentage of the screen
  --clock               Display the current time
  --string STRING       Display a string or number, like FPS
  --symbols SYMBOLS [SYMBOLS ...]
                        Show symbols (degF, degC, :), snow, cloud, ...)
  --gui                 Launch the graphical version of the program
  --panic               Crash the firmware (TESTING ONLY)
  --blink               Blink the current pattern
  --breathing           Breathing of the current pattern
  --eq EQ [EQ ...]      Equalizer
  --random-eq           Random Equalizer
  --wpm                 WPM Demo
  --snake               Snake
  --snake-embedded      Snake on the module
  --pong-embedded       Pong on the module
  --game-of-life-embedded {currentmatrix,pattern1,blinker,toad,beacon,glider}
                        Game of Life
  --quit-embedded-game  Quit the current game
  --all-brightnesses    Show every pixel in a different brightness
  -v, --version         Get device version
  --serial-dev SERIAL_DEV
                        Change the serial dev. Probably /dev/ttyACM0 on Linux, COM0 on Windows

Update the Firmware

First, put the module into bootloader mode.

This can be done either by flipping DIP switch #2 or by using one of the following commands:

> ledmatrixctl --bootloader

Then the module will present itself in the same way as a USB thumb drive. Copy the UF2 firmware file onto it and the device will flash and reset automatically.


### Check the firmware version of the device

```sh
> ledmatrixctl --version
Device Version: 0.1.7
By looking at the USB descriptor

On Linux:

> lsusb -d 32ac: -v 2> /dev/null | grep -P 'ID 32ac|bcdDevice'
Bus 003 Device 078: ID 32ac:0020 Framework Computer Inc LED Matrix Input Module
  bcdDevice            0.17

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

framework16_inputmodule-0.1.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

framework16_inputmodule-0.1.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file framework16_inputmodule-0.1.1.tar.gz.

File metadata

File hashes

Hashes for framework16_inputmodule-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a43bfc98819966dc4ee5e371e44e91bc61db204dddaf5cdf517fb9716a8816b4
MD5 1c2bce0d326c32a9fb81b9db5ea756fb
BLAKE2b-256 88d8b97e5debd0e7f7a4dd6f8aa58a355f6eb5c9e079573638c8072b0f53f944

See more details on using hashes here.

File details

Details for the file framework16_inputmodule-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for framework16_inputmodule-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9ca49e8cfcf31ae786d21ee6a446e5ff9bbbb198351a72fccb6ef658cd5bd60b
MD5 5abe90caa73fa022c322e26fa5527a03
BLAKE2b-256 61e9a9d6661a74b8f37d8d08a64b18f6c751833274e6c5ddad277224e3635d69

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page