|
@@ -34,14 +34,21 @@ mod tusb322;
|
|
|
|
|
|
use nixie::*;
|
|
|
|
|
|
-static RTC_INT: Mutex<RefCell<Option<PB5<Input<Floating>>>>> = Mutex::new(RefCell::new(None));
|
|
|
-static FAULT_INT: Mutex<RefCell<Option<PA3<Input<PullUp>>>>> = Mutex::new(RefCell::new(None));
|
|
|
-static FAULT_LED: Mutex<RefCell<Option<PC15<Output<PushPull>>>>> = Mutex::new(RefCell::new(None));
|
|
|
-static I2C: Mutex<RefCell<Option<
|
|
|
- I2c<I2C1, (PA9<Alternate<AF4, Output<OpenDrain>>>,PA10<Alternate<AF4,Output<OpenDrain>>>,),>,
|
|
|
- >,>,> = Mutex::new(RefCell::new(None));
|
|
|
-static FPS_TIMER: Mutex<RefCell<Option<Timer<TIM2>>>> = Mutex::new(RefCell::new(None));
|
|
|
-static CYCLE_TIMER: Mutex<RefCell<Option<Timer<TIM7>>>> = Mutex::new(RefCell::new(None));
|
|
|
+// Local peripheral mappings
|
|
|
+type RtcInt = PB5<Input<Floating>>;
|
|
|
+type FaultInt = PA3<Input<PullUp>>;
|
|
|
+type FaultLed = PC15<Output<PushPull>>;
|
|
|
+type I2c1 = I2c<I2C1, (PA9<Alternate<AF4, Output<OpenDrain>>>,PA10<Alternate<AF4,Output<OpenDrain>>>)>;
|
|
|
+type FpsTimer = Timer<TIM2>;
|
|
|
+type CycleTimer = Timer<TIM7>;
|
|
|
+
|
|
|
+// Global peripheral singletons
|
|
|
+static RTC_INT: Mutex<RefCell<Option<RtcInt>>> = Mutex::new(RefCell::new(None));
|
|
|
+static FAULT_INT: Mutex<RefCell<Option<FaultInt>>> = Mutex::new(RefCell::new(None));
|
|
|
+static FAULT_LED: Mutex<RefCell<Option<FaultLed>>> = Mutex::new(RefCell::new(None));
|
|
|
+static I2C: Mutex<RefCell<Option<I2c1>>> = Mutex::new(RefCell::new(None));
|
|
|
+static FPS_TIMER: Mutex<RefCell<Option<FpsTimer>>> = Mutex::new(RefCell::new(None));
|
|
|
+static CYCLE_TIMER: Mutex<RefCell<Option<CycleTimer>>> = Mutex::new(RefCell::new(None));
|
|
|
static CLOCK: Mutex<RefCell<Clock>> = Mutex::new(RefCell::new(Clock::default()));
|
|
|
|
|
|
#[cfg(not(test))]
|