- let board = Peripherals::take().ok_or("Error getting board!")?;
- let mut timer = Timer::new(board.TIMER0);
- let mut delay = Timer::new(board.TIMER1);
- let mut _rng = Rng::new(board.RNG);
- let _clocks = Clocks::new(board.CLOCK).enable_ext_hfosc();
+ let mut peripherals = Peripherals::take().ok_or("Error getting board!")?;
+ let mut _pins = Pins::new(peripherals.PORT);
+ let _core = CorePeripherals::take().unwrap();
+
+ let mut _rng: Trng = Trng::new(&mut peripherals.MCLK, peripherals.TRNG);
+ let mut _clocks = GenericClockController::with_external_32kosc(
+ peripherals.GCLK,
+ &mut peripherals.MCLK,
+ &mut peripherals.OSC32KCTRL,
+ &mut peripherals.OSCCTRL,
+ &mut peripherals.NVMCTRL,
+ );
+ let mut delay = Delay::new(_core.SYST, &mut _clocks);
+
+ // set pins low to prevent floating values read as data by the pixels
+ let mut front_neopixel_pin = _pins.d11.into_push_pull_output(&mut _pins.port);
+ let mut rear_neopixel_pin = _pins.neopixel.into_push_pull_output(&mut _pins.port);
+ front_neopixel_pin.set_low().unwrap();
+ rear_neopixel_pin.set_high().unwrap();