Compare commits
7
Commits
d356180980
...
rust-nfc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78fc70bd31
|
||
|
|
76dc34b115
|
||
|
|
c8ea94a3ca
|
||
|
|
744a844f75
|
||
|
|
302abd0a2d
|
||
|
|
b40e6fb9cc
|
||
|
|
6201fcaab1 |
@@ -0,0 +1,15 @@
|
||||
[target.xtensa-esp32-none-elf]
|
||||
runner = "espflash flash --monitor --chip esp32"
|
||||
|
||||
[env]
|
||||
ESP_LOG="info"
|
||||
|
||||
[build]
|
||||
rustflags = [
|
||||
"-C", "link-arg=-nostartfiles",
|
||||
]
|
||||
|
||||
target = "xtensa-esp32-none-elf"
|
||||
|
||||
[unstable]
|
||||
build-std = ["alloc", "core"]
|
||||
@@ -0,0 +1 @@
|
||||
stack-size-threshold = 1024
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
# will have compiled files and executables
|
||||
debug/
|
||||
target/
|
||||
|
||||
# Editor configuration
|
||||
.vscode/
|
||||
.zed/
|
||||
.helix/
|
||||
.nvim.lua
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
|
||||
# RustRover
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
|
||||
# Ignore .DS_Store file in mac
|
||||
**/.DS_Store
|
||||
Generated
+1768
File diff suppressed because it is too large
Load Diff
+68
@@ -0,0 +1,68 @@
|
||||
[package]
|
||||
edition = "2024"
|
||||
name = "creaturedex"
|
||||
rust-version = "1.88"
|
||||
version = "0.1.0"
|
||||
|
||||
[[bin]]
|
||||
name = "creaturedex"
|
||||
path = "./src/bin/main.rs"
|
||||
|
||||
[dependencies]
|
||||
esp-hal = { version = "~1.1.0", features = ["esp32", "log-04", "unstable"] }
|
||||
|
||||
esp-rtos = { version = "0.3.0", features = [
|
||||
"esp-alloc",
|
||||
"esp-radio",
|
||||
"esp32",
|
||||
"log-04",
|
||||
] }
|
||||
|
||||
esp-bootloader-esp-idf = { version = "0.5.0", features = ["esp32", "log-04"] }
|
||||
log = "0.4.27"
|
||||
|
||||
critical-section = "1.2.0"
|
||||
embedded-io = "0.7.1"
|
||||
esp-alloc = "0.10.0"
|
||||
esp-println = { version = "0.17.0", features = ["esp32", "log-04"] }
|
||||
esp-radio = { version = "0.18.0", features = [
|
||||
"esp-alloc",
|
||||
"esp32",
|
||||
"log-04",
|
||||
"unstable",
|
||||
"wifi",
|
||||
] }
|
||||
smoltcp = { version = "0.13.0", default-features = false, features = [
|
||||
"log",
|
||||
"medium-ethernet",
|
||||
"multicast",
|
||||
"proto-dhcpv4",
|
||||
"proto-dns",
|
||||
"proto-ipv4",
|
||||
"socket-dns",
|
||||
"socket-icmp",
|
||||
"socket-raw",
|
||||
"socket-tcp",
|
||||
"socket-udp",
|
||||
] }
|
||||
display-interface-spi = "0.5.0"
|
||||
ili9341 = "0.6.0"
|
||||
embedded-hal = "1.0.0"
|
||||
embedded-hal-bus = "0.3.0"
|
||||
embedded-graphics = "0.8.2"
|
||||
embedded-graphics-core = "0.4.1"
|
||||
pn532 = "0.5.0"
|
||||
ndef = { version = "0.5.0", path = "./ndef-rs" }
|
||||
|
||||
|
||||
# For fine tuning these settings, please refer to https://doc.rust-lang.org/cargo/reference/profiles.html
|
||||
[profile.dev]
|
||||
# The default debug profile is too slow and too big for resource-constrained devices.
|
||||
# Always build with some optimizations enabled.
|
||||
opt-level = "s"
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1 # LLVM can perform better optimizations using a single thread
|
||||
debug = 2 # prefer slower builds but better debugging experience
|
||||
lto = 'fat'
|
||||
opt-level = 's'
|
||||
@@ -0,0 +1,70 @@
|
||||
fn main() {
|
||||
linker_be_nice();
|
||||
// make sure linkall.x is the last linker script (otherwise might cause problems with flip-link)
|
||||
println!("cargo:rustc-link-arg=-Tlinkall.x");
|
||||
}
|
||||
|
||||
fn linker_be_nice() {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
if args.len() > 1 {
|
||||
let kind = &args[1];
|
||||
let what = &args[2];
|
||||
|
||||
match kind.as_str() {
|
||||
"undefined-symbol" => match what.as_str() {
|
||||
what if what.starts_with("_defmt_") => {
|
||||
eprintln!();
|
||||
eprintln!(
|
||||
"💡 `defmt` not found - make sure `defmt.x` is added as a linker script and you have included `use defmt_rtt as _;`"
|
||||
);
|
||||
eprintln!();
|
||||
}
|
||||
"_stack_start" => {
|
||||
eprintln!();
|
||||
eprintln!("💡 Is the linker script `linkall.x` missing?");
|
||||
eprintln!();
|
||||
}
|
||||
what if what.starts_with("esp_rtos_") => {
|
||||
eprintln!();
|
||||
eprintln!(
|
||||
"💡 `esp-radio` has no scheduler enabled. Make sure you have initialized `esp-rtos` or provided an external scheduler."
|
||||
);
|
||||
eprintln!();
|
||||
}
|
||||
"embedded_test_linker_file_not_added_to_rustflags" => {
|
||||
eprintln!();
|
||||
eprintln!(
|
||||
"💡 `embedded-test` not found - make sure `embedded-test.x` is added as a linker script for tests"
|
||||
);
|
||||
eprintln!();
|
||||
}
|
||||
"free"
|
||||
| "malloc"
|
||||
| "calloc"
|
||||
| "get_free_internal_heap_size"
|
||||
| "malloc_internal"
|
||||
| "realloc_internal"
|
||||
| "calloc_internal"
|
||||
| "free_internal" => {
|
||||
eprintln!();
|
||||
eprintln!(
|
||||
"💡 Did you forget the `esp-alloc` dependency or didn't enable the `compat` feature on it?"
|
||||
);
|
||||
eprintln!();
|
||||
}
|
||||
_ => (),
|
||||
},
|
||||
// we don't have anything helpful for "missing-lib" yet
|
||||
_ => {
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
std::process::exit(0);
|
||||
}
|
||||
|
||||
println!(
|
||||
"cargo:rustc-link-arg=-Wl,--error-handling-script={}",
|
||||
std::env::current_exe().unwrap().display()
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"version": 1,
|
||||
"editor": "wokwi",
|
||||
"parts": [
|
||||
{ "type": "board-esp32-s3-devkitc-1", "id": "esp1", "top": 67.2, "left": -263.96, "attrs": {} },
|
||||
{
|
||||
"type": "board-ili9341-cap-touch",
|
||||
"id": "lcd1",
|
||||
"top": -191.24,
|
||||
"left": -0.38,
|
||||
"attrs": {}
|
||||
},
|
||||
{
|
||||
"type": "wokwi-led",
|
||||
"id": "led1",
|
||||
"top": -82.89,
|
||||
"left": 196.26,
|
||||
"attrs": { "color": "red" }
|
||||
},
|
||||
{
|
||||
"type": "wokwi-resistor",
|
||||
"id": "r1",
|
||||
"top": 183.86,
|
||||
"left": 154.06,
|
||||
"attrs": { "value": "220" }
|
||||
}
|
||||
],
|
||||
"connections": [
|
||||
[ "lcd1:VCC", "esp1:3V3", "red", [ "v19.2", "h-57.6", "v-105.6", "h-124.95" ] ],
|
||||
[ "lcd1:GND", "esp1:GND.2", "black", [ "v28.8", "h-76.8", "v-76.8" ] ],
|
||||
[ "lcd1:CS", "esp1:11", "orange", [ "v0" ] ],
|
||||
[ "lcd1:D/C", "esp1:12", "gold", [ "v0" ] ],
|
||||
[ "lcd1:RESET", "esp1:10", "brown", [ "v0" ] ],
|
||||
[ "lcd1:MOSI", "esp1:35", "violet", [ "v105.6", "h-124.8", "v-144" ] ],
|
||||
[ "lcd1:SCK", "esp1:36", "white", [ "v115.2", "h-144", "v-86.4" ] ],
|
||||
[ "esp1:37", "lcd1:MISO", "magenta", [ "h57.6", "v105.6", "h172.8" ] ],
|
||||
[ "esp1:22", "lcd1:SCL", "yellow", [ "h48", "v163.2", "h192" ] ],
|
||||
[ "esp1:21", "lcd1:SDA", "cyan", [ "h38.4", "v144", "h211.2" ] ],
|
||||
[ "r1:2", "led1:A", "green", [ "h8.4", "v-230.4" ] ],
|
||||
[ "esp1:GND.2", "led1:C", "black", [ "v0", "h86.4", "v76.8", "h278.4" ] ],
|
||||
[ "esp1:17", "r1:1", "green", [ "h0" ] ]
|
||||
],
|
||||
"dependencies": {}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
[toolchain]
|
||||
channel = "esp"
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
pkgs ? import <nixpkgs> { },
|
||||
}:
|
||||
let
|
||||
host-triple = "x86_64-unknown-linux-gnu";
|
||||
gcc-arch = "xtensa-esp-elf";
|
||||
gcc-release = "16.1.0_20260609";
|
||||
toolchain-pkg = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "esp32-xtensa-rust-toolchain";
|
||||
version = "1.97.0.0";
|
||||
srcs = [
|
||||
(pkgs.fetchurl {
|
||||
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}/rust-${version}-${host-triple}.tar.xz";
|
||||
hash = "sha256-qZv+5pIh6f9thjiPaBHuaIzUBeagQAo80XhOjUY+nZk=";
|
||||
})
|
||||
(pkgs.fetchurl {
|
||||
url =
|
||||
let
|
||||
gcc-file = "${gcc-arch}-${gcc-release}-x86_64-linux-gnu.tar.xz";
|
||||
in
|
||||
"https://github.com/espressif/crosstool-NG/releases/download/esp-${gcc-release}/${gcc-file}";
|
||||
hash = "sha256-9wh1Lrs1yrIfGEsldBFO0Rh2GdsO24pLqRPAbKL6Z14=";
|
||||
})
|
||||
(pkgs.fetchurl {
|
||||
url = "https://github.com/esp-rs/rust-build/releases/download/v${version}/rust-src-${version}.tar.xz";
|
||||
hash = "sha256-Vo1oi5+PMy7E0EZXVE+tI+mc4R6ebPWDWXnmiijGi3M=";
|
||||
})
|
||||
# TODO maybe I need clang but so far it works without https://github.com/esp-rs/espup/blob/main/src/toolchain/llvm.rs
|
||||
];
|
||||
sourceRoot = ".";
|
||||
nativeBuildInputs = [ pkgs.autoPatchelfHook ];
|
||||
buildInputs = [
|
||||
pkgs.zlib
|
||||
pkgs.stdenv.cc.cc.lib
|
||||
];
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
patchShebangs --build rust-nightly-x86_64-unknown-linux-gnu/install.sh rust-src-nightly/install.sh
|
||||
|
||||
rust-nightly-x86_64-unknown-linux-gnu/install.sh --destdir="$out" --prefix="" --without=rust-docs-json-preview,rust-docs --disable-ldconfig
|
||||
rust-src-nightly/install.sh --destdir="$out" --prefix="" --disable-ldconfig
|
||||
|
||||
cp -pr --reflink=auto -- xtensa-esp-elf "$out";
|
||||
# ensure linker is in PATH
|
||||
ln -s $out/xtensa-esp-elf/bin/* "$out/bin/"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
in
|
||||
(pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
espflash
|
||||
toolchain-pkg
|
||||
];
|
||||
})
|
||||
+284
@@ -0,0 +1,284 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![deny(
|
||||
clippy::mem_forget,
|
||||
reason = "mem::forget is generally not safe to do with esp_hal types, especially those \
|
||||
holding buffers for the duration of a data transfer."
|
||||
)]
|
||||
#![deny(clippy::large_stack_frames)]
|
||||
|
||||
use core::convert::Infallible;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use display_interface_spi::SPIInterface;
|
||||
use embedded_graphics::Drawable;
|
||||
use embedded_graphics::mono_font::MonoTextStyle;
|
||||
use embedded_graphics::mono_font::ascii::FONT_6X10;
|
||||
use embedded_graphics::pixelcolor::Rgb565;
|
||||
use embedded_graphics::prelude::Point;
|
||||
use embedded_graphics::prelude::RgbColor;
|
||||
use embedded_graphics::text::Text;
|
||||
use embedded_graphics_core::draw_target::DrawTarget;
|
||||
use embedded_hal_bus::spi::ExclusiveDevice;
|
||||
use esp_hal::clock::CpuClock;
|
||||
use esp_hal::delay::Delay;
|
||||
use esp_hal::gpio::Level;
|
||||
use esp_hal::gpio::Output;
|
||||
use esp_hal::gpio::OutputConfig;
|
||||
use esp_hal::main;
|
||||
use esp_hal::spi::{
|
||||
Mode,
|
||||
master::{Config, Spi},
|
||||
};
|
||||
use esp_hal::time::{Duration, Instant};
|
||||
use esp_hal::timer::timg::TimerGroup;
|
||||
use esp_println::dbg;
|
||||
use ili9341::Ili9341;
|
||||
use ili9341::Orientation;
|
||||
use log::{error, info};
|
||||
use pn532::i2c::I2CInterface;
|
||||
use pn532::nb;
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(panic_info: &core::panic::PanicInfo) -> ! {
|
||||
error!("{}", panic_info);
|
||||
loop {}
|
||||
}
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
// This creates a default app-descriptor required by the esp-idf bootloader.
|
||||
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
||||
esp_bootloader_esp_idf::esp_app_desc!();
|
||||
|
||||
#[allow(
|
||||
clippy::large_stack_frames,
|
||||
reason = "it's not unusual to allocate larger buffers etc. in main"
|
||||
)]
|
||||
#[main]
|
||||
fn main() -> ! {
|
||||
// generator version: 1.3.0
|
||||
// generator parameters: --chip esp32s3 -o esp32s3-wroom-1-octal-psram -o unstable-hal -o alloc -o wifi -o log -o wokwi -o neovim -o vscode -o esp
|
||||
|
||||
esp_println::logger::init_logger_from_env();
|
||||
|
||||
let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
|
||||
let peripherals = esp_hal::init(config);
|
||||
|
||||
let sck = peripherals.GPIO18;
|
||||
let mosi = peripherals.GPIO23;
|
||||
let miso = peripherals.GPIO19;
|
||||
let cs_main = peripherals.GPIO5;
|
||||
let dc = peripherals.GPIO17;
|
||||
let reset_main = peripherals.GPIO16;
|
||||
|
||||
let sda = peripherals.GPIO21;
|
||||
let scl = peripherals.GPIO22;
|
||||
|
||||
esp_alloc::heap_allocator!(#[esp_hal::ram(reclaimed)] size: 73744);
|
||||
|
||||
let timg0 = TimerGroup::new(peripherals.TIMG0);
|
||||
let sw_interrupt =
|
||||
esp_hal::interrupt::software::SoftwareInterruptControl::new(peripherals.SW_INTERRUPT);
|
||||
esp_rtos::start(timg0.timer0, sw_interrupt.software_interrupt0);
|
||||
let (mut _wifi_controller, _interfaces) =
|
||||
esp_radio::wifi::new(peripherals.WIFI, Default::default())
|
||||
.expect("Failed to initialize Wi-Fi controller");
|
||||
|
||||
let spi_bus = Spi::new(
|
||||
peripherals.SPI2,
|
||||
Config::default()
|
||||
.with_frequency(Rate::from_khz(100))
|
||||
.with_mode(Mode::_0),
|
||||
)
|
||||
.unwrap()
|
||||
.with_sck(sck)
|
||||
.with_mosi(mosi)
|
||||
.with_miso(miso);
|
||||
|
||||
let cs_main = Output::new(cs_main, Level::High, OutputConfig::default());
|
||||
|
||||
let mut delay = Delay::new();
|
||||
let spi_dev = ExclusiveDevice::new(spi_bus, cs_main, delay).unwrap();
|
||||
let reset_main = Output::new(reset_main, Level::High, OutputConfig::default());
|
||||
let spi_dc = Output::new(dc, Level::High, OutputConfig::default());
|
||||
let iface = SPIInterface::new(spi_dev, spi_dc);
|
||||
|
||||
let mut display = Ili9341::new(
|
||||
iface,
|
||||
reset_main,
|
||||
&mut delay,
|
||||
Orientation::Landscape,
|
||||
ili9341::DisplaySize240x320,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// display.clear(Rgb565::BLACK).unwrap();
|
||||
|
||||
let style = MonoTextStyle::new(&FONT_6X10, Rgb565::WHITE);
|
||||
Text::new("Hello, ESP32!", Point::new(20, 100), style)
|
||||
.draw(&mut display)
|
||||
.unwrap();
|
||||
|
||||
use pn532::{Pn532, Request, requests::SAMMode};
|
||||
|
||||
// spi is a struct implementing embedded_hal::spi::SpiDevice
|
||||
// timer is a struct implementing pn532::CountDown
|
||||
|
||||
use esp_hal::{
|
||||
i2c::master::{Config as I2cConfig, I2c},
|
||||
time::Rate,
|
||||
};
|
||||
|
||||
let config = I2cConfig::default().with_frequency(Rate::from_khz(20));
|
||||
let i2c = I2c::new(peripherals.I2C0, config)
|
||||
.expect("Failed to init I2C")
|
||||
.with_sda(sda)
|
||||
.with_scl(scl);
|
||||
|
||||
let mut pn532: Pn532<_, _, 32> = Pn532::new(I2CInterface { i2c }, TimerWrapper::new());
|
||||
|
||||
let ms_50 = Duration::from_millis(50);
|
||||
let ms_1000 = Duration::from_millis(1000);
|
||||
|
||||
let delay_start = Instant::now();
|
||||
while delay_start.elapsed() < Duration::from_millis(500) {}
|
||||
|
||||
let mut data: Vec<u8> = Vec::with_capacity(858);
|
||||
|
||||
if let Err(e) = pn532.process(
|
||||
&Request::sam_configuration(SAMMode::Normal, false),
|
||||
0,
|
||||
Duration::from_millis(5000),
|
||||
) {
|
||||
error!("Could not initialize PN532: {e:?}")
|
||||
} else {
|
||||
info!("Successfully init'ed PN532");
|
||||
}
|
||||
|
||||
loop {
|
||||
info!("Hello world!");
|
||||
|
||||
match pn532.process(
|
||||
&Request::INLIST_ONE_ISO_A_TARGET,
|
||||
23,
|
||||
Duration::from_secs(10),
|
||||
) {
|
||||
Ok(uid) => {
|
||||
info!("uid = {uid:?}");
|
||||
for i in (0x04..=230) {
|
||||
let mut parse_result = Err(());
|
||||
while parse_result.is_err() {
|
||||
let Ok(result) = pn532.process(&Request::ntag_read(i), 17, ms_1000) else {
|
||||
continue;
|
||||
};
|
||||
parse_result = parse_nfc(i, result);
|
||||
}
|
||||
let bytes = parse_result.unwrap();
|
||||
data.extend(bytes);
|
||||
}
|
||||
info!("Full data: {data:02x?}");
|
||||
match ndef::Message::try_from(&data[4..4 + 883]) {
|
||||
Ok(m) => info!("Parsed: {m:02x?}"),
|
||||
Err(e) => info!("Failed to parse: {e:?}"),
|
||||
}
|
||||
data.clear();
|
||||
}
|
||||
Err(e) => {
|
||||
info!("No NFC card found: {e:?}");
|
||||
}
|
||||
}
|
||||
|
||||
let delay_start = Instant::now();
|
||||
while delay_start.elapsed() < Duration::from_millis(500) {}
|
||||
}
|
||||
|
||||
// for inspiration have a look at the examples at https://github.com/esp-rs/esp-hal/tree/esp-hal-v1.1.0/examples
|
||||
}
|
||||
|
||||
fn parse_nfc(iteration: u8, bytes: &[u8]) -> Result<[u8; 4], ()> {
|
||||
let success = bytes.first().is_some_and(|x| *x == 0);
|
||||
if success {
|
||||
// info!("page {i}: {:02x?}", result);
|
||||
let mut arr = [0; 4];
|
||||
arr.copy_from_slice(&bytes[1..5]);
|
||||
Ok(arr)
|
||||
} else {
|
||||
info!("err {iteration}: {:02x?}", bytes);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
struct TimerWrapper {
|
||||
// TODO Is that timer accurate enough?
|
||||
start: Instant,
|
||||
duration: Duration,
|
||||
counter: u32,
|
||||
}
|
||||
|
||||
impl TimerWrapper {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
start: Instant::now(),
|
||||
duration: Duration::ZERO,
|
||||
counter: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl pn532::CountDown for TimerWrapper {
|
||||
type Time = Duration;
|
||||
|
||||
fn start<T>(&mut self, timeout: T)
|
||||
where
|
||||
T: Into<Self::Time>,
|
||||
{
|
||||
// without this debug log, it works worse: stuck in NFC card search without ever returning.
|
||||
self.start = Instant::now();
|
||||
self.duration = timeout.into();
|
||||
self.counter = 0;
|
||||
}
|
||||
|
||||
fn wait(&mut self) -> nb::Result<(), Infallible> {
|
||||
let elapsed = self.start.elapsed();
|
||||
self.counter += 1;
|
||||
if self.counter.is_multiple_of(1) {
|
||||
// info!("Elapsed: {elapsed}");
|
||||
}
|
||||
if elapsed >= self.duration {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(nb::Error::WouldBlock)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
struct TimerWrapper<'a, T>
|
||||
where
|
||||
T: esp_hal::DriverMode,
|
||||
{
|
||||
timer: esp_hal::timer::PeriodicTimer<'a, T>,
|
||||
}
|
||||
|
||||
impl<'a, TIM> pn532::CountDown for TimerWrapper<'a, TIM>
|
||||
where
|
||||
TIM: esp_hal::DriverMode,
|
||||
{
|
||||
type Time = Duration;
|
||||
fn start<T>(&mut self, timeout: T)
|
||||
where
|
||||
T: Into<Self::Time>,
|
||||
{
|
||||
self.timer.start(timeout.into()).unwrap();
|
||||
}
|
||||
|
||||
fn wait(&mut self) -> nb::Result<(), Infallible> {
|
||||
// convert nb::Result<(), void::Void> to nb::Result<(), Infallible>
|
||||
match self.timer.wait() {
|
||||
Ok(_) => Ok(()),
|
||||
Err(_) => Err(nb::Error::WouldBlock),
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1 @@
|
||||
#![no_std]
|
||||
@@ -0,0 +1,5 @@
|
||||
[wokwi]
|
||||
version = 1
|
||||
gdbServerPort = 3333
|
||||
elf = "target/xtensa-esp32-none-elf/debug/creaturedex"
|
||||
firmware = "target/xtensa-esp32-none-elf/debug/creaturedex"
|
||||
Reference in New Issue
Block a user