1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-License-Identifier: MIT OR Apache-2.0
use ;
use ;
/// Shared I2C bus for cooperative tasks on one core.
///
/// NOT `Send`/`Sync`, deliberately. `I2c<'static, Async>` is `!Send` in esp-hal
/// (`PhantomData<*const ()>`) because an async peripheral's wakers and interrupt
/// state belong to the core that armed it with `into_async()`.
///
/// This type used to carry `unsafe impl Send`/`Sync` justified by two claims:
/// that AW9523B init runs on PRO before APP starts, and that the PPS/AXP2101
/// tasks are cooperative. The first stopped being true once consumers moved I2C
/// bring-up onto the APP core (so the IRQ binds there instead of beside the BLE
/// controller's level-1 IRQ on PRO). The second is an argument about *access*,
/// while `Send` is a claim about *moving the value between threads* — a
/// different property that cooperative scheduling does not establish.
///
/// Neither claim can be supported, so the impls are gone. `!Send` is now the
/// compiler's to enforce: a consumer that tries to move the bus to another core
/// gets a build error instead of silent, unchecked breakage.
///
/// `CriticalSectionRawMutex` stays for the flag check, which must be safe
/// against preemption from any context; the CS is not held across the I2C
/// transaction (the guard is released at the next `.await`).
;