diff options
Diffstat (limited to 'embassy-imxrt/src/lib.rs')
| -rw-r--r-- | embassy-imxrt/src/lib.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/embassy-imxrt/src/lib.rs b/embassy-imxrt/src/lib.rs index d56d993c3..5fbf3244b 100644 --- a/embassy-imxrt/src/lib.rs +++ b/embassy-imxrt/src/lib.rs | |||
| @@ -21,6 +21,9 @@ pub mod clocks; | |||
| 21 | pub mod gpio; | 21 | pub mod gpio; |
| 22 | pub mod iopctl; | 22 | pub mod iopctl; |
| 23 | 23 | ||
| 24 | #[cfg(feature = "_time-driver")] | ||
| 25 | pub mod rtc; | ||
| 26 | |||
| 24 | // This mod MUST go last, so that it sees all the `impl_foo!' macros | 27 | // This mod MUST go last, so that it sees all the `impl_foo!' macros |
| 25 | #[cfg_attr(feature = "mimxrt633s", path = "chips/mimxrt633s.rs")] | 28 | #[cfg_attr(feature = "mimxrt633s", path = "chips/mimxrt633s.rs")] |
| 26 | #[cfg_attr(feature = "mimxrt685s", path = "chips/mimxrt685s.rs")] | 29 | #[cfg_attr(feature = "mimxrt685s", path = "chips/mimxrt685s.rs")] |
| @@ -86,12 +89,18 @@ pub mod config { | |||
| 86 | pub struct Config { | 89 | pub struct Config { |
| 87 | /// Clock configuration. | 90 | /// Clock configuration. |
| 88 | pub clocks: ClockConfig, | 91 | pub clocks: ClockConfig, |
| 92 | |||
| 93 | /// RTC Time driver interrupt priority. | ||
| 94 | #[cfg(feature = "_time-driver")] | ||
| 95 | pub time_interrupt_priority: crate::interrupt::Priority, | ||
| 89 | } | 96 | } |
| 90 | 97 | ||
| 91 | impl Default for Config { | 98 | impl Default for Config { |
| 92 | fn default() -> Self { | 99 | fn default() -> Self { |
| 93 | Self { | 100 | Self { |
| 94 | clocks: ClockConfig::crystal(), | 101 | clocks: ClockConfig::crystal(), |
| 102 | #[cfg(feature = "_time-driver")] | ||
| 103 | time_interrupt_priority: crate::interrupt::Priority::P0, | ||
| 95 | } | 104 | } |
| 96 | } | 105 | } |
| 97 | } | 106 | } |
| @@ -99,7 +108,11 @@ pub mod config { | |||
| 99 | impl Config { | 108 | impl Config { |
| 100 | /// Create a new configuration with the provided clock config. | 109 | /// Create a new configuration with the provided clock config. |
| 101 | pub fn new(clocks: ClockConfig) -> Self { | 110 | pub fn new(clocks: ClockConfig) -> Self { |
| 102 | Self { clocks } | 111 | Self { |
| 112 | clocks, | ||
| 113 | #[cfg(feature = "_time-driver")] | ||
| 114 | time_interrupt_priority: crate::interrupt::Priority::P0, | ||
| 115 | } | ||
| 103 | } | 116 | } |
| 104 | } | 117 | } |
| 105 | } | 118 | } |
| @@ -122,6 +135,10 @@ pub fn init(config: config::Config) -> Peripherals { | |||
| 122 | gpio::init(); | 135 | gpio::init(); |
| 123 | } | 136 | } |
| 124 | 137 | ||
| 138 | // init RTC time driver | ||
| 139 | #[cfg(feature = "_time-driver")] | ||
| 140 | rtc::init(config.time_interrupt_priority); | ||
| 141 | |||
| 125 | peripherals | 142 | peripherals |
| 126 | } | 143 | } |
| 127 | 144 | ||
