Skip to content

Commit b245f9c

Browse files
authored
Merge pull request #2591 from neubauek/master
Added CircuitBrains Basic and Deluxe Boards
2 parents a63f49c + d93d491 commit b245f9c

File tree

9 files changed

+271
-0
lines changed

9 files changed

+271
-0
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ jobs:
130130
- "bast_pro_mini_m0"
131131
- "capablerobot_usbhub"
132132
- "catwan_usbstick"
133+
- "circuitbrains_basic_m0"
134+
- "circuitbrains_deluxe_m4"
133135
- "circuitplayground_bluefruit"
134136
- "circuitplayground_express"
135137
- "circuitplayground_express_crickit"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Original work copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
* Modified work copyright (c) 2019 Kevin Neubauer for Null Byte Labs LLC
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
28+
#include "boards/board.h"
29+
#include "mpconfigboard.h"
30+
#include "hal/include/hal_gpio.h"
31+
32+
void board_init(void) {
33+
}
34+
35+
bool board_requests_safe_mode(void) {
36+
return false;
37+
}
38+
39+
void reset_board(void) {
40+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#define MICROPY_HW_BOARD_NAME "CircuitBrains Basic"
2+
#define MICROPY_HW_MCU_NAME "samd21e18"
3+
4+
#define CIRCUITPY_MCU_FAMILY samd21
5+
6+
#define MICROPY_HW_LED_STATUS (&pin_PA14)
7+
8+
// On-board flash
9+
#define SPI_FLASH_MOSI_PIN &pin_PA16
10+
#define SPI_FLASH_MISO_PIN &pin_PA18
11+
#define SPI_FLASH_SCK_PIN &pin_PA17
12+
#define SPI_FLASH_CS_PIN &pin_PA19
13+
14+
// These are pins not to reset.
15+
#define MICROPY_PORT_A (0)
16+
#define MICROPY_PORT_B (0)
17+
#define MICROPY_PORT_C (0)
18+
19+
#define SPI_FLASH_BAUDRATE (8000000)
20+
21+
#define CALIBRATE_CRYSTALLESS 1
22+
23+
#define DEFAULT_I2C_BUS_SCL (&pin_PA05)
24+
#define DEFAULT_I2C_BUS_SDA (&pin_PA04)
25+
26+
#define DEFAULT_SPI_BUS_SCK (&pin_PA11)
27+
#define DEFAULT_SPI_BUS_MOSI (&pin_PA10)
28+
#define DEFAULT_SPI_BUS_MISO (&pin_PA09)
29+
30+
#define DEFAULT_UART_BUS_RX (&pin_PA07)
31+
#define DEFAULT_UART_BUS_TX (&pin_PA06)
32+
33+
// USB is always used internally so skip the pin objects for it.
34+
#define IGNORE_PIN_PA24 1
35+
#define IGNORE_PIN_PA25 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
USB_VID = 0x04D8
2+
USB_PID = 0xEC63
3+
USB_PRODUCT = "CircuitBrains Basic"
4+
USB_MANUFACTURER = "Kevin Neubauer"
5+
6+
CHIP_VARIANT = SAMD21E18A
7+
CHIP_FAMILY = samd21
8+
9+
SPI_FLASH_FILESYSTEM = 1
10+
EXTERNAL_FLASH_DEVICE_COUNT = 1
11+
EXTERNAL_FLASH_DEVICES = "W25Q32JV_IQ"
12+
LONGINT_IMPL = MPZ
13+
14+
CIRCUITPY_BITBANGIO = 0
15+
CIRCUITPY_FREQUENCYIO = 0
16+
CIRCUITPY_I2CSLAVE = 0
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "shared-bindings/board/__init__.h"
2+
3+
// This mapping only includes functional names because pins broken
4+
// out on connectors are labeled with their MCU name available from
5+
// microcontroller.pin.
6+
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
7+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
8+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA06) },
9+
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA06) },
10+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA07) },
11+
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) },
12+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA08) },
13+
14+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA00) },
15+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA01) },
16+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA28) },
17+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA27) },
18+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA23) },
19+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA22) },
20+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA15) },
21+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA14) },
22+
{ MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PA14) },
23+
24+
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PA04) },
25+
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PA05) },
26+
27+
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA11) },
28+
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA10) },
29+
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA09) },
30+
31+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
32+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
33+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
34+
};
35+
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Original work copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
* Modified work copyright (c) 2019 Kevin Neubauer for Null Byte Labs LLC
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
28+
#include "boards/board.h"
29+
#include "mpconfigboard.h"
30+
#include "hal/include/hal_gpio.h"
31+
32+
void board_init(void) {
33+
}
34+
35+
bool board_requests_safe_mode(void) {
36+
return false;
37+
}
38+
39+
void reset_board(void) {
40+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#define MICROPY_HW_BOARD_NAME "CircuitBrains Deluxe"
2+
#define MICROPY_HW_MCU_NAME "samd51j19"
3+
4+
#define CIRCUITPY_MCU_FAMILY samd51
5+
6+
#define MICROPY_HW_LED_STATUS (&pin_PB13)
7+
8+
// These are pins not to reset.
9+
// QSPI Data pins
10+
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
11+
// QSPI CS, QSPI SCK
12+
#define MICROPY_PORT_B (PORT_PB10 | PORT_PB11)
13+
#define MICROPY_PORT_C (0)
14+
#define MICROPY_PORT_D (0)
15+
16+
#define AUTORESET_DELAY_MS 500
17+
18+
#define BOARD_HAS_CRYSTAL 1
19+
20+
#define DEFAULT_I2C_BUS_SCL (&pin_PB03)
21+
#define DEFAULT_I2C_BUS_SDA (&pin_PB02)
22+
23+
#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
24+
#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
25+
#define DEFAULT_SPI_BUS_MISO (&pin_PA14)
26+
27+
#define DEFAULT_UART_BUS_RX (&pin_PA23)
28+
#define DEFAULT_UART_BUS_TX (&pin_PA22)
29+
30+
// USB is always used internally so skip the pin objects for it.
31+
#define IGNORE_PIN_PA24 1
32+
#define IGNORE_PIN_PA25 1
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
USB_VID = 0x04D8
2+
USB_PID = 0xEC64
3+
USB_PRODUCT = "CircuitBrains Deluxe"
4+
USB_MANUFACTURER = "Kevin Neubauer"
5+
6+
CHIP_VARIANT = SAMD51J19A
7+
CHIP_FAMILY = samd51
8+
9+
QSPI_FLASH_FILESYSTEM = 1
10+
EXTERNAL_FLASH_DEVICE_COUNT = 2
11+
EXTERNAL_FLASH_DEVICES = "W25Q64JV_IQ, S25FL064L"
12+
LONGINT_IMPL = MPZ
13+
14+
CIRCUITPY_NETWORK = 1
15+
MICROPY_PY_WIZNET5K = 5500
16+
CIRCUITPY_PS2IO = 1
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include "shared-bindings/board/__init__.h"
2+
3+
// This mapping only includes functional names because pins broken
4+
// out on connectors are labeled with their MCU name available from
5+
// microcontroller.pin.
6+
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
7+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
8+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB04) },
9+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB05) },
10+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB06) },
11+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB07) },
12+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB08) },
13+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB09) },
14+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PA04) },
15+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_PA05) },
16+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_PA06) },
17+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_PA07) },
18+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_PB00) },
19+
{ MP_OBJ_NEW_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_PB01) },
20+
21+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA23) },
22+
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA23) },
23+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA22) },
24+
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA22) },
25+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA21) },
26+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA20) },
27+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB17) },
28+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB16) },
29+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA19) },
30+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA18) },
31+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA17) },
32+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA16) },
33+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA15) },
34+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PB15) },
35+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB14) },
36+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB13) },
37+
{ MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PB13) },
38+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB12) },
39+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB31) },
40+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PA27) },
41+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB23) },
42+
{ MP_OBJ_NEW_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB22) },
43+
44+
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) },
45+
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) },
46+
47+
{ MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) },
48+
{ MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) },
49+
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) },
50+
51+
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
52+
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
53+
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
54+
};
55+
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

0 commit comments

Comments
 (0)