diff --git a/Cargo.toml b/Cargo.toml index cb5119677829fe63e56fa76e46aef40fd2adc8a1..930bb5fad914929b54594dfbbc5948f6350c359f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tudelft-quadrupel" -version = "2.0.0" +version = "2.0.1" edition = "2021" authors = [ "Anne Stijns <anstijns@gmail.com>", diff --git a/src/initialize.rs b/src/initialize.rs index 429d28d4193b20643772effadcc6dfddc9bbce61..7be9aaead7b3d0c0bc566c3a5b467ad064fa7106 100644 --- a/src/initialize.rs +++ b/src/initialize.rs @@ -97,7 +97,6 @@ pub fn initialize(heap_memory: &'static mut [MaybeUninit<u8>], debug: bool) { &mut cortex_m_peripherals.NVIC, &mut nrf51_peripherals.PPI, &mut nrf51_peripherals.GPIOTE, - gpio.p0_20, ); if debug { let _ = send_bytes(b"MOTOR driver initialized\n"); diff --git a/src/motor.rs b/src/motor.rs index fc1c7dc97772b761aa8ec1ad52b29cf316635f91..2c95bf2bf8cf1fd4def75e88b92b112e8460201b 100644 --- a/src/motor.rs +++ b/src/motor.rs @@ -1,9 +1,6 @@ use crate::mutex::Mutex; -use crate::nrf51_hal::prelude::OutputPin; use crate::once_cell::OnceCell; use cortex_m::peripheral::NVIC; -use nrf51_hal::gpio::p0::P0_20; -use nrf51_hal::gpio::{Disconnected, Level, Output, PushPull}; use nrf51_pac::{interrupt, Interrupt, GPIOTE, PPI}; struct Motors { @@ -11,7 +8,6 @@ struct Motors { motor_max: u16, timer1: nrf51_pac::TIMER1, timer2: nrf51_pac::TIMER2, - pin20: P0_20<Output<PushPull>>, } const MOTOR_0_PIN: u8 = 21; @@ -63,18 +59,13 @@ pub(crate) fn initialize( nvic: &mut NVIC, ppi: &mut PPI, gpiote: &mut GPIOTE, - pin20: P0_20<Disconnected>, ) { - // Configure pin20 - let pin20 = pin20.into_push_pull_output(Level::Low); - MOTORS.modify(|motors| { motors.initialize(Motors { motor_values: [0; 4], motor_max: 400, timer1, timer2, - pin20, }); // Configure GPIOTE. GPIOTE is stands for GPIO tasks and events. @@ -270,11 +261,9 @@ unsafe fn TIMER1() { motors.timer1.tasks_capture[2].write(|w| w.bits(1)); if motors.timer1.cc[2].read().bits() < 500 { - motors.pin20.set_high().unwrap(); // Safety: Any time is allowed motors.timer1.cc[0].write(|w| w.bits(u32::from(1000 + motors.motor_values[0]))); motors.timer1.cc[1].write(|w| w.bits(u32::from(1000 + motors.motor_values[1]))); - motors.pin20.set_low().unwrap(); } } }