diff --git a/ports/atmel-samd/boards/bradanlanestudio_coin_m0/board.c b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/board.c new file mode 100644 index 000000000000..b44a1ae51e04 --- /dev/null +++ b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/board.c @@ -0,0 +1,9 @@ +// This file is part of the CircuitPython project: https://circuitpython.org +// +// SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries +// +// SPDX-License-Identifier: MIT + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.h b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.h new file mode 100644 index 000000000000..cdd5c96aeba2 --- /dev/null +++ b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.h @@ -0,0 +1,24 @@ +// This file is part of the CircuitPython project: https://circuitpython.org +// +// SPDX-FileCopyrightText: Copyright (c) 2024 Bradán Lane STUDIO +// +// SPDX-License-Identifier: MIT + +#pragma once + +#define MICROPY_HW_BOARD_NAME "Bradán Lane STUDIO Coin M0" +#define MICROPY_HW_MCU_NAME "samd21g18" + +#define MICROPY_HW_LED_STATUS (&pin_PA17) + +#define SPI_FLASH_MOSI_PIN &pin_PB22 +#define SPI_FLASH_MISO_PIN &pin_PB03 +#define SPI_FLASH_SCK_PIN &pin_PB23 +#define SPI_FLASH_CS_PIN &pin_PA27 + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 // USB_D+ +#define IGNORE_PIN_PA25 1 // USB_D- + +#define IGNORE_PIN_PA30 1 // SWCLK +#define IGNORE_PIN_PA31 1 // SWDIO diff --git a/ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.mk b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.mk new file mode 100644 index 000000000000..33165c8cfc5d --- /dev/null +++ b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.mk @@ -0,0 +1,45 @@ +# This file is part of the CircuitPython project: https://circuitpython.org +# +# SPDX-FileCopyrightText: Copyright (c) 2024 Bradán Lane STUDIO +# +# SPDX-License-Identifier: MIT + +# TODO new VID:PID not yet approved via pidcodes.github.com +USB_VID = 0x1209 +USB_PID = 0x5687 + +USB_PRODUCT = "Coin M0" +USB_MANUFACTURER = "Bradán Lane STUDIO" + +CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 + +#CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + +SPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" +LONGINT_IMPL = NONE + +# the M0 Coin has limited functionality and many modules can be eliminated + +# there may be more modules which are of no used but will require further digging + +# Disable modules that are unusable on this special-purpose board. + +CIRCUITPY_FULL_BUILD = 0 + +CIRCUITPY_AUDIOIO = 1 +CIRCUITPY_DISPLAYIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_ONEWIREIO = 0 +CIRCUITPY_PULSEIO = 0 +CIRCUITPY_RGBMATRIX = 0 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_RTC = 0 +CIRCUITPY_USB_HID = 1 +CIRCUITPY_USB_MIDI = 0 + + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/bradanlanestudio_coin_m0/pins.c b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/pins.c new file mode 100644 index 000000000000..7e74918ee465 --- /dev/null +++ b/ports/atmel-samd/boards/bradanlanestudio_coin_m0/pins.c @@ -0,0 +1,35 @@ +// This file is part of the CircuitPython project: https://circuitpython.org +// +// SPDX-FileCopyrightText: Copyright (c) 2017 Scott Shawcroft for Adafruit Industries +// +// SPDX-License-Identifier: MIT + +#include "shared-bindings/board/__init__.h" + +static const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Neopixels + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA07) }, + + // discrete LEDs + { 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) }, + + // on-board LED + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, // Analog only; no PWM + { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_PA02) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH2), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH1), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH3), MP_ROM_PTR(&pin_PB02) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);