Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Kezii committed Mar 26, 2024
1 parent 0ff2e9d commit 476aaff
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
8 changes: 6 additions & 2 deletions src/bin/espnow_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
8 changes: 6 additions & 2 deletions src/bin/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
8 changes: 6 additions & 2 deletions src/bin/rink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
14 changes: 8 additions & 6 deletions src/bin/sound.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::f32::consts::PI;

use cardputer::{
hal::cardputer_peripherals,
terminal::FbTerminal,
Expand All @@ -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<u8> {
fn generate_sine_wave(duration_secs: f32) -> Vec<u8> {
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);
}
Expand Down

0 comments on commit 476aaff

Please sign in to comment.