Skip to content

Interstate75 Duo Support & Firmware #30

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

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
063f6e3
Duo75: Add Interstate 75 Duo support.
Gadgetoid Apr 10, 2025
6916342
Duo75: Add Duo75 driver and MicroPython bindings.
Gadgetoid Apr 10, 2025
9eeb23c
modules/pimoroni: Drop cruft, default RGB args.
Gadgetoid Apr 10, 2025
7261c99
CI: Add i75_duo to build list.
Gadgetoid Apr 10, 2025
bc57b20
Duo75: Add other display types to avoid an import error.
Gadgetoid Apr 10, 2025
fea61d3
examples: Swap fast fire to 128x128.
Gadgetoid Apr 10, 2025
c6ad29b
Add a gitignore, sheesh!
Gadgetoid Apr 10, 2025
fa13654
Duo75: Simplify interrupt handler and brightness.
Gadgetoid Apr 12, 2025
6e440a6
Duo75: Shift DMA callback to Core1.
Gadgetoid Apr 14, 2025
c02bb99
Duo75: Reset Core1 so we can run more than once.
Gadgetoid Apr 14, 2025
37ec290
Duo75: Tidyup and slight perf bump.
Gadgetoid Apr 14, 2025
1ad58b5
Duo75: Brightness and flicker reduction.
Gadgetoid Apr 14, 2025
0ce549d
Duo75: Moar state machines = more faster.
Gadgetoid Apr 15, 2025
ef68928
Duo75: Tidyup.
Gadgetoid Apr 15, 2025
2cebaff
Duo75: Core1 flip.
Gadgetoid Apr 15, 2025
a8cd9e5
Duo75: Use Core0 to flip non-native pen types.
Gadgetoid Apr 15, 2025
b379d8f
Duo75: Add is_busy and wait_for_flip.
Gadgetoid Apr 15, 2025
46500c7
Duo75: Simplify frame_convert callback.
Gadgetoid Apr 15, 2025
575c52a
Duo75: Add set_blocking.
Gadgetoid Apr 15, 2025
4a0649e
Duo75: Merge modules directories.
Gadgetoid Apr 15, 2025
a7bad64
Duo75: Update examples for non-blocking flip.
Gadgetoid Apr 15, 2025
c62e9fa
GOL example: Fix dead cell flicker.
MichaelBell Apr 22, 2025
db2f89b
Duo75: Add missing MP_ERROR_TEXT.
Gadgetoid Apr 24, 2025
f9074ea
Duo75: Fix display flicker when under load.
Gadgetoid Apr 24, 2025
fa2d409
Examples: Add a little red glow to fast fire.
Gadgetoid Apr 25, 2025
4bb298f
CI: Pin to MicroPython v1.25.0.
Gadgetoid Apr 25, 2025
efe0baa
Examples: Leaner vector clock.
Gadgetoid Apr 25, 2025
e4ed4be
Duo75: Use half brightness with USB data present.
Gadgetoid Apr 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/micropython.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- name: i75_rp2040
- name: i75w_rp2040
- name: i75w_rp2350
- name: i75_duo

env:
# MicroPython version will be contained in github.event.release.tag_name for releases
Expand Down
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Build dirs
**/build
build-*
build

# Apple filesystem cruft
.DS_Store

# Other cruft
venv
.vscode

11 changes: 11 additions & 0 deletions boards/i75_duo/manifest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require("bundle-networking")
require("urllib.urequest")
require("umqtt.simple")

# Bluetooth
require("aioble")

include("../manifest-common.py")

