1#[cfg(not(esp32s2))]
2pub use split::*;
3
4use crate::impl_peripheral;
5
6#[cfg(any(
7 not(any(esp32h2, esp32h4, esp32p4)),
8 esp_idf_comp_espressif__esp_wifi_remote_enabled
9))]
10pub trait WifiModemPeripheral {}
11
12#[cfg(any(esp32h2, esp32h4, esp32c5, esp32c6, esp32c61))]
13pub trait ThreadModemPeripheral {}
14
15#[cfg(not(esp32s2))]
16pub trait BluetoothModemPeripheral {}
17
18impl_peripheral!(Modem);
19
20#[allow(clippy::needless_lifetimes)]
21impl<'d> Modem<'d> {
22 #[cfg(not(any(esp32s2, esp32h2, esp32h4, esp32c5, esp32c6, esp32c61, esp32p4)))]
23 pub fn split(self) -> (WifiModem<'d>, BluetoothModem<'d>) {
24 unsafe { (WifiModem::steal(), BluetoothModem::steal()) }
25 }
26
27 #[cfg(not(any(esp32s2, esp32h2, esp32h4, esp32c5, esp32c6, esp32c61, esp32p4)))]
28 pub fn split_reborrow(&mut self) -> (WifiModem<'_>, BluetoothModem<'_>) {
29 unsafe { (WifiModem::steal(), BluetoothModem::steal()) }
30 }
31
32 #[cfg(any(esp32h2, esp32h4))]
33 pub fn split(self) -> (ThreadModem<'d>, BluetoothModem<'d>) {
34 unsafe { (ThreadModem::steal(), BluetoothModem::steal()) }
35 }
36
37 #[cfg(any(esp32h2, esp32h4))]
38 pub fn split_reborrow(&mut self) -> (ThreadModem<'_>, BluetoothModem<'_>) {
39 unsafe { (ThreadModem::steal(), BluetoothModem::steal()) }
40 }
41
42 #[cfg(any(esp32c5, esp32c6, esp32c61))]
43 pub fn split(self) -> (WifiModem<'d>, ThreadModem<'d>, BluetoothModem<'d>) {
44 unsafe {
45 (
46 WifiModem::steal(),
47 ThreadModem::steal(),
48 BluetoothModem::steal(),
49 )
50 }
51 }
52
53 #[cfg(esp32c6)]
54 pub fn split_reborrow(&mut self) -> (WifiModem<'_>, ThreadModem<'_>, BluetoothModem<'_>) {
55 unsafe {
56 (
57 WifiModem::steal(),
58 ThreadModem::steal(),
59 BluetoothModem::steal(),
60 )
61 }
62 }
63}
64
65#[cfg(not(esp32h2))]
66impl WifiModemPeripheral for Modem<'_> {}
67
68#[cfg(any(esp32h2, esp32c5, esp32c6, esp32c61))]
69impl ThreadModemPeripheral for Modem<'_> {}
70
71#[cfg(not(any(esp32s2, esp32p4)))]
72impl BluetoothModemPeripheral for Modem<'_> {}
73
74#[cfg(not(esp32s2))]
75mod split {
76 #[cfg(not(esp32h2))]
77 crate::impl_peripheral!(WifiModem);
78
79 #[cfg(not(esp32h2))]
80 impl super::WifiModemPeripheral for WifiModem<'_> {}
81
82 #[cfg(any(esp32h2, esp32c5, esp32c6, esp32c61))]
83 crate::impl_peripheral!(ThreadModem);
84
85 #[cfg(any(esp32h2, esp32c5, esp32c6, esp32c61))]
86 impl super::ThreadModemPeripheral for ThreadModem<'_> {}
87
88 crate::impl_peripheral!(BluetoothModem);
89
90 impl super::BluetoothModemPeripheral for BluetoothModem<'_> {}
91}