git.s-ol.nu hw/0x33.board/firmware / c645bed
use config.py for board rev selection, dev mode s-ol a month ago
8 changed file(s) with 33 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
00 boot_out.txt
11 profile*.hex.json
2 config.py
23
34 __pycache__
45 lib
44 1. Copy all files from this repository to the CircuitPython drive
55 2. Install the dependencies:
66 - using [circup][circup]: `$ circup [--path /path/to/drive] install -r requirements.txt`
7 - manually download the needed libraries from the [Adafruit CircuitPython Library Bundle][cpy-lib-bundle] and place them in the `lib` folder
7 - manually download the needed libraries from the [Adafruit CircuitPython Library Bundle][cpy-lib-bundle]
8 and place them in the `lib` folder
9 3. Set hardware settings in `config.py`:
10 Import the module from `hex33board.boards` corresponding to the hardware revision you have.
11
12 ## Boot modes
13 After a reset, `boot.py` is executed. Depending on the `dev_mode` value in `config.py` and
14 whether the menu button (very top left of the board) is pressed, the board boots in different modes:
15
16 With `dev_mode = False` and the button not pressed, the board starts in "normal mode".
17 The board will show up as a read-only flash drive on the computer,
18 and settings changed in the boards menu will be saved automatically.
19
20 When the button is pressed, the board starts in "dev mode".
21 In this case the board shows up read-write on the computer and will autoreload as the firmware is changed.
22 While "dev mode" is active, settings changed on the board aren't saved.
23
24 If `dev_mode = True` in `config.py`, things work the other way around:
25 the board goes into "dev mode" by default, but will start in "normal mode" when the menu key is held during reset.
826
927 [circup]: https://github.com/adafruit/circup
1028 [cpy-lib-bundle]: https://circuitpython.org/libraries
11 import board
22 import digitalio
33 import storage
4 import config as board
45
56 supervisor.set_usb_identification("s-ol", "0x33.board", 0x732D, 0x3362)
67
7 col = digitalio.DigitalInOut(board.GP8)
8 row = digitalio.DigitalInOut(board.GP10)
8 col = digitalio.DigitalInOut(board.matrix_pins[0][0])
9 row = digitalio.DigitalInOut(board.matrix_pins[1][-1])
910 col.switch_to_output(value=True)
1011 row.switch_to_input(pull=digitalio.Pull.DOWN)
11 if row.value:
12 mode_pressed = row.value
13
14 if mode_pressed == board.dev_mode:
1215 storage.disable_usb_drive()
1316 storage.remount("/", False)
1417 print("Mounting read-write")
00 # import test
11 from hex33board import Keyboard
2 import hex33board.boards.r2_defcd99 as board
2 import config as board
33
44 k = Keyboard(board)
55 k.run()
0 from hex33board.boards.r2_defcd99 import *
1
2 dev_mode = False
4646 audio_out: PWMAudioOut
4747
4848 def __init__(self, board):
49 self.matrix = board.matrix
49 self.matrix = board.Matrix(*board.matrix_pins)
5050
5151 self.pixels = NeoPixel(board.pixels_pin, 48 + 4, auto_write=False)
5252
109109
110110 opin.switch_to_input()
111111
112 matrix = Matrix(
112 matrix_pins = (
113113 [board.GP8, board.GP4, board.GP0, board.GP6, board.GP7, board.GP9],
114114 [board.GP5, board.GP1, board.GP2, board.GP3, board.GP10],
115115 )
11
22 from ..matrix import Matrix
33
4 matrix = Matrix(
4 matrix_pins = (
55 # cols
66 [board.GP9, board.GP4, board.GP0, board.GP6, board.GP7, board.GP8],
77 # rows