forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add 2 boards nRF52840 M.2 devkit and M60 Keyboard #3136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fce35c3
Fluff M0: additional pins on version 1.3 of the board
deshipu 4d7b9cd
Merge pull request #3109 from pewpew-game/fluff_m0
tannewt e81d22c
add makerdiary nrf52840 m.2 devkit
xiongyihui 96f6ce2
add makerdiary m60 keyboard
xiongyihui 8fef698
add m60 keyboard and nrf52840 m.2 devkit to build action
xiongyihui 678f266
fix pre-commit check
xiongyihui 7ff4990
use VID & PIDs granted by Seeed
xiongyihui 8e26fdc
add LED status, remove unused macros
xiongyihui c8752ff
use RGB LEDs as status indicators
xiongyihui d712d12
Merge branch 'main' into master
tannewt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Makerdiary M60 Keyboard | ||
|
||
M60 is a USB & BLE, modular, hot-swappable, 60% keyboard powered by Python. | ||
Refer to https://makerdiary.com/m60 for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 "boards/board.h" | ||
|
||
void board_init(void) { | ||
} | ||
|
||
bool board_requests_safe_mode(void) { | ||
return false; | ||
} | ||
|
||
void reset_board(void) { | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* This file is part of the MicroPython project, http://micropython.org/ | ||
* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2016 Glenn Ruben Bakke | ||
* Copyright (c) 2018 Dan Halbert 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 "nrfx/hal/nrf_gpio.h" | ||
|
||
#define MAKERDIARYM60KEYBOARD | ||
|
||
#define MICROPY_HW_BOARD_NAME "Makerdiary M60 Keyboard" | ||
#define MICROPY_HW_MCU_NAME "nRF52840" | ||
|
||
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) | ||
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) | ||
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(1, 15) | ||
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(1, 12) | ||
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(1, 11) | ||
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 13) | ||
|
||
#define BOARD_HAS_CRYSTAL 1 | ||
|
||
// #define DEFAULT_UART_BUS_RX (&pin_P0_15) | ||
// #define DEFAULT_UART_BUS_TX (&pin_P0_16) | ||
|
||
#define DEFAULT_I2C_BUS_SCL (&pin_P1_06) | ||
#define DEFAULT_I2C_BUS_SDA (&pin_P1_05) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
USB_VID = 0x2886 | ||
USB_PID = 0xf002 | ||
USB_PRODUCT = "M60 Keyboard" | ||
USB_MANUFACTURER = "Makerdiary" | ||
|
||
MCU_CHIP = nrf52840 | ||
|
||
QSPI_FLASH_FILESYSTEM = 1 | ||
EXTERNAL_FLASH_DEVICE_COUNT = 1 | ||
EXTERNAL_FLASH_DEVICES = "MX25R6435F" | ||
|
||
CIRCUITPY_ENABLE_MPY_NATIVE = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "shared-bindings/board/__init__.h" | ||
|
||
#include "boards/board.h" | ||
#include "shared-module/displayio/__init__.h" | ||
|
||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = { | ||
{ MP_ROM_QSTR(MP_QSTR_R1), MP_ROM_PTR(&pin_P0_05) }, | ||
{ MP_ROM_QSTR(MP_QSTR_R2), MP_ROM_PTR(&pin_P0_06) }, | ||
{ MP_ROM_QSTR(MP_QSTR_R3), MP_ROM_PTR(&pin_P0_07) }, | ||
{ MP_ROM_QSTR(MP_QSTR_R4), MP_ROM_PTR(&pin_P0_08) }, | ||
{ MP_ROM_QSTR(MP_QSTR_R5), MP_ROM_PTR(&pin_P1_09) }, | ||
{ MP_ROM_QSTR(MP_QSTR_R6), MP_ROM_PTR(&pin_P1_08) }, | ||
{ MP_ROM_QSTR(MP_QSTR_R7), MP_ROM_PTR(&pin_P0_12) }, | ||
{ MP_ROM_QSTR(MP_QSTR_R8), MP_ROM_PTR(&pin_P0_11) }, | ||
|
||
{ MP_ROM_QSTR(MP_QSTR_C1), MP_ROM_PTR(&pin_P0_19) }, | ||
{ MP_ROM_QSTR(MP_QSTR_C2), MP_ROM_PTR(&pin_P0_20) }, | ||
{ MP_ROM_QSTR(MP_QSTR_C3), MP_ROM_PTR(&pin_P0_21) }, | ||
{ MP_ROM_QSTR(MP_QSTR_C4), MP_ROM_PTR(&pin_P0_22) }, | ||
{ MP_ROM_QSTR(MP_QSTR_C5), MP_ROM_PTR(&pin_P0_23) }, | ||
{ MP_ROM_QSTR(MP_QSTR_C6), MP_ROM_PTR(&pin_P0_24) }, | ||
{ MP_ROM_QSTR(MP_QSTR_C7), MP_ROM_PTR(&pin_P0_25) }, | ||
{ MP_ROM_QSTR(MP_QSTR_C8), MP_ROM_PTR(&pin_P0_26) }, | ||
|
||
{ MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_16) }, | ||
{ MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P0_15) }, | ||
|
||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_06) }, | ||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_05) }, | ||
|
||
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_P0_30) }, | ||
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_P0_29) }, | ||
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_P0_31) }, | ||
xiongyihui marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{ MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_P0_27) }, | ||
|
||
// { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, | ||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) } | ||
}; | ||
|
||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Makerdiary nRF52840 M.2 Developer Kit | ||
|
||
The devkit is a versatile IoT prototyping platform, | ||
including the nRF52840 M.2 Module and M.2 Dock. You can use the developer kit | ||
to prototype your IoT products and then scale to production faster using the | ||
nRF52840 M.2 Module combined with your custom PCB hardware. | ||
|
||
Refer to https://github.com/makerdiary/nrf52840-m2-devkit for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* This file is part of the MicroPython project, http://micropython.org/ | ||
* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries | ||
* Copyright (c) 2020 Yihui Xiong for Makerdiary | ||
* | ||
* 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 "boards/board.h" | ||
#include "mpconfigboard.h" | ||
|
||
#include "shared-bindings/busio/SPI.h" | ||
#include "shared-bindings/displayio/FourWire.h" | ||
#include "shared-module/displayio/__init__.h" | ||
#include "shared-module/displayio/mipi_constants.h" | ||
|
||
displayio_fourwire_obj_t board_display_obj; | ||
|
||
#define DELAY 0x80 | ||
|
||
uint8_t display_init_sequence[] = { | ||
0x01, 0 | DELAY, 150, // SWRESET | ||
0x11, 0 | DELAY, 255, // SLPOUT | ||
0x36, 1, 0b10100000, // _MADCTL for rotation 0 | ||
0x3a, 1, 0x55, // COLMOD - 16bit color | ||
0x21, 0 | DELAY, 10, // _INVON | ||
0x13, 0 | DELAY, 10, // _NORON | ||
0x29, 0 | DELAY, 255, // _DISPON | ||
}; | ||
|
||
void board_init(void) { | ||
busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; | ||
common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, NULL); | ||
common_hal_busio_spi_never_reset(spi); | ||
|
||
displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; | ||
bus->base.type = &displayio_fourwire_type; | ||
common_hal_displayio_fourwire_construct(bus, | ||
spi, | ||
&pin_P0_08, // TFT_DC Command or data | ||
&pin_P0_06, // TFT_CS Chip select | ||
&pin_P1_09, // TFT_RST Reset | ||
60000000, // Baudrate | ||
0, // Polarity | ||
0); // Phase | ||
|
||
displayio_display_obj_t* display = &displays[0].display; | ||
display->base.type = &displayio_display_type; | ||
common_hal_displayio_display_construct(display, | ||
bus, | ||
240, // Width (after rotation) | ||
240, // Height (after rotation) | ||
80, // column start | ||
0, // row start | ||
0, // rotation | ||
16, // Color depth | ||
false, // Grayscale | ||
false, // Pixels in a byte share a row. Only used for depth < 8 | ||
1, // bytes per cell. Only valid for depths < 8 | ||
false, // reverse_pixels_in_byte. Only valid for depths < 8 | ||
true, // reverse_pixels_in_word | ||
MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command | ||
MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command | ||
MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command | ||
37, // set vertical scroll command | ||
display_init_sequence, | ||
sizeof(display_init_sequence), | ||
&pin_P0_20, // backlight pin | ||
NO_BRIGHTNESS_COMMAND, | ||
1.0f, // brightness (ignored) | ||
true, // auto_brightness | ||
false, // single_byte_bounds | ||
false, // data_as_commands | ||
true, // auto_refresh | ||
60, // native_frames_per_second | ||
true); // backlight_on_high | ||
} | ||
|
||
bool board_requests_safe_mode(void) { | ||
return false; | ||
} | ||
|
||
void reset_board(void) { | ||
} |
52 changes: 52 additions & 0 deletions
52
ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* This file is part of the MicroPython project, http://micropython.org/ | ||
* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2016 Glenn Ruben Bakke | ||
* Copyright (c) 2018 Dan Halbert 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 "nrfx/hal/nrf_gpio.h" | ||
|
||
#define MAKERDIARYNRF52840M2DEVKIT | ||
|
||
#define MICROPY_HW_BOARD_NAME "Makerdiary nRF52840 M.2 Developer Kit" | ||
#define MICROPY_HW_MCU_NAME "nRF52840" | ||
|
||
#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 10) | ||
#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(1, 14) | ||
#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(1, 15) | ||
#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(1, 12) | ||
#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(1, 11) | ||
#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 13) | ||
|
||
#define BOARD_HAS_CRYSTAL 1 | ||
|
||
#define DEFAULT_UART_BUS_RX (&pin_P0_15) | ||
#define DEFAULT_UART_BUS_TX (&pin_P0_16) | ||
|
||
#define DEFAULT_I2C_BUS_SCL (&pin_P1_06) | ||
#define DEFAULT_I2C_BUS_SDA (&pin_P1_05) | ||
|
||
#define DEFAULT_SPI_BUS_SCK (&pin_P0_11) | ||
#define DEFAULT_SPI_BUS_MOSI (&pin_P0_12) | ||
#define DEFAULT_SPI_BUS_MISO (&pin_P1_08) |
12 changes: 12 additions & 0 deletions
12
ports/nrf/boards/makerdiary_nrf52840_m2_devkit/mpconfigboard.mk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
USB_VID = 0x2886 | ||
USB_PID = 0xf001 | ||
USB_PRODUCT = "nRF52840 M.2 Developer Kit" | ||
USB_MANUFACTURER = "Makerdiary" | ||
|
||
MCU_CHIP = nrf52840 | ||
|
||
QSPI_FLASH_FILESYSTEM = 1 | ||
EXTERNAL_FLASH_DEVICE_COUNT = 1 | ||
EXTERNAL_FLASH_DEVICES = "MX25R6435F" | ||
|
||
CIRCUITPY_ENABLE_MPY_NATIVE = 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.