diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/README.md b/ports/rp2/boards/NULLBITS_BIT_C_PRO/README.md new file mode 100644 index 0000000000..0849108413 --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/README.md @@ -0,0 +1,17 @@ +# nullbits Bit-C PRO + +The nullbits Bit-C PRO Board is based on the Raspberry Pi RP2040, and comes in the Arduino Pro Micro footprint. + + +## Board-specific modules + +The `board` module contains definitions for the onboard RGB LED. + +Example: + +```python +>>> import board +>>> board.led_red.on() +>>> board.led_green.on() +>>> board.led_blue.on() +``` diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/board.json b/ports/rp2/boards/NULLBITS_BIT_C_PRO/board.json new file mode 100644 index 0000000000..2aff0580d8 --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/board.json @@ -0,0 +1,20 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [ + "Breadboard Friendly", + "RGB LED", + "USB-C", + "SPI Flash" + ], + "images": [ + "nullbits_bit_c_pro.jpg" + ], + "mcu": "rp2040", + "product": "Bit-C PRO", + "thumbnail": "", + "url": "https://nullbits.co/bit-c-pro", + "vendor": "nullbits" +} diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/board.py b/ports/rp2/boards/NULLBITS_BIT_C_PRO/board.py new file mode 100644 index 0000000000..9ee8cc806f --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/board.py @@ -0,0 +1,7 @@ +from machine import Pin, Signal + +led_red = Signal("LED_RED", Pin.OUT, invert=True, value=0) +led_green = Signal("LED_GREEN", Pin.OUT, invert=True, value=0) +led_blue = Signal("LED_BLUE", Pin.OUT, invert=True, value=0) + +del Pin diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/manifest.py b/ports/rp2/boards/NULLBITS_BIT_C_PRO/manifest.py new file mode 100644 index 0000000000..3a6af47a16 --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/manifest.py @@ -0,0 +1,2 @@ +include("$(PORT_DIR)/boards/manifest.py") +module("board.py") diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/mpconfigboard.cmake b/ports/rp2/boards/NULLBITS_BIT_C_PRO/mpconfigboard.cmake new file mode 100644 index 0000000000..050ca347be --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/mpconfigboard.cmake @@ -0,0 +1,10 @@ +# cmake file for nullbits Bit-C PRO + +# The Bit-C PRO is not yet in upstream pico-sdk, so define it here +# See also: https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards +list(APPEND PICO_BOARD_HEADER_DIRS ${MICROPY_BOARD_DIR}) + +set(PICO_BOARD "nullbits_bit_c_pro") + +# Freeze board.py +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/mpconfigboard.h b/ports/rp2/boards/NULLBITS_BIT_C_PRO/mpconfigboard.h new file mode 100644 index 0000000000..e28c379fa7 --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/mpconfigboard.h @@ -0,0 +1,9 @@ +// https://nullbits.co/bit-c-pro + +#define MICROPY_HW_BOARD_NAME "nullbits Bit-C PRO" +#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (1 * 512 * 1024)) // 512K reserved + +// RGB LED, active low +// Red LED 16 +// Green LED 17 +// Blue LED 18 diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/nullbits_bit_c_pro.h b/ports/rp2/boards/NULLBITS_BIT_C_PRO/nullbits_bit_c_pro.h new file mode 100644 index 0000000000..2e8b03a430 --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/nullbits_bit_c_pro.h @@ -0,0 +1,96 @@ +// Board definition for the nullbits Bit-C PRO + +#ifndef _BOARDS_NULLBITS_BIT_C_PRO_H +#define _BOARDS_NULLBITS_BIT_C_PRO_H + +// For board detection +#define NULLBITS_BIT_C_PRO + +// On some samples, the xosc can take longer to stabilize than is usual +#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 +#endif + +// --- BOARD SPECIFIC --- +#define BIT_C_PRO_LED_R_PIN 16 +#define BIT_C_PRO_LED_G_PIN 17 +#define BIT_C_PRO_LED_B_PIN 18 + +// ------------- UART -------------// +#ifndef PICO_DEFAULT_UART +#define PICO_DEFAULT_UART 0 +#endif + +#ifndef PICO_DEFAULT_UART_TX_PIN +#define PICO_DEFAULT_UART_TX_PIN 0 +#endif + +#ifndef PICO_DEFAULT_UART_RX_PIN +#define PICO_DEFAULT_UART_RX_PIN 1 +#endif + +// --- LED --- +// Set the default LED to the Bit-C PRO's B led +#ifndef PICO_DEFAULT_LED_PIN +#define PICO_DEFAULT_LED_PIN BIT_C_PRO_LED_B_PIN +#endif + +#ifndef PICO_DEFAULT_LED_PIN_INVERTED +#define PICO_DEFAULT_LED_PIN_INVERTED 1 +#endif +// no PICO_DEFAULT_WS2812_PIN + +// ------------- I2C -------------// +#ifndef PICO_DEFAULT_I2C +#define PICO_DEFAULT_I2C 0 +#endif + +#ifndef PICO_DEFAULT_I2C_SDA_PIN +#define PICO_DEFAULT_I2C_SDA_PIN 2 +#endif + +#ifndef PICO_DEFAULT_I2C_SCL_PIN +#define PICO_DEFAULT_I2C_SCL_PIN 3 +#endif + +// ------------- SPI -------------// +#ifndef PICO_DEFAULT_SPI +#define PICO_DEFAULT_SPI 0 +#endif + +#ifndef PICO_DEFAULT_SPI_TX_PIN +#define PICO_DEFAULT_SPI_TX_PIN 23 +#endif + +#ifndef PICO_DEFAULT_SPI_RX_PIN +#define PICO_DEFAULT_SPI_RX_PIN 20 +#endif + +#ifndef PICO_DEFAULT_SPI_SCK_PIN +#define PICO_DEFAULT_SPI_SCK_PIN 22 +#endif + +#ifndef PICO_DEFAULT_SPI_CSN_PIN +#define PICO_DEFAULT_SPI_CSN_PIN 21 +#endif + +// ------------- FLASH -------------// + +// Best performance/compatibility with selected flash +#define PICO_BOOT_STAGE2_CHOOSE_W25X10CL 1 + +#ifndef PICO_FLASH_SPI_CLKDIV +#define PICO_FLASH_SPI_CLKDIV 2 +#endif + +// Bit-C PRO has 4MB SPI flash +#ifndef PICO_FLASH_SIZE_BYTES +#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024) +#endif + +// All boards have B1+ RP2040 +#ifndef PICO_RP2040_B0_SUPPORTED +#define PICO_RP2040_B0_SUPPORTED 0 +#endif + +#endif diff --git a/ports/rp2/boards/NULLBITS_BIT_C_PRO/pins.csv b/ports/rp2/boards/NULLBITS_BIT_C_PRO/pins.csv new file mode 100644 index 0000000000..1274effaef --- /dev/null +++ b/ports/rp2/boards/NULLBITS_BIT_C_PRO/pins.csv @@ -0,0 +1,4 @@ +LED,GPIO16 +LED_RED,GPIO16 +LED_GREEN,GPIO17 +LED_BLUE,GPIO18