freeze("../../modules/wireless/")
freeze("../../modules/duo75/", "interstate75.py")
4 changes: 4 additions & 0 deletions boards/i75_duo/manifest.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
basic/*.py
basic/*.af
*.py
*.af
41 changes: 41 additions & 0 deletions boards/i75_duo/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# cmake file for Raspberry Pi Pico
set(PICO_BOARD "pimoroni_interstate75_duo")
set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR})
set(PICO_PLATFORM "rp2350")
set(PICO_NUM_GPIOS 48)

# Board specific version of the frozen manifest
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)

set(MICROPY_C_HEAP_SIZE 4096)

# Links micropy_lib_lwip and sets MICROPY_PY_LWIP = 1
# Picked up and expanded upon in mpconfigboard.h
set(MICROPY_PY_LWIP ON)

# Links cyw43-driver and sets:
# MICROPY_PY_NETWORK_CYW43 = 1,
# MICROPY_PY_SOCKET_DEFAULT_TIMEOUT_MS = 30000
set(MICROPY_PY_NETWORK_CYW43 ON)

# Adds mpbthciport.c
# And sets:
# MICROPY_PY_BLUETOOTH = 1,
# MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS = 1,
# MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE = 1
set(MICROPY_PY_BLUETOOTH ON)

# Links pico_btstack_hci_transport_cyw43
# And sets:
# MICROPY_BLUETOOTH_BTSTACK = 1,
# MICROPY_BLUETOOTH_BTSTACK_CONFIG_FILE =
set(MICROPY_BLUETOOTH_BTSTACK ON)

# Sets:
# CYW43_ENABLE_BLUETOOTH = 1,
# MICROPY_PY_BLUETOOTH_CYW43 = 1
set(MICROPY_PY_BLUETOOTH_CYW43 ON)

set(PIMORONI_UF2_MANIFEST ${CMAKE_CURRENT_LIST_DIR}/manifest.txt)
set(PIMORONI_UF2_DIR ${CMAKE_CURRENT_LIST_DIR}/../../examples)
include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake)
23 changes: 23 additions & 0 deletions boards/i75_duo/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Board and hardware specific configuration
#define MICROPY_HW_BOARD_NAME "Interstate 75 Duo"

#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (2 * 1024 * 1024))

// Set up networking.
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "I75Duo"

// Enable WiFi & PPP
#define MICROPY_PY_NETWORK (1)

// CYW43 driver configuration.
#define CYW43_USE_SPI (1)
#define CYW43_LWIP (1)
#define CYW43_GPIO (0)
#define CYW43_SPI_PIO (1)

#define MICROPY_HW_PIN_EXT_COUNT CYW43_WL_GPIO_COUNT

int mp_hal_is_pin_reserved(int n);
#define MICROPY_HW_PIN_RESERVED(i) mp_hal_is_pin_reserved(i)

#define MICROPY_PY_THREAD (0)
124 changes: 124 additions & 0 deletions boards/i75_duo/pimoroni_interstate75_duo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/

// -----------------------------------------------------
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
// -----------------------------------------------------

// This header may be included by other board headers as "boards/pico.h"

// pico_cmake_set PICO_PLATFORM=rp2350

#ifndef _BOARDS_PICO2_H
#define _BOARDS_PICO2_H

// For board detection
#define RASPBERRYPI_PICO2

// --- RP2350 VARIANT ---
// not PICO_RP2350A

// --- UART ---
// no PICO_DEFAULT_UART
// no PICO_DEFAULT_UART_TX_PIN
// no PICO_DEFAULT_UART_RX_PIN

// --- LED ---
// no PICO_DEFAULT_LED_PIN
#define PICO_DEFAULT_WS2812_PIN 39

// --- I2C ---
#ifndef PICO_DEFAULT_I2C
#define PICO_DEFAULT_I2C 1
#endif
#ifndef PICO_DEFAULT_I2C_SDA_PIN
#define PICO_DEFAULT_I2C_SDA_PIN 14
#endif
#ifndef PICO_DEFAULT_I2C_SCL_PIN
#define PICO_DEFAULT_I2C_SCL_PIN 15
#endif

// --- SPI ---
#ifndef PICO_DEFAULT_SPI
#define PICO_DEFAULT_SPI 0
#endif
#ifndef PICO_DEFAULT_SPI_SCK_PIN
#define PICO_DEFAULT_SPI_SCK_PIN 18
#endif
#ifndef PICO_DEFAULT_SPI_TX_PIN
#define PICO_DEFAULT_SPI_TX_PIN 19 // SD_CMD (+ 20, 21 and 22 for 4-bit SD)
#endif
#ifndef PICO_DEFAULT_SPI_RX_PIN
#define PICO_DEFAULT_SPI_RX_PIN 16
#endif
#ifndef PICO_DEFAULT_SPI_CSN_PIN
#define PICO_DEFAULT_SPI_CSN_PIN 17
#endif

// --- FLASH ---

#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1

#ifndef PICO_FLASH_SPI_CLKDIV
#define PICO_FLASH_SPI_CLKDIV 2
#endif

// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (4 * 1024 * 1024)
#ifndef PICO_FLASH_SIZE_BYTES
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
#endif

// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
// no PICO_SMPS_MODE_PIN

// The GPIO Pin used to read VBUS to determine if the device is battery powered.
// no PICO_VBUS_PIN

// The GPIO Pin used to monitor VSYS. Typically you would use this with ADC.
// There is an example in adc/read_vsys in pico-examples.
// no PICO_VSYS_PIN

#ifndef PICO_RP2350_A2_SUPPORTED
#define PICO_RP2350_A2_SUPPORTED 1
#endif

// PICO_CONFIG: CYW43_PIN_WL_DYNAMIC, flag to indicate if cyw43 SPI pins can be changed at runtime, type=bool, default=false, advanced=true, group=pico_cyw43_driver
#ifndef CYW43_PIN_WL_DYNAMIC
#define CYW43_PIN_WL_DYNAMIC 0
#endif

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_REG_ON, gpio pin to power up the cyw43 chip, type=int, default=23, advanced=true, group=pico_cyw43_driver
#ifndef CYW43_DEFAULT_PIN_WL_REG_ON
#define CYW43_DEFAULT_PIN_WL_REG_ON 23u
#endif

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_OUT, gpio pin for spi data out to the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver
#ifndef CYW43_DEFAULT_PIN_WL_DATA_OUT
#define CYW43_DEFAULT_PIN_WL_DATA_OUT 24u
#endif

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_DATA_IN, gpio pin for spi data in from the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver
#ifndef CYW43_DEFAULT_PIN_WL_DATA_IN
#define CYW43_DEFAULT_PIN_WL_DATA_IN 24u
#endif

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_HOST_WAKE, gpio (irq) pin for the irq line from the cyw43 chip, type=int, default=24, advanced=true, group=pico_cyw43_driver
#ifndef CYW43_DEFAULT_PIN_WL_HOST_WAKE
#define CYW43_DEFAULT_PIN_WL_HOST_WAKE 24u
#endif

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CLOCK, gpio pin for the spi clock line to the cyw43 chip, type=int, default=29, advanced=true, group=pico_cyw43_driver
#ifndef CYW43_DEFAULT_PIN_WL_CLOCK
#define CYW43_DEFAULT_PIN_WL_CLOCK 29u
#endif

// PICO_CONFIG: CYW43_DEFAULT_PIN_WL_CS, gpio pin for the spi chip select to the cyw43 chip, type=int, default=25, advanced=true, group=pico_cyw43_driver
#ifndef CYW43_DEFAULT_PIN_WL_CS
#define CYW43_DEFAULT_PIN_WL_CS 25u
#endif

#endif
53 changes: 53 additions & 0 deletions boards/i75_duo/pins.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
GP0,GPIO0
GP1,GPIO1
GP2,GPIO2
GP3,GPIO3
GP4,GPIO4
GP5,GPIO5
GP6,GPIO6
GP7,GPIO7
GP8,GPIO8
GP9,GPIO9
GP10,GPIO10
GP11,GPIO11
GP12,GPIO12
GP13,GPIO13
GP14,GPIO14
GP15,GPIO15
GP16,GPIO16
GP17,GPIO17
GP18,GPIO18
GP19,GPIO19
GP20,GPIO20
GP21,GPIO21
GP22,GPIO22
GP25,GPIO25
GP26,GPIO26
GP27,GPIO27
GP28,GPIO28
GP29,GPIO29
GP30,GPIO30
GP31,GPIO31
GP32,GPIO32
GP33,GPIO33
GP34,GPIO34
GP35,GPIO35
GP36,GPIO36
GP37,GPIO37
GP38,GPIO38
GP39,GPIO39
GP40,GPIO40
GP41,GPIO41
GP42,GPIO42
GP43,GPIO43
GP44,GPIO44
GP45,GPIO45
GP46,GPIO46
GP47,GPIO47
SW_USER,GPIO16
SW_A,GPIO26
SW_B,GPIO27
SW_C,GPIO28
LEDS,GPIO30
SENSOR_IN,GPIO46
SENSE_5V,GPIO47
2 changes: 2 additions & 0 deletions boards/i75_duo/usermodules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
include(usermod-common)
7 changes: 7 additions & 0 deletions boards/usermod-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ list(APPEND CMAKE_MODULE_PATH "${PIMORONI_PICO_PATH}/micropython")
# All regular modules
list(APPEND CMAKE_MODULE_PATH "${PIMORONI_PICO_PATH}/micropython/modules")

# Allows us to find /modules/duo75
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/..")

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

Expand All @@ -39,7 +42,11 @@ include(adcfft/micropython)

# LEDs & Matrices
include(plasma/micropython)
if("${PICO_BOARD}" STREQUAL "pimoroni_interstate75_duo")
include(modules/duo75/micropython)
else()
include(hub75/micropython)
endif()

# Servos & Motors
include(pwm/micropython)
Expand Down
2 changes: 1 addition & 1 deletion ci/micropython.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export TERM=${TERM:="xterm-256color"}

MICROPYTHON_FLAVOUR="micropython"
MICROPYTHON_VERSION="master"
MICROPYTHON_VERSION="v1.25.0"

PIMORONI_PICO_FLAVOUR="pimoroni"
PIMORONI_PICO_VERSION="feature/picovector2-and-layers"
Expand Down
1 change: 1 addition & 0 deletions drivers/duo75/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include(${CMAKE_CURRENT_LIST_DIR}/duo75.cmake)
12 changes: 12 additions & 0 deletions drivers/duo75/duo75.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
add_library(duo75 INTERFACE)

target_sources(duo75 INTERFACE
${CMAKE_CURRENT_LIST_DIR}/duo75.cpp)

pico_generate_pio_header(duo75 ${CMAKE_CURRENT_LIST_DIR}/duo75.pio)

target_include_directories(duo75 INTERFACE ${CMAKE_CURRENT_LIST_DIR})

# Pull in pico libraries that we need
target_link_libraries(duo75 INTERFACE pico_stdlib hardware_pio hardware_dma pico_graphics)

Loading
Loading