-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
335 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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
36 changes: 36 additions & 0 deletions
36
packages/sampleprj/boards/waveshare_pico_matrix.board.json
This file contains 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,36 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-pico/main/boards/rp2040deviceconfig.schema.json", | ||
"devName": "Waveshare RP2040-Matrix", | ||
"productId": "0x3f8a8e31", | ||
"$description": "RP2040 RGB LED Matrix Board.", | ||
"archId": "rp2040", | ||
"url": "https://www.waveshare.com/rp2040-matrix.htm", | ||
"pins": { | ||
"GP0": 0, | ||
"GP1": 1, | ||
"GP10": 10, | ||
"GP11": 11, | ||
"GP12": 12, | ||
"GP13": 13, | ||
"GP14": 14, | ||
"GP15": 15, | ||
"LEDS": 16, | ||
"GP17": 17, | ||
"GP18": 18, | ||
"GP19": 19, | ||
"GP2": 2, | ||
"GP20": 20, | ||
"GP21": 21, | ||
"GP22": 22, | ||
"GP26": 26, | ||
"GP27": 27, | ||
"GP28": 28, | ||
"GP3": 3, | ||
"GP4": 4, | ||
"GP5": 5, | ||
"GP6": 6, | ||
"GP7": 7, | ||
"GP8": 8, | ||
"GP9": 9 | ||
} | ||
} |
This file contains 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 @@ | ||
import { pins, board } from "@dsboard/waveshare_pico_matrix" | ||
import { Led, LedStripLightType, LedVariant } from "@devicescript/core" | ||
import { startLed } from "@devicescript/drivers" | ||
import { configureHardware } from "@devicescript/servers" | ||
import { startLedDisplay } from "@devicescript/runtime" | ||
import { font5 } from "@devicescript/graphics" | ||
|
||
/** | ||
* Driver for the WaveShare RP2040 Matrix board | ||
* | ||
* @devsWhenUsed | ||
*/ | ||
export class WaveShareRP2040Matrix { | ||
constructor() { | ||
configureHardware({ | ||
scanI2C: false | ||
}) | ||
} | ||
|
||
/** | ||
* Gets the pin mappings | ||
*/ | ||
pins() { | ||
return pins | ||
} | ||
|
||
/** | ||
* Starts the LED service for the 5x5 matrix | ||
* @returns | ||
*/ | ||
async startLed() { | ||
return await startLed({ | ||
length: 25, | ||
columns: 5, | ||
intensity: 0.2, | ||
variant: LedVariant.Matrix, | ||
hwConfig: { | ||
type: LedStripLightType.WS2812B_GRB, | ||
pin: pins.LEDS, | ||
}, | ||
roleName: "LEDS", | ||
}) | ||
} | ||
} | ||
|
||
const b = new WaveShareRP2040Matrix() | ||
const leds = await b.startLed() | ||
const pixels = await leds.buffer() | ||
const display = await startLedDisplay(leds) | ||
const font = font5() | ||
display.image.print("0", 0, 0, 3, font) | ||
await display.show() |
This file contains 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 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 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 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 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 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 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 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 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,117 @@ | ||
--- | ||
description: ESP32-C3 SuperMini | ||
--- | ||
# ESP32-C3 SuperMini | ||
|
||
|
||
A super tiny ESP32-C3 board. | ||
|
||
|
||
## Features | ||
|
||
- I2C on 6/7 | ||
- LED on pin 8 (use [setStatusLight](/developer/status-light) to control) | ||
- Serial logging on pin 21 at 115200 8N1 | ||
|
||
{@import optional ./esp32c3-supermini-features.mdp} | ||
|
||
- Service: buttonBOOT (button) | ||
|
||
{@import optional ./esp32c3-supermini-services.mdp} | ||
|
||
|
||
## Stores | ||
|
||
- [https://banggood.com/ESP32-C3-Development-Board-ESP32-SuperMini-WiFi-Bluetooth-Mini-Module-p-1997449.html](https://banggood.com/ESP32-C3-Development-Board-ESP32-SuperMini-WiFi-Bluetooth-Mini-Module-p-1997449.html) | ||
|
||
## Pins | ||
|
||
| pin name | hardware id | features | | ||
|:---------|:------------|---------:| | ||
| **P0** | GPIO0 | analogIn, io | | ||
| **P1** | GPIO1 | analogIn, io | | ||
| **P10** | GPIO10 | io | | ||
| **P2** | GPIO2 | analogIn, boot, io | | ||
| **P20** | GPIO20 | bootUart, io | | ||
| **P3** | GPIO3 | analogIn, io | | ||
| **P4** | GPIO4 | analogIn, debug, io | | ||
| **P5** | GPIO5 | debug, io | | ||
| **$services.buttonBOOT[0].pin** | GPIO9 | $services.buttonBOOT[0].pin, boot, io | | ||
| **i2c.pinSCL** | GPIO7 | i2c.pinSCL, debug, io | | ||
| **i2c.pinSDA** | GPIO6 | i2c.pinSDA, debug, io | | ||
| **led.pin** | GPIO8 | led.pin, boot, io | | ||
| **log.pinTX** | GPIO21 | log.pinTX, bootUart, io | | ||
|
||
|
||
|
||
## DeviceScript import | ||
|
||
|
||
You must add this import statement to load | ||
the pinout configuration for this device. | ||
|
||
In [Visual Studio Code](/getting-started/vscode), | ||
click the **wand** icon on the file menu and | ||
select "ESP32-C3 SuperMini". | ||
|
||
```ts | ||
import { pins, board } from "@dsboard/esp32c3_supermini" | ||
``` | ||
|
||
{@import optional ./esp32c3-supermini-examples.mdp} | ||
|
||
## Firmware update | ||
|
||
In Visual Studio Code, | ||
select **DeviceScript: Flash Firmware...** from the command palette. | ||
|
||
Run this [command line](/api/cli) command and follow the instructions. | ||
|
||
```bash | ||
devicescript flash --board esp32c3_supermini | ||
``` | ||
|
||
|
||
- [Firmware](https://github.com/microsoft/devicescript-esp32/releases/latest/download/devicescript-esp32c3-esp32c3_supermini-0x0.bin) | ||
|
||
## Configuration | ||
|
||
```json title="esp32c3_supermini.json" | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/microsoft/devicescript-esp32/main/boards/esp32deviceconfig.schema.json", | ||
"id": "esp32c3_supermini", | ||
"devName": "ESP32-C3 SuperMini", | ||
"productId": "0x31606c1c", | ||
"$description": "A super tiny ESP32-C3 board.", | ||
"archId": "esp32c3", | ||
"url": "https://banggood.com/ESP32-C3-Development-Board-ESP32-SuperMini-WiFi-Bluetooth-Mini-Module-p-1997449.html", | ||
"$services": [ | ||
{ | ||
"name": "buttonBOOT", | ||
"pin": 9, | ||
"service": "button" | ||
} | ||
], | ||
"i2c": { | ||
"pinSCL": 7, | ||
"pinSDA": 6 | ||
}, | ||
"led": { | ||
"isMono": true, | ||
"pin": 8 | ||
}, | ||
"log": { | ||
"pinTX": 21 | ||
}, | ||
"pins": { | ||
"P0": 0, | ||
"P1": 1, | ||
"P10": 10, | ||
"P2": 2, | ||
"P20": 20, | ||
"P3": 3, | ||
"P4": 4, | ||
"P5": 5 | ||
} | ||
} | ||
``` |
This file contains 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
Oops, something went wrong.