feat: clean up some more .w.

This commit is contained in:
Kat Inskip 2025-10-17 09:37:25 -07:00
parent 32cbbaf4b3
commit 8830e92597
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
7 changed files with 65 additions and 63 deletions

52
Cargo.lock generated
View file

@ -52,21 +52,6 @@ version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd"
[[package]]
name = "blinky"
version = "0.1.0"
dependencies = [
"display-interface-spi",
"embedded-graphics",
"embedded-hal-bus",
"esp-alloc",
"esp-backtrace",
"esp-bootloader-esp-idf",
"esp-hal",
"esp-println",
"ili9341",
]
[[package]] [[package]]
name = "byte-slice-cast" name = "byte-slice-cast"
version = "1.2.3" version = "1.2.3"
@ -352,6 +337,27 @@ dependencies = [
"embedded-io 0.7.1", "embedded-io 0.7.1",
] ]
[[package]]
name = "embedded-layout"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a90553247f2b05c59ac7894ea13d830636c2b1203fa03bff400eddbd1fa9f52"
dependencies = [
"embedded-graphics",
"embedded-layout-macros",
]
[[package]]
name = "embedded-layout-macros"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f6e621fe4c7e05b695274b722dc0a60bacd1c8696b58191baa0154713d52400"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.102",
]
[[package]] [[package]]
name = "embedded-storage" name = "embedded-storage"
version = "0.3.1" version = "0.3.1"
@ -857,6 +863,22 @@ version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "meepy"
version = "0.1.0"
dependencies = [
"display-interface-spi",
"embedded-graphics",
"embedded-hal-bus",
"embedded-layout",
"esp-alloc",
"esp-backtrace",
"esp-bootloader-esp-idf",
"esp-hal",
"esp-println",
"ili9341",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.4"

View file

@ -1,14 +1,15 @@
[package] [package]
name = "blinky" name = "meepy"
version = "0.1.0" version = "0.1.0"
authors = ["Sergio Gasquez <sergio.gasquez@gmail.com>"] authors = ["kittywitch"]
edition = "2021" edition = "2021"
license = "MIT OR Apache-2.0" license = "MIT"
[dependencies] [dependencies]
display-interface-spi = "0.5.0" display-interface-spi = "0.5.0"
embedded-graphics = "0.8.1" embedded-graphics = "0.8.1"
embedded-hal-bus = "0.3.0" embedded-hal-bus = "0.3.0"
embedded-layout = "0.4.2"
esp-alloc = { version = "0.9.0", features = ["esp32c3"] } esp-alloc = { version = "0.9.0", features = ["esp32c3"] }
esp-backtrace = { version = "0.18.0", features = [ esp-backtrace = { version = "0.18.0", features = [
"esp32c3", "esp32c3",

View file

@ -1,33 +0,0 @@
{
"version": 1,
"author": "Sergio Gasquez Arcos",
"editor": "wokwi",
"parts": [
{
"type": "board-esp32-c3-rust-1",
"id": "esp",
"top": -126.57,
"left": 46.35,
"attrs": {
"builder": "rust-nostd-esp"
}
}
],
"connections": [
[
"esp:21",
"$serialMonitor:RX",
"",
[]
],
[
"esp:20",
"$serialMonitor:TX",
"",
[]
]
],
"serialMonitor": {
"display": "auto"
}
}

View file

@ -23,7 +23,7 @@
pkgs.espflash pkgs.espflash
pkgs.pkg-config pkgs.pkg-config
pkgs.stdenv.cc pkgs.stdenv.cc
#pkgs.rust-analyzer #pkgs.rust-analyzer
#pkgs.bacon #pkgs.bacon
#pkgs.systemdMinimal #pkgs.systemdMinimal
#pkgs.lunarvim #pkgs.lunarvim

8
justfile Normal file
View file

@ -0,0 +1,8 @@
arch := "riscv32imc-unknown-none-elf"
pakidg := shell('toml get -r Cargo.toml package.name')
exe := justfile_directory() / "target" / arch / "release" / pakidg
build:
#!/usr/bin/env bash
cargo build --release && \
sudo espflash flash {{exe}}

View file

@ -152,8 +152,8 @@ impl<'spi> TFT<'spi> {
.with_mode(Mode::_0) .with_mode(Mode::_0)
} }
pub fn clear(&mut self, color: Rgb565) { pub fn clear(&mut self, color: Bgr565) {
self.display.clear(color).unwrap(); self.display.clear(candyflip(color)).unwrap();
} }
pub fn part_clear(&mut self, x: i32, y: i32, w: u32, h: u32) { pub fn part_clear(&mut self, x: i32, y: i32, w: u32, h: u32) {
@ -163,6 +163,18 @@ impl<'spi> TFT<'spi> {
.unwrap(); .unwrap();
} }
pub fn containing_recty(&mut self, x: i32, y: i32, w: u32, h: u32) {
Rectangle::new(Point::new(x, y), Size::new(w, h))
.into_styled(PrimitiveStyle::with_stroke(Bgr565::CYAN, 1))
.draw(&mut self.draw_target())
.unwrap();
}
pub fn container(&mut self, margin: i32, y: i32, h: u32) {
let width = self.display.bounding_box().size.width;
self.containing_recty(margin, y, width - margin as u32, h);
}
pub fn println(&mut self, text: &str, x: i32, y: i32) { pub fn println(&mut self, text: &str, x: i32, y: i32) {
let style = MonoTextStyle::new(&FONT_8X13, Bgr565::WHITE); let style = MonoTextStyle::new(&FONT_8X13, Bgr565::WHITE);
Text::with_alignment(text, Point::new(x, y), style, Alignment::Center) Text::with_alignment(text, Point::new(x, y), style, Alignment::Center)
@ -186,6 +198,7 @@ fn main() -> ! {
let mut tft = TFT::new(peripherals.SPI2, sclk, miso, mosi, cs, rst, dc); let mut tft = TFT::new(peripherals.SPI2, sclk, miso, mosi, cs, rst, dc);
tft.draw_target().clear(Bgr565::BLACK); tft.draw_target().clear(Bgr565::BLACK);
tft.container(2, 2, 16);
tft.println("nya~! -w-", 100, 40); tft.println("nya~! -w-", 100, 40);
loop { loop {

View file

@ -1,9 +0,0 @@
[wokwi]
version = 1
# Exercise
# firmware = "target/riscv32imc-unknown-none-elf/release/blinky"
# elf = "target/riscv32imc-unknown-none-elf/release/blinky"
# Solution
firmware = 'target/riscv32imc-unknown-none-elf/release/examples/blinky'
elf = 'target/riscv32imc-unknown-none-elf/release/examples/blinky'