@@ -130,29 +130,29 @@ fn number_of_nvic_registers() -> usize {
130130}
131131
132132/// Clear all pending interrupts
133- pub unsafe fn clear_all_pending ( ) {
133+ pub fn clear_all_pending ( ) {
134134 for icpr in NVIC . icpr . iter ( ) . take ( number_of_nvic_registers ( ) ) {
135135 icpr. set ( !0 )
136136 }
137137}
138138
139139/// Enable all interrupts
140- pub unsafe fn enable_all ( ) {
140+ pub fn enable_all ( ) {
141141 for icer in NVIC . iser . iter ( ) . take ( number_of_nvic_registers ( ) ) {
142142 icer. set ( !0 )
143143 }
144144}
145145
146146/// Disable all interrupts
147- pub unsafe fn disable_all ( ) {
147+ pub fn disable_all ( ) {
148148 for icer in NVIC . icer . iter ( ) . take ( number_of_nvic_registers ( ) ) {
149149 icer. set ( !0 )
150150 }
151151}
152152
153153/// Get the index (0-240) the lowest number pending interrupt, or `None` if none
154154/// are pending.
155- pub unsafe fn next_pending ( ) -> Option < u32 > {
155+ pub fn next_pending ( ) -> Option < u32 > {
156156 for ( block, ispr) in NVIC
157157 . ispr
158158 . iter ( )
@@ -178,7 +178,7 @@ pub unsafe fn next_pending() -> Option<u32> {
178178/// Mask is defined as two `u128` fields,
179179/// `mask.0` has the bits corresponding to interrupts from 128 to 240.
180180/// `mask.1` has the bits corresponding to interrupts from 0 to 127.
181- pub unsafe fn next_pending_with_mask ( mask : ( u128 , u128 ) ) -> Option < u32 > {
181+ pub fn next_pending_with_mask ( mask : ( u128 , u128 ) ) -> Option < u32 > {
182182 for ( block, ispr) in NVIC
183183 . ispr
184184 . iter ( )
@@ -198,7 +198,7 @@ pub unsafe fn next_pending_with_mask(mask: (u128, u128)) -> Option<u32> {
198198 None
199199}
200200
201- pub unsafe fn has_pending ( ) -> bool {
201+ pub fn has_pending ( ) -> bool {
202202 NVIC . ispr
203203 . iter ( )
204204 . take ( number_of_nvic_registers ( ) )
@@ -212,7 +212,7 @@ pub unsafe fn has_pending() -> bool {
212212/// Mask is defined as two `u128` fields,
213213/// `mask.0` has the bits corresponding to interrupts from 128 to 240.
214214/// `mask.1` has the bits corresponding to interrupts from 0 to 127.
215- pub unsafe fn has_pending_with_mask ( mask : ( u128 , u128 ) ) -> bool {
215+ pub fn has_pending_with_mask ( mask : ( u128 , u128 ) ) -> bool {
216216 NVIC . ispr
217217 . iter ( )
218218 . take ( number_of_nvic_registers ( ) )
@@ -232,10 +232,7 @@ pub struct Nvic(u32);
232232
233233impl Nvic {
234234 /// Creates a new `Nvic`.
235- ///
236- /// Marked unsafe because only chip/platform configuration code should be
237- /// able to create these.
238- pub const unsafe fn new ( idx : u32 ) -> Nvic {
235+ pub const fn new ( idx : u32 ) -> Nvic {
239236 Nvic ( idx)
240237 }
241238
0 commit comments