Skip to content

Commit 9882c99

Browse files
committed
Initial commit
Signed-off-by: Daniel Schaefer <dhs@frame.work>
0 parents  commit 9882c99

5 files changed

Lines changed: 109 additions & 0 deletions

File tree

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2023 Framework Computer Inc
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# CircuitPython Scripts for Framework 16 Input Modules
2+
3+
This is not the official firmware for the Framework 16 Input Modules.
4+
But we want to make it as easy as possible to hack on the modules. As an alternative firmware for playing around, you can use circuitpython to easily write some scripts and run them in the firmware.
5+
6+
Going back to official firmware is as easy as triggering the bootloader mode and copying the official UF2 files on the RP2 drive.
7+
8+
## Preparation
9+
10+
Not supported in upstream CircuitPython yet.
11+
Clone from the [pull request](https://github.com/adafruit/circuitpython/pull/8233).
12+
13+
Follow the official [build guide](https://learn.adafruit.com/building-circuitpython).
14+
Once your environment is set up you can compile with:
15+
16+
```sh
17+
cd ports/raspberrypi
18+
make BOARD=fwk_keyboard
19+
20+
# Use firmware at build-fwk_keyboard/firmware.uf2
21+
```
22+
23+
Flash the firmware once and you're good to go.
24+
25+
To go back to Framework official firmware
26+
27+
## Support
28+
29+
- Any Module
30+
- [x] Jump to bootloader: `bootloader_jump.py`
31+
- Any keyboard
32+
- [ ] Scan keys
33+
- [ ] Example
34+
- White Backlight Keyboard
35+
- [x] Control Backlight
36+
- [x] Control Capslock LED
37+
- [x] Example: `white_keyboard_blink.py`
38+
- RGB Keyboard
39+
- [ ] Control RGB Backlight
40+
- [ ] Example
41+
- RGB Macropad
42+
- [ ] Control RGB Backlight
43+
- [ ] Example
44+
- LED Matrix
45+
- [ ] Control LED Matrix
46+
- [ ] Example WIP: `led_matrix.py`

bootloader_jump.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Jump to the bootloader to flash new UF2 firmware
2+
import microcontroller
3+
microcontroller.on_next_reset(microcontroller.RunMode.UF2)
4+
microcontroller.reset()

led_matrix.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import board
2+
import busio
3+
import digitalio
4+
5+
# Enable LED Matrix Controller
6+
sdb = digitalio.DigitalInOut(board.GP29)
7+
sdb.direction = digitalio.Direction.OUTPUT
8+
sdb.value = True
9+
10+
from adafruit_is31fl3731 import IS31FL3731
11+
i2c = busio.I2C(board.SCL, board.SDA)
12+
i2c.try_lock()
13+
print('\n i2c scan: ' + str(i2c.scan()))
14+
i2c.unlock()
15+
16+
# TODO: Doesn't seem to work yet
17+
display = IS31FL3731(i2c, address=0x20)
18+
display.fill(250)

white_keyboard_blink.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import time
2+
import board
3+
import busio
4+
import digitalio
5+
import pwmio
6+
7+
capslock = digitalio.DigitalInOut(board.GP24)
8+
capslock.direction = digitalio.Direction.OUTPUT
9+
10+
backlight = pwmio.PWMOut(board.GP25, frequency=5000, duty_cycle=0)
11+
12+
# Blink capslock LED and backlight
13+
while True:
14+
capslock.value = True
15+
backlight.duty_cycle = int(65535 / 2) # 50% brightness
16+
time.sleep(1)
17+
18+
capslock.value = False
19+
backlight.duty_cycle = 0
20+
time.sleep(1)

0 commit comments

Comments
 (0)