Misc. comments
This commit is contained in:
parent
8642a9cd6c
commit
057802427e
20
src/main.rs
20
src/main.rs
|
@ -18,6 +18,14 @@ static EXECUTOR0: StaticCell<Executor> = StaticCell::new();
|
|||
static EXECUTOR1: StaticCell<Executor> = StaticCell::new();
|
||||
static CHANNEL: Channel<CriticalSectionRawMutex, Buffer, 1> = 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue