@@ -230,51 +230,6 @@ impl core::fmt::Write for &Ringbuffer {
230230 }
231231}
232232
233- /// The global type for sharing things with an interrupt handler
234- pub struct GlobalIrqState < T > {
235- inner : critical_section:: Mutex < core:: cell:: RefCell < Option < T > > > ,
236- }
237-
238- impl < T > GlobalIrqState < T > {
239- /// Create a new, empty, object
240- pub const fn new ( ) -> GlobalIrqState < T > {
241- GlobalIrqState {
242- inner : critical_section:: Mutex :: new ( core:: cell:: RefCell :: new ( None ) ) ,
243- }
244- }
245-
246- /// Load a value into the global
247- ///
248- /// Returns the old value, if any
249- pub fn load ( & self , value : T ) -> Option < T > {
250- critical_section:: with ( |cs| self . inner . borrow ( cs) . replace ( Some ( value) ) )
251- }
252- }
253-
254- /// The local type for sharing things with an interrupt handler
255- pub struct LocalIrqState < T > {
256- inner : Option < T > ,
257- }
258-
259- impl < T > LocalIrqState < T > {
260- /// Create a new, empty, object
261- pub const fn new ( ) -> LocalIrqState < T > {
262- LocalIrqState { inner : None }
263- }
264-
265- /// Grab a mutable reference to the contents.
266- ///
267- /// If the value is empty, the contents are taken from a mutex-locked global
268- /// variable. That global must have been initialised before calling this
269- /// function. If not, this function panics.
270- pub fn get_or_init_with ( & mut self , global : & GlobalIrqState < T > ) -> & mut T {
271- let result = self . inner . get_or_insert_with ( || {
272- critical_section:: with ( |cs| global. inner . borrow ( cs) . replace ( None ) . unwrap ( ) )
273- } ) ;
274- result
275- }
276- }
277-
278233/// The ways that initialisation can fail
279234#[ derive( Debug , Copy , Clone , defmt:: Format ) ]
280235pub enum Error {
0 commit comments