fwk_keyboard: Add new rp2040 based board

Signed-off-by: Daniel Schaefer <dhs@frame.work>
This commit is contained in:
Daniel Schaefer 2023-07-29 23:31:03 +08:00
parent 75ba17e84e
commit 1c5fa3c042
5 changed files with 101 additions and 0 deletions

View File

@ -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.

View File

@ -0,0 +1,30 @@
#define MICROPY_HW_BOARD_NAME "Framework Laptop 16 Keyboard (CircuitPython)"
#define MICROPY_HW_MCU_NAME "rp2040"
//#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
// External flash W25Q80DV
#define EXTERNAL_FLASH_QSPI_DUAL
#if QSPI_FLASH_FILESYSTEM
//#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 00)
//#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21)
//#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22)
//#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 23)
//#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
//#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
#endif
#define CIRCUITPY_DRIVE_LABEL "CIRCUITPY"
#define CIRCUITPY_BOOT_COUNTER 1
#define FLASH_SIZE (0x100000)
#define FLASH_PAGE_SIZE (0x4000)
#define BOARD_HAS_CRYSTAL 1
#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

View File

@ -0,0 +1,13 @@
USB_VID = 0x32AC
USB_PID = 0x0013
USB_PRODUCT = "Ledmatrix Laptop 16 Keyboard (CircuitPython)"
USB_MANUFACTURER = "Framework Computer Inc"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2
QSPI_FLASH_FILESYSTEM = 1
#EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = "W25Q80DV"
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IS31FL3731

View File

@ -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

View File

@ -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);