diff options
Diffstat (limited to 'embassy-nxp/src/lib.rs')
| -rw-r--r-- | embassy-nxp/src/lib.rs | 90 |
1 files changed, 16 insertions, 74 deletions
diff --git a/embassy-nxp/src/lib.rs b/embassy-nxp/src/lib.rs index ad2056c06..433aca9e0 100644 --- a/embassy-nxp/src/lib.rs +++ b/embassy-nxp/src/lib.rs | |||
| @@ -1,11 +1,19 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | 2 | ||
| 3 | pub mod gpio; | 3 | pub mod gpio; |
| 4 | mod pac_utils; | 4 | #[cfg(feature = "lpc55")] |
| 5 | pub mod pint; | 5 | pub mod pint; |
| 6 | 6 | ||
| 7 | pub use embassy_hal_internal::Peri; | 7 | // This mod MUST go last, so that it sees all the `impl_foo!` macros |
| 8 | pub use lpc55_pac as pac; | 8 | #[cfg_attr(feature = "lpc55", path = "chips/lpc55.rs")] |
| 9 | mod chip; | ||
| 10 | |||
| 11 | #[cfg(feature = "unstable-pac")] | ||
| 12 | pub use chip::pac; | ||
| 13 | #[cfg(not(feature = "unstable-pac"))] | ||
| 14 | pub(crate) use chip::pac; | ||
| 15 | pub use chip::{peripherals, Peripherals}; | ||
| 16 | pub use embassy_hal_internal::{Peri, PeripheralType}; | ||
| 9 | 17 | ||
| 10 | /// Initialize the `embassy-nxp` HAL with the provided configuration. | 18 | /// Initialize the `embassy-nxp` HAL with the provided configuration. |
| 11 | /// | 19 | /// |
| @@ -13,81 +21,15 @@ pub use lpc55_pac as pac; | |||
| 13 | /// | 21 | /// |
| 14 | /// This should only be called once and at startup, otherwise it panics. | 22 | /// This should only be called once and at startup, otherwise it panics. |
| 15 | pub fn init(_config: config::Config) -> Peripherals { | 23 | pub fn init(_config: config::Config) -> Peripherals { |
| 16 | gpio::init(); | 24 | #[cfg(feature = "lpc55")] |
| 17 | pint::init(); | 25 | { |
| 26 | gpio::init(); | ||
| 27 | pint::init(); | ||
| 28 | } | ||
| 18 | 29 | ||
| 19 | crate::Peripherals::take() | 30 | crate::Peripherals::take() |
| 20 | } | 31 | } |
| 21 | 32 | ||
| 22 | embassy_hal_internal::peripherals! { | ||
| 23 | // External pins. These are not only GPIOs, they are multi-purpose pins and can be used by other | ||
| 24 | // peripheral types (e.g. I2C). | ||
| 25 | PIO0_0, | ||
| 26 | PIO0_1, | ||
| 27 | PIO0_2, | ||
| 28 | PIO0_3, | ||
| 29 | PIO0_4, | ||
| 30 | PIO0_5, | ||
| 31 | PIO0_6, | ||
| 32 | PIO0_7, | ||
| 33 | PIO0_8, | ||
| 34 | PIO0_9, | ||
| 35 | PIO0_10, | ||
| 36 | PIO0_11, | ||
| 37 | PIO0_12, | ||
| 38 | PIO0_13, | ||
| 39 | PIO0_14, | ||
| 40 | PIO0_15, | ||
| 41 | PIO0_16, | ||
| 42 | PIO0_17, | ||
| 43 | PIO0_18, | ||
| 44 | PIO0_19, | ||
| 45 | PIO0_20, | ||
| 46 | PIO0_21, | ||
| 47 | PIO0_22, | ||
| 48 | PIO0_23, | ||
| 49 | PIO0_24, | ||
| 50 | PIO0_25, | ||
| 51 | PIO0_26, | ||
| 52 | PIO0_27, | ||
| 53 | PIO0_28, | ||
| 54 | PIO0_29, | ||
| 55 | PIO0_30, | ||
| 56 | PIO0_31, | ||
| 57 | PIO1_0, | ||
| 58 | PIO1_1, | ||
| 59 | PIO1_2, | ||
| 60 | PIO1_3, | ||
| 61 | PIO1_4, | ||
| 62 | PIO1_5, | ||
| 63 | PIO1_6, | ||
| 64 | PIO1_7, | ||
| 65 | PIO1_8, | ||
| 66 | PIO1_9, | ||
| 67 | PIO1_10, | ||
| 68 | PIO1_11, | ||
| 69 | PIO1_12, | ||
| 70 | PIO1_13, | ||
| 71 | PIO1_14, | ||
| 72 | PIO1_15, | ||
| 73 | PIO1_16, | ||
| 74 | PIO1_17, | ||
| 75 | PIO1_18, | ||
| 76 | PIO1_19, | ||
| 77 | PIO1_20, | ||
| 78 | PIO1_21, | ||
| 79 | PIO1_22, | ||
| 80 | PIO1_23, | ||
| 81 | PIO1_24, | ||
| 82 | PIO1_25, | ||
| 83 | PIO1_26, | ||
| 84 | PIO1_27, | ||
| 85 | PIO1_28, | ||
| 86 | PIO1_29, | ||
| 87 | PIO1_30, | ||
| 88 | PIO1_31, | ||
| 89 | } | ||
| 90 | |||
| 91 | /// HAL configuration for the NXP board. | 33 | /// HAL configuration for the NXP board. |
| 92 | pub mod config { | 34 | pub mod config { |
| 93 | #[derive(Default)] | 35 | #[derive(Default)] |
