Skip to content

Commit 30ed88b

Browse files
committed
port/boards/VCC_GND_RP2040: add VCC_GND_RP2040 with multiple variants.
This supports 4, 8 and 16MB flash variants. add toggle_led_by_button demo board tmpl from WEACTSTUDIO, may need some modification
1 parent 9ea64a3 commit 30ed88b

File tree

12 files changed

+240
-0
lines changed

12 files changed

+240
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# VCC-GND Studio YD-RP2040
2+
3+
The VCC-GND Studio YD-RP2040 Board is based on the Raspberry Pi RP2040 and can be
4+
purchased with 4/8/16 MiB of flash.
5+
6+
These boards are available from a number of resellers and often have the name
7+
"YD-RP2040". initdc maintain the [YD-RP2040](https://github.com/initdc/YD-RP2040/tree/master)
8+
repository containing information on the board.
9+
10+
## Build notes
11+
12+
Builds can be configured with the `BOARD_VARIANT` parameter. Valid variants
13+
can be displayed with the `query-variant` target. An example:
14+
15+
```bash
16+
> cd ports/rp2
17+
> make BOARD=VCC_GND_RP2040 query-variants
18+
VARIANTS: flash_4mb flash_8mb flash_16mb
19+
> make BOARD=VCC_GND_RP2040 BOARD_VARIANT=flash_8mb submodules all # Build the 8 MiB variant
20+
```
21+
22+
`flash_4mb` is the default if `BOARD_VARIANT` is not supplied.
23+
24+
## Board-specific modules
25+
26+
The `board` module contains definitions for the onboard LED, onboard WS2812B and user button.
27+
28+
Example:
29+
30+
```python
31+
> import board
32+
> board.led.toggle() # Toggles the state of the on-board LED
33+
> board.key.value() # Returns 0 or 1 corresponding to the state of the user key
34+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"deploy": [
3+
"deploy.md"
4+
],
5+
"docs": "",
6+
"features": [
7+
"Breadboard Friendly",
8+
"SPI Flash",
9+
"USB-C",
10+
"WS2812B"
11+
],
12+
"images": [
13+
"YD-RP2040.jpg"
14+
],
15+
"mcu": "rp2040",
16+
"product": "YD-RP2040",
17+
"url": "http://vcc-gnd.com/",
18+
"variants": {
19+
"flash_4mb": "4 MiB Flash",
20+
"flash_8mb": "8 MiB Flash",
21+
"flash_16mb": "16 MiB Flash"
22+
},
23+
"vendor": "VCC-GND Studio"
24+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Flashing via UF2 bootloader
2+
3+
To get the board in bootloader mode ready for the firmware update, execute
4+
`machine.bootloader()` at the MicroPython REPL. Alternatively, hold
5+
down the BOOTSEL button while pressing reset (NRST). The uf2 file below
6+
should then be copied to the USB mass storage device that appears. Once
7+
programming of the new firmware is complete the device will automatically reset
8+
and be ready for use.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include("$(PORT_DIR)/boards/manifest.py")
2+
freeze("./modules")
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from machine import Pin, Timer
2+
3+
led = Pin(25, Pin.OUT)
4+
ws2812 = Pin(23, Pin.OUT, Pin.PULL_UP)
5+
key = Pin(24, Pin.IN, Pin.PULL_UP)
6+
7+
led_status = 1
8+
key_status = key.value()
9+
led.value(led_status)
10+
11+
def toggle_led_by_button():
12+
global led_status
13+
led_status = 0 if led_status == 1 else 1
14+
led.value(led_status)
15+
16+
while True:
17+
if key.value() != key_status:
18+
key_status = key.value()
19+
if key_status == 0:
20+
print("pressdown")
21+
toggle_led_by_button()
22+
else:
23+
print("pressup")
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# CMake file for VCC-GND Studio YD-RP2040 boards
2+
3+
# The VCC-GND Studio boards don't have official pico-sdk support so we define it
4+
# See also: https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards
5+
list(APPEND PICO_BOARD_HEADER_DIRS ${MICROPY_BOARD_DIR})
6+
7+
# Freeze board.py
8+
set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py)
9+
10+
# Provide different variants for the downloads page
11+
set(BOARD_VARIANTS "flash_4mb flash_8mb flash_16mb")
12+
13+
# Select the 4MB variant as the default
14+
set(PICO_BOARD "vccgndstudio_4mb")
15+
16+
if("${BOARD_VARIANT}" STREQUAL "flash_8mb")
17+
set(PICO_BOARD "vccgndstudio_8mb")
18+
endif()
19+
20+
if("${BOARD_VARIANT}" STREQUAL "flash_16mb")
21+
set(PICO_BOARD "vccgndstudio_16mb")
22+
endif()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#define MICROPY_HW_BOARD_NAME "VCC-GND Studio YD-RP2040"
2+
3+
// Allow 1MB for the firmware image itself, allocate the remainder to the filesystem
4+
#define MICROPY_HW_FLASH_STORAGE_BYTES (PICO_FLASH_SIZE_BYTES - (1 * 1024 * 1024))
5+
6+
// https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/boards/vcc_gnd_yd_rp2040/mpconfigboard.h#L4
7+
#define MICROPY_HW_NEOPIXEL (&pin_GPIO23)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
RGB,GPIO23
2+
NEOPIXEL,GPIO23
3+
BUTTON,GPIO24
4+
LED,GPIO25
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// A pico-sdk board definition is required since the WeAct Studio boards are
2+
// not officially supported.
3+
//
4+
// Officially supported boards:
5+
// https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards
6+
7+
#ifndef _BOARDS_VCCGNDSTUDIO_16MB_H
8+
#define _BOARDS_VCCGNDSTUDIO_16MB_H
9+
10+
#include "vccgndstudio_common.h"
11+
12+
#define VCCGNDSTUDIO_16MB
13+
14+
#ifndef PICO_FLASH_SIZE_BYTES
15+
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
16+
#endif
17+
18+
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// A pico-sdk board definition is required since the WeAct Studio boards are
2+
// not officially supported.
3+
//
4+
// Officially supported boards:
5+
// https://github.com/raspberrypi/pico-sdk/tree/master/src/boards/include/boards
6+
7+
#ifndef _BOARDS_VCCGNDSTUDIO_4MB_H
8+
#define _BOARDS_VCCGNDSTUDIO_4MB_H
9+
10+
#include "vccgndstudio_common.h"
11+
12+
#define VCCGNDSTUDIO_4MB
13+
14+
#ifndef PICO_FLASH_SIZE_BYTES
15+
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
16+
#endif
17+
18+
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy