Skip to content

Commit

Permalink
Merge pull request #9797 from bradanlane/bls_coin_m0
Browse files Browse the repository at this point in the history
Add new atmel-samd  board - Bradán Lane STUDIO Coin M0
  • Loading branch information
dhalbert authored Nov 19, 2024
2 parents ca123ee + 5c2d351 commit 2f37194
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ports/atmel-samd/boards/bradanlanestudio_coin_m0/board.c
Original file line number Diff line number Diff line change
@@ -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.
24 changes: 24 additions & 0 deletions ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions ports/atmel-samd/boards/bradanlanestudio_coin_m0/mpconfigboard.mk
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions ports/atmel-samd/boards/bradanlanestudio_coin_m0/pins.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 2f37194

Please sign in to comment.