From eb0bc71d2fc4319143681d3324328696308f6716 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 27 Feb 2021 16:49:54 +0100 Subject: [PATCH 1/3] New board: Fluff M0 Headless This is the same as Fluff M0, but disables the MSC, CDC and MIDI USB endpoints. This is useful for devices like keyboards or mice running CircuitPython, once we are happy with their code and don't want to change it anymore. I'm adding this board mostly so that we have a test for this case. --- .../boards/fluff_m0_headless/board.c | 38 +++++++++++++++++++ .../boards/fluff_m0_headless/mpconfigboard.h | 12 ++++++ .../boards/fluff_m0_headless/mpconfigboard.mk | 34 +++++++++++++++++ .../boards/fluff_m0_headless/pins.c | 36 ++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 ports/atmel-samd/boards/fluff_m0_headless/board.c create mode 100644 ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/fluff_m0_headless/pins.c diff --git a/ports/atmel-samd/boards/fluff_m0_headless/board.c b/ports/atmel-samd/boards/fluff_m0_headless/board.c new file mode 100644 index 0000000000000..6baa43ffaa3cb --- /dev/null +++ b/ports/atmel-samd/boards/fluff_m0_headless/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * 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" + +void board_init(void) +{ +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.h b/ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.h new file mode 100644 index 0000000000000..9f3685490cc16 --- /dev/null +++ b/ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.h @@ -0,0 +1,12 @@ +#define MICROPY_HW_BOARD_NAME "Fluff M0 Headless" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 + +#define SAMD21_BOD33_LEVEL (6) diff --git a/ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.mk b/ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.mk new file mode 100644 index 0000000000000..1222189484788 --- /dev/null +++ b/ports/atmel-samd/boards/fluff_m0_headless/mpconfigboard.mk @@ -0,0 +1,34 @@ +USB_VID = 0x239A +USB_PID = 0x80B0 +USB_PRODUCT = "Fluff M0" +USB_MANUFACTURER = "Radomir Dopieralski" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 +CIRCUITPY_NEOPIXEL_WRITE = 1 +CIRCUITPY_PIXELBUF = 1 +CIRCUITPY_ROTARYIO = 1 +CIRCUITPY_RTC = 0 +CIRCUITPY_STORAGE = 0 + +SUPEROPT_GC = 1 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 + +CIRCUITPY_USB_MIDI = 0 +CIRCUITPY_USB_MSC = 0 +CIRCUITPY_USB_CDC = 0 +CIRCUITPY_USB_VENDOR = 0 + +CIRCUITPY_USB_HID = 1 +CIRCUITPY_USB_HID_CONSUMER = 1 +CIRCUITPY_USB_HID_KEYBOARD = 1 +CIRCUITPY_USB_HID_MOUSE = 1 +CIRCUITPY_USB_HID_SYS_CONTROL = 1 +CIRCUITPY_USB_HID_GAMEPAD = 1 +CIRCUITPY_USB_HID_DIGITIZER = 0 +CIRCUITPY_USB_HID_XAC_COMPATIBLE_GAMEPAD = 0 diff --git a/ports/atmel-samd/boards/fluff_m0_headless/pins.c b/ports/atmel-samd/boards/fluff_m0_headless/pins.c new file mode 100644 index 0000000000000..66d01b0bcd4ab --- /dev/null +++ b/ports/atmel-samd/boards/fluff_m0_headless/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_PA03) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PA07) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA31) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA00) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA30) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA01) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PA27) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA28) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); From b97ca3bc2ed4f982f996cdc81f77de613da52270 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sat, 27 Feb 2021 20:39:41 +0100 Subject: [PATCH 2/3] Add fluff m0 headless to the build.xml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7d0f8a981cf8..e163ce8088f95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -233,6 +233,7 @@ jobs: - "feather_radiofruit_zigbee" - "feather_stm32f405_express" - "fluff_m0" + - "fluff_m0_headless" - "gemma_m0" - "grandcentral_m4_express" - "hallowing_m0_express" From 9b3fc83fde1a63dc49c0a8b90228d22211be1bdf Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Mon, 1 Mar 2021 23:40:24 +0100 Subject: [PATCH 3/3] Add fluff_m0_headless to the duplicate vid/pid ignore list --- tools/ci_check_duplicate_usb_vid_pid.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index cb4efc5f11366..cc7cc09176d6a 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -46,7 +46,8 @@ "cp32-m4", "metro_m4_express", "unexpectedmaker_feathers2", - "unexpectedmaker_feathers2_prerelease" + "unexpectedmaker_feathers2_prerelease", + "fluff_m0_headless", ] cli_parser = argparse.ArgumentParser(description="USB VID/PID Duplicate Checker")