diff --git a/src/main.rs b/src/main.rs index 88d9c5a..3922e8a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,6 +18,14 @@ static EXECUTOR0: StaticCell = StaticCell::new(); static EXECUTOR1: StaticCell = StaticCell::new(); static CHANNEL: Channel = Channel::new(); +enum State { + Happy, + Sad, + Relaxed, + Surprised, + Unknown, +} + #[derive(Clone)] struct Buffer([f32; BUF_SIZE]); @@ -50,7 +58,8 @@ async fn core0_task() { let mut count = 0; info!("Hello from core 0"); - // Sample EEG data + // Sample EEG data, then append it to buffer + // When full, send buffer to be added to the queue loop { if count >= BUF_SIZE { CHANNEL.send(buf.clone()).await; @@ -69,15 +78,18 @@ async fn core1_task(mut led: Output<'static, PIN_25>) { info!("Hello from core 1"); loop { + // Shouldn't block on waiting for message? + // Need to test queue.push(CHANNEL.recv().await); process_data(&queue[0]).await; - queue.remove(1); + queue.remove(0); } } -async fn process_data(buf: &Buffer) { +async fn process_data(buf: &Buffer) -> State { // Low-pass filter // FFT (w/ hanning window) - info!("todo"); + info!("Running FFT..."); + return State::Unknown; }