pub fn start_time() {
  let peripheral_ptr;
  unsafe {peripheral_ptr = stm32f4::stm32f446::Peripherals::steal();}
  let rcc = &peripheral_ptr.RCC;
  let tim7 = &peripheral_ptr.TIM7;

  if rcc.apb1enr.read().tim7en().is_enabled() {
    rprintln!("Millis Timer already configured! | start_time()");
    return;
  }

  rcc.apb1enr.modify(|_, w| w.tim7en().enabled());
  tim7.cr1.modify(|_, w| w.arpe().enabled());

  tim7.dier.modify(|_, w| w.uie().enabled());
  unsafe {NVIC::unmask(Interrupt::TIM7);}

  // 16MHz -> 1MHz : 1000 = 1kHz -> 1ms
  tim7.psc.write(|w| w.psc().bits(16));
  tim7.arr.write(|w| w.arr().bits(1000));
  tim7.egr.write(|w| w.ug().update());
  tim7.cr1.modify(|_, w| w.cen().enabled());
}
/// Starts a timer that will continuously count the time in milliseconds.
///
/// This is used for non-blocking delays like [millis] and other time related applications.
///
/// # Example
///
/// ```rust,no_run
/// use rustuino::*;
///
/// let mut counter: usize = 0;
/// let delay: usize = 1000;
/// start_time();
///
/// loop {
///   if counter + delay >= millis() {
///     // Do something
///     counter = millis();
///   }
/// }
/// ```
Starts a timer that will continuously count the time in milliseconds.
This is used for non-blocking delays like [millis] and other time related applications.
Starts a timer that will continuously count the time in milliseconds . This is used for non - blocking delays like [ millis ] and other time related applications .
pub fn start_time() {
  let peripheral_ptr;
  unsafe {peripheral_ptr = stm32f4::stm32f446::Peripherals::steal();}
  let rcc = &peripheral_ptr.RCC;
  let tim7 = &peripheral_ptr.TIM7;
  if rcc.apb1enr.read().tim7en().is_enabled() {
    rprintln!("Millis Timer already configured! | start_time()");
    return;
  }
  rcc.apb1enr.modify(|_, w| w.tim7en().enabled());
  tim7.cr1.modify(|_, w| w.arpe().enabled());
  tim7.dier.modify(|_, w| w.uie().enabled());
  unsafe {NVIC::unmask(Interrupt::TIM7);}
  // 16MHz -> 1MHz : 1000 = 1kHz -> 1ms
  tim7.psc.write(|w| w.psc().bits(16));
  tim7.arr.write(|w| w.arr().bits(1000));
  tim7.egr.write(|w| w.ug().update());
  tim7.cr1.modify(|_, w| w.cen().enabled());
}
pub fn start_time ( ) { let peripheral_ptr ; unsafe { peripheral_ptr = stm32f4 :: stm32f446 :: Peripherals :: steal ( ) ; } let rcc = & peripheral_ptr . RCC ; let tim7 = & peripheral_ptr . TIM7 ; if rcc . apb1enr . read ( ) . tim7en ( ) . is_enabled ( ) { rprintln ! ( " " ) ; return ; } rcc . apb1enr . modify ( | _ , w | w . tim7en ( ) . enabled ( ) ) ; tim7 . cr1 . modify ( | _ , w | w . arpe ( ) . enabled ( ) ) ; tim7 . dier . modify ( | _ , w | w . uie ( ) . enabled ( ) ) ; unsafe { NVIC :: unmask ( Interrupt :: TIM7 ) ; } // 16MHz -> 1MHz : 1000 = 1kHz -> 1ms tim7 . psc . write ( | w | w . psc ( ) . bits ( 16 ) ) ; tim7 . arr . write ( | w | w . arr ( ) . bits ( 1000 ) ) ; tim7 . egr . write ( | w | w . ug ( ) . update ( ) ) ; tim7 . cr1 . modify ( | _ , w | w . cen ( ) . enabled ( ) ) ; }
Starts a timer that will continuously count the time in milliseconds.
Starts a timer that will continuously count the time in milliseconds .
example
```rust,no_run
use rustuino::*.

let mut counter: usize = 0;
let delay: usize = 1000;
start_time().

loop {
if counter + delay >= millis() {
Do something
counter = millis();
}
}
```
` ` ` rust no_run use rustuino :: * . let mut counter : usize = 0 ; let delay : usize = 1000 ; start_time () . loop { if counter + delay > = millis () { Do something counter = millis () ; } } ` ` `