Skip to content

Commit

Permalink
feat: Support for the ESP-IDF framework
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov authored Aug 6, 2023
1 parent c67765d commit d9c9ed8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ jobs:
- name: Run cargo check (without dev-dependencies to catch missing feature flags)
if: startsWith(matrix.rust, 'nightly')
run: cargo check -Z features=dev_dep
- name: Add rust-src
if: startsWith(matrix.rust, 'nightly')
run: rustup component add rust-src
# https://github.com/smol-rs/async-io/pull/144#issuecomment-1666927490
# - name: Check selected Tier 3 targets
# if: startsWith(matrix.rust, 'nightly') && matrix.os == 'ubuntu-latest'
# run: cargo check -Z build-std --target=riscv32imc-esp-espidf
- run: cargo test

# Copied from: https://github.com/rust-lang/stacker/pull/19/files
Expand Down
10 changes: 9 additions & 1 deletion src/reactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ cfg_if::cfg_if! {
}
}

#[cfg(not(target_os = "espidf"))]
const TIMER_QUEUE_SIZE: usize = 1000;

/// ESP-IDF - being an embedded OS - does not need so many timers
/// and this saves ~ 20K RAM which is a lot for an MCU with RAM < 400K
#[cfg(target_os = "espidf")]
const TIMER_QUEUE_SIZE: usize = 100;

const READ: usize = 0;
const WRITE: usize = 1;

Expand Down Expand Up @@ -98,7 +106,7 @@ impl Reactor {
sources: Mutex::new(Slab::new()),
events: Mutex::new(Vec::new()),
timers: Mutex::new(BTreeMap::new()),
timer_ops: ConcurrentQueue::bounded(1000),
timer_ops: ConcurrentQueue::bounded(TIMER_QUEUE_SIZE),
}
})
}
Expand Down

0 comments on commit d9c9ed8

Please sign in to comment.