From 476aaff57626ff36569b7657aa29fff1ec0dee71 Mon Sep 17 00:00:00 2001 From: Kezi Date: Tue, 26 Mar 2024 22:36:33 +0100 Subject: [PATCH] fix ci --- src/bin/espnow_remote.rs | 8 ++++++-- src/bin/graphics.rs | 8 ++++++-- src/bin/rink.rs | 8 ++++++-- src/bin/sound.rs | 14 ++++++++------ 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/bin/espnow_remote.rs b/src/bin/espnow_remote.rs index 4870634..68a0f5c 100644 --- a/src/bin/espnow_remote.rs +++ b/src/bin/espnow_remote.rs @@ -25,8 +25,12 @@ fn main() { let sysloop = EspSystemEventLoop::take().unwrap(); - let (mut display, mut keyboard) = - cardputer_peripherals(peripherals.pins, peripherals.spi2, peripherals.ledc); + let (mut display, mut keyboard, _) = cardputer_peripherals( + peripherals.pins, + peripherals.spi2, + peripherals.ledc, + peripherals.i2s0, + ); let mut raw_fb = Box::new([0u16; SCREEN_WIDTH * SCREEN_HEIGHT]); let mut terminal = diff --git a/src/bin/graphics.rs b/src/bin/graphics.rs index 31e1833..82a7bdb 100644 --- a/src/bin/graphics.rs +++ b/src/bin/graphics.rs @@ -47,8 +47,12 @@ fn main() { let peripherals = peripherals::Peripherals::take().unwrap(); - let (display, mut keyboard) = - cardputer_peripherals(peripherals.pins, peripherals.spi2, peripherals.ledc); + let (display, mut keyboard, _) = cardputer_peripherals( + peripherals.pins, + peripherals.spi2, + peripherals.ledc, + peripherals.i2s0, + ); let mut raw_framebuffer_0 = Box::new([0u16; 240 * 135]); let mut raw_framebuffer_1 = Box::new([0u16; 240 * 135]); diff --git a/src/bin/rink.rs b/src/bin/rink.rs index f63c7c5..e6797f6 100644 --- a/src/bin/rink.rs +++ b/src/bin/rink.rs @@ -15,8 +15,12 @@ fn main() { let peripherals = peripherals::Peripherals::take().unwrap(); - let (mut display, mut keyboard) = - cardputer_peripherals(peripherals.pins, peripherals.spi2, peripherals.ledc); + let (mut display, mut keyboard, _) = cardputer_peripherals( + peripherals.pins, + peripherals.spi2, + peripherals.ledc, + peripherals.i2s0, + ); let mut raw_fb = Box::new([0u16; SCREEN_WIDTH * SCREEN_HEIGHT]); let mut terminal = diff --git a/src/bin/sound.rs b/src/bin/sound.rs index 035f14f..935a200 100644 --- a/src/bin/sound.rs +++ b/src/bin/sound.rs @@ -1,3 +1,5 @@ +use std::f32::consts::PI; + use cardputer::{ hal::cardputer_peripherals, terminal::FbTerminal, @@ -6,19 +8,19 @@ use cardputer::{ }; use esp_idf_hal::{io::Write, peripherals}; -const SAMPLE_RATE: f64 = 48000.0; -const FREQUENCY: f64 = 440.0; -const AMPLITUDE: f64 = 127.0; +const SAMPLE_RATE: f32 = 48000.0; +const FREQUENCY: f32 = 440.0; +const AMPLITUDE: f32 = 127.0; -fn generate_sine_wave(duration_secs: f64) -> Vec { +fn generate_sine_wave(duration_secs: f32) -> Vec { let num_samples = (duration_secs * SAMPLE_RATE) as usize; let mut samples = Vec::with_capacity(num_samples); let sample_period = 1.0 / SAMPLE_RATE; for i in 0..num_samples { - let t = i as f64 * sample_period; - let angular_freq = 2.0 * 3.141593 * FREQUENCY + t * 200.0; + let t = i as f32 * sample_period; + let angular_freq = 2.0 * PI * FREQUENCY + t * 200.0; let sample_value = (AMPLITUDE * (angular_freq * t).sin()) as u8; samples.push(sample_value); }