forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
framework_inputmodule: Add new rp2040 based board #8233
Draft
JohnAZoidberg
wants to merge
9
commits into
adafruit:main
Choose a base branch
from
FrameworkComputer:fwk_keyboard
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1c5fa3c
fwk_keyboard: Add new rp2040 based board
JohnAZoidberg 6f4d131
raspberrypi: Allow build without audio
JohnAZoidberg 74e9ee1
boards/fwk_keyboard: Reduce firmware size to below 500KB
JohnAZoidberg 0d3541d
fixup! boards/fwk_keyboard: Reduce firmware size to below 500KB
JohnAZoidberg 4ef3c7b
boards/fwk_keyboard: Generic PID and name
JohnAZoidberg 60bd613
boards/framework_inputmodule: Rename to generic name
JohnAZoidberg a6c653e
fixup! raspberrypi: Allow build without audio
JohnAZoidberg 0250c58
fixup! boards/fwk_keyboard: Reduce firmware size to below 500KB
JohnAZoidberg 029c7a0
fixup! boards/fwk_keyboard: Reduce firmware size to below 500KB
JohnAZoidberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* This file is part of the MicroPython project, http://micropython.org/ | ||
* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2021 Scott Shawcroft for Adafruit Industries | ||
* Copyright (c) 2023 Daniel Schaefer for Framework Computer Inc | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
#include "supervisor/board.h" | ||
|
||
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
firmware_size = 512k; |
10 changes: 10 additions & 0 deletions
10
ports/raspberrypi/boards/framework_inputmodule/mpconfigboard.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#define MICROPY_HW_BOARD_NAME "Framework Laptop 16 Keyboard (CircuitPython)" | ||
#define MICROPY_HW_MCU_NAME "rp2040" | ||
|
||
#define CIRCUITPY_BOARD_I2C (1) | ||
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO27, .sda = &pin_GPIO26}} | ||
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO27) | ||
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO26) | ||
// pin_GPIO0 sleep | ||
// pin_GPIO28 INTB | ||
// pin_GPIO29 SDB |
65 changes: 65 additions & 0 deletions
65
ports/raspberrypi/boards/framework_inputmodule/mpconfigboard.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
USB_VID = 0x32AC | ||
USB_PID = 0x001F | ||
USB_PRODUCT = "Generic Framework 16 Inputmodule" | ||
USB_MANUFACTURER = "Framework Computer" | ||
|
||
CHIP_VARIANT = RP2040 | ||
CHIP_FAMILY = rp2 | ||
|
||
QSPI_FLASH_FILESYSTEM = 1 | ||
#EXTERNAL_FLASH_DEVICE_COUNT = 1 | ||
EXTERNAL_FLASH_DEVICES = "W25Q80DV" | ||
|
||
# TODO: This is currently not in circuitpython as a frozen directory | ||
# FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IS31FL3731 | ||
|
||
# Flash is only 1M, reduce firmware to half, so there's space for the CIRCUITPY drive | ||
# Must be accompanied by a linker script change | ||
CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(512 * 1024)' | ||
|
||
#CIRCUITPY_DISPLAULAB_HAS_USER_MODULEYIO = 1 | ||
CIRCUITPY_TOUCHIO = 1 | ||
#CIRCUITPY_PWMIO = 1 | ||
|
||
# Boards have limited IO, only | ||
# - IS31FL3741/IS31FL3731 LED matrix | ||
# - USB 2.0 | ||
# - PWM backlight | ||
# - Capslock LED | ||
#CIRCUITPY_ANALOGIO = 0 # TODO: Might want this | ||
CIRCUITPY_AUDIOBUSIO = 0 | ||
CIRCUITPY_AUDIOBUSIO_I2SOUT = 0 | ||
CIRCUITPY_AUDIOCORE = 0 | ||
CIRCUITPY_AUDIOIO = 0 | ||
CIRCUITPY_AUDIOMIXER = 0 | ||
CIRCUITPY_AUDIOMP3 = 0 | ||
CIRCUITPY_AUDIOPWMIO = 0 | ||
CIRCUITPY_ROTARYIO = 0 | ||
CIRCUITPY_RAINBOWIO = 0 | ||
CIRCUITPY_BLEIO_HCI=0 | ||
CIRCUITPY_BLEIO=0 | ||
CIRCUITPY_PS2IO = 0 | ||
|
||
CIRCUITPY_MSGPACK = 0 | ||
CIRCUITPY_RTC = 1 | ||
CIRCUITPY_FRAMEBUFFERIO = 0 # TODO: Might want this | ||
CIRCUITPY_DISPLAYIO = 0 | ||
CIRCUITPY_TERMINALIO = 0 | ||
CIRCUITPY_VECTORIO = 0 | ||
CIRCUITPY_ULAB = 0 # Like numpy for circuitpython | ||
CIRCUITPY_USB_MIDI=0 | ||
|
||
#CIRCUITPY_BITBANG_APA102 = 0 | ||
#CIRCUITPY_BITBANGIO = 1 # Need for I2C | ||
#CIRCUITPY_BITMAPTOOLS = 0 | ||
#CIRCUITPY_BUSDEVICE = 1 # TODO: What's this? | ||
#CIRCUITPY_FREQUENCYIO = 0 | ||
#CIRCUITPY_I2CTARGET = 1 | ||
#CIRCUITPY_NEOPIXEL_WRITE = 0 | ||
#CIRCUITPY_NVM = 0 | ||
#CIRCUITPY_PIXELBUF = 0 | ||
#CIRCUITPY_PULSEIO = 0 | ||
#CIRCUITPY_RGBMATRIX = 0 | ||
#CIRCUITPY_SAMD = 0 | ||
#CIRCUITPY_USB_HID = 0 # TODO: Might want this | ||
#CIRCUITPY_USB_VENDOR = 0 # TODO: Might want this |
4 changes: 4 additions & 0 deletions
4
ports/raspberrypi/boards/framework_inputmodule/pico-sdk-configboard.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Put board-specific pico-sdk definitions here. This file must exist. | ||
|
||
// Allow extra time for xosc to start. | ||
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "shared-bindings/board/__init__.h" | ||
|
||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = { | ||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS | ||
|
||
// SLEEP# | ||
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, | ||
// INTB | ||
{ MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, | ||
// SDB | ||
{ MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, | ||
|
||
// PWM | ||
{ MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, | ||
// Capslock | ||
{ MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, | ||
|
||
// LED Controller I2C | ||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO26) }, | ||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO27) }, | ||
|
||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, | ||
}; | ||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,11 +99,15 @@ void port_internal_flash_flush(void) { | |
// Make sure we don't have an interrupt while we do flash operations. | ||
common_hal_mcu_disable_interrupts(); | ||
// and audio DMA must be paused as well | ||
#if CIRCUITPY_AUDIOCORE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made a separate PR for this: #8271 |
||
uint32_t channel_mask = audio_dma_pause_all(); | ||
#endif | ||
flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, SECTOR_SIZE); | ||
flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, _cache, SECTOR_SIZE); | ||
_cache_lba = NO_CACHE; | ||
#if CIRCUITPY_AUDIOCORE | ||
audio_dma_unpause_mask(channel_mask); | ||
#endif | ||
common_hal_mcu_enable_interrupts(); | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding in the missing changes I believe are necessary to get the board working from FrameworkComputer/Framework_Inputmodule_CircuitPython#2 (comment)