Comments (5)
No, I have simply forgotten about it. Will fix shortly.
from esp-idf-hal.
But that's still strange. I don't know embassy-executor
in detail, but why is it requiring the Future-s to be Send
? After all, they ALL run in a single thread, so to say. This is weird?
from esp-idf-hal.
Can you paste your code here? Or upload it somewhere? I suspect there is something else fishy going on (not that the async driver should not be Send
, but with embassy, that should not be a prob).
from esp-idf-hal.
Oh we're not using embassy-executor, but actually using your edge-executor
crate! We're using the same PriorityExecutor defined under the examples, as a matter of fact. And that does require Send
.
In fact, since we're using just one thread to run all our tasks, I just removed the Send
requirement for the futures under that executor, and made it use LocalExecutors
, and now it compiles:
pub struct PriorityExecutor<'a> {
ex: [LocalExecutor<'a>; 3],
}
unsafe impl<'a> Sync for PriorityExecutor<'a> {}
impl<'a> PriorityExecutor<'a> {
pub const fn new() -> PriorityExecutor<'a> {
PriorityExecutor {
ex: [LocalExecutor::new(), LocalExecutor::new(), LocalExecutor::new()],
}
}
pub fn spawn<T: 'a>(
&self,
priority: Priority,
future: impl Future<Output = T> + 'a,
) -> Task<T> {
self.ex[priority as usize].spawn(future)
}
pub async fn run(&self) {
loop {
for _ in 0..200 {
let t0 = self.ex[0].tick();
let t1 = self.ex[1].tick();
let t2 = self.ex[2].tick();
t0.or(t1).or(t2).await;
}
future::yield_now().await;
}
}
}
from esp-idf-hal.
Yep, exactly! I can't imagine anybody using the parallel executor in embedded. I mean, if you really need to utilize multiple threads, you are probably better off with a separate LocalExecutor
in each thread, and then if you need the futures in these executors to share stuff, use Signal
or Channel
or something from embassy-sync
. And then only the futures of the embassy-sync
synchronization primitives need to be Send
(and you can easily achieve this with using them with a CriticalSectionRawMutex
or your own RawMutex
impl based on std::sync::Mutex
.), but not the rest.
from esp-idf-hal.
Related Issues (20)
- Async Uart Write hangs forever HOT 3
- Extra component HOT 6
- esp_idf_hal::delay::Delay missing some methods for embedded_hal::blocking::delay HOT 2
- Hardware acceleration for crypto?
- Conflict between esp-idf-hal and display-interface-spi on embedded-hal version HOT 1
- Documentation/API regarding default input pin pull up/down state HOT 7
- Ubuntu 22.04.3 LTS Cross-Compilation for the target = "riscv32imac-esp-espidf" (IDFGH-11878) HOT 4
- Remove 4096 limit for SPI dma transfer size HOT 2
- Can't enable the `edge-executor` feature HOT 2
- i2c broken on esp32-c6 HOT 1
- Never return type for `reset::restart`
- Simple blink example for RGB Led on Esp32 C6
- Shared I2C bus example HOT 1
- Support async in i2c Driver by using new ESP-IDF V5.2 driver impl
- rmt_neopixel no longer works (on esp32c6) HOT 3
- Mutating struct in ISR HOT 1
- Error: dangerous relocation: call8: call target out of range:(xtensa-esp32s3-espidf) HOT 3
- Transport(Failed to load system certs: No valid certificate found) (xtensa-esp32s3-espidf/STD) HOT 4
- need uart dtr, for rs485 control HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-idf-hal.