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
10 changed files
with
99 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { startGamepad } from "@devicescript/servers" | ||
import { spi } from "@devicescript/spi" | ||
import { pins } from "@dsboard/pico_w" | ||
import * as ds from "@devicescript/core" | ||
import { ST7789Driver } from "@devicescript/drivers" | ||
import { Image } from "@devicescript/graphics" | ||
|
||
/** | ||
* Driver for WaveShare Pico-LCD-1.14 inch. | ||
* | ||
* @see https://www.waveshare.com/pico-lcd-1.14.htm | ||
* @devsPart WaveShare Pico LCD114 for Raspberry Pi Pico | ||
* @devsWhenUsed only start services which are used! | ||
*/ | ||
export class WaveSharePicoLCD114 { | ||
constructor() {} | ||
|
||
startGamepad() { | ||
return startGamepad({ | ||
pinA: pins.GP15, | ||
pinB: pins.GP17, | ||
pinDown: pins.GP18, | ||
pinLeft: pins.GP16, | ||
pinSelect: pins.GP3, // middle | ||
pinRight: pins.GP20, | ||
pinUp: pins.GP2, | ||
}) | ||
} | ||
|
||
async startDisplay() { | ||
spi.configure({ | ||
mosi: pins.GP11, | ||
sck: pins.GP10, | ||
hz: 8_000_000, | ||
}) | ||
|
||
pins.GP13.setMode(ds.GPIOMode.OutputHigh) // BL | ||
|
||
const d = new ST7789Driver(Image.alloc(240, 136, 4), { | ||
dc: pins.GP8, | ||
cs: pins.GP9, | ||
reset: pins.GP12, | ||
// frmctr1: 0x0e_14_ff, | ||
flip: false, | ||
spi: spi, | ||
offX: 40, | ||
offY: 53, | ||
}) | ||
await d.init() | ||
return d | ||
} | ||
} |
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,26 @@ | ||
--- | ||
title: WaveShare Pico-LCD | ||
--- | ||
|
||
# WaveShare Pico-LCD | ||
|
||
- Device: [Raspberry Pi Pico W](/devices/rp2040/pico-w) | ||
- [Home](https://www.waveshare.com/pico-lcd-1.14.htm) | ||
|
||
![WaveShare Image](/img/shields/waveshare-pico-lcd-114.png) | ||
|
||
## DeviceScript import | ||
|
||
You must import `WaveSharePicoLCD114` to access the shield services. | ||
|
||
In [Visual Studio Code](/getting-started/vscode), | ||
click the **wand** icon on the file menu and | ||
select "PicoBricks". | ||
|
||
```ts | ||
import { WaveSharePicoLCD114 } from "@devicescript/drivers" | ||
const shield = new WaveSharePicoLCD114() | ||
|
||
const gamepad = await shield.startGamepad() | ||
const display = await shield.startDisplay() | ||
``` |
This file was deleted.
Oops, something went wrong.
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.