diff --git a/src/device/boot.rs b/src/device/boot.rs
index 193a6d1..4f8dbd6 100644
--- a/src/device/boot.rs
+++ b/src/device/boot.rs
@@ -2,11 +2,13 @@ use stm32f4xx_hal::{
watchdog::IndependentWatchdog,
rcc::RccExt,
pac::{CorePeripherals, Peripherals},
- time::MegaHertz, prelude::_stm32f4xx_hal_gpio_GpioExt,
+ time::MegaHertz
};
use fugit::ExtU32;
use log::info;
use super::{log_setup, sys_timer, usb};
+use super::gpio;
+use crate::laser_diode::current_sources;
#[cfg(not(feature = "semihosting"))]
const WATCHDOG_PERIOD: u32 = 1000;
@@ -33,13 +35,15 @@ pub fn bootup (mut core_perif : CorePeripherals, perif : Peripherals) -> (
.pclk2(MegaHertz::from_raw(64).convert())
.freeze();
- // let (pins, eth_pins, usb) = Pins::setup(
- // clocks, perif.TIM4,
- // perif.GPIOA, perif.GPIOB, perif.GPIOC, perif.GPIOD, perif.GPIOE, perif.GPIOF, perif.GPIOG,
- // perif.SPI1, perif.SPI2, perif.SPI3,
- // perif.ADC1,
- // perif.OTG_FS_GLOBAL, perif.OTG_FS_DEVICE, perif.OTG_FS_PWRCLK,
- // );
+ let (eth_pins,
+ usb,
+ current_source) = gpio::setup(
+ clocks, perif.TIM4,
+ perif.GPIOA, perif.GPIOB, perif.GPIOC, perif.GPIOD, perif.GPIOE, perif.GPIOF, perif.GPIOG,
+ perif.SPI1, perif.SPI2, perif.SPI3,
+ perif.ADC1,
+ perif.OTG_FS_GLOBAL, perif.OTG_FS_DEVICE, perif.OTG_FS_PWRCLK,
+ );
let mut wd = IndependentWatchdog::new(perif.IWDG);
wd.start(WATCHDOG_PERIOD.millis());
@@ -47,6 +51,8 @@ pub fn bootup (mut core_perif : CorePeripherals, perif : Peripherals) -> (
sys_timer::setup(core_perif.SYST, clocks);
+ info!("Kirdy setup complete");
+
(wd)
}
\ No newline at end of file
diff --git a/src/device/gpio.rs b/src/device/gpio.rs
index b9b1a19..e1d36d8 100644
--- a/src/device/gpio.rs
+++ b/src/device/gpio.rs
@@ -1,10 +1,11 @@
use stm32f4xx_hal::{
adc::Adc,
gpio::{
- AF5, Alternate, AlternateOD, Analog, Floating, Input,
+ AF5, Alternate, Analog, Input,
gpioa::*,
gpiob::*,
gpioc::*,
+ gpiod::*,
gpioe::*,
gpiof::*,
gpiog::*,
@@ -14,7 +15,7 @@ use stm32f4xx_hal::{
hal::{self, blocking::spi::Transfer, digital::v2::OutputPin},
otg_fs::USB,
rcc::Clocks,
- pwm::{self, PwmChannels},
+ spi,
spi::{Spi, NoMiso, TransferModeNormal},
pac::{
ADC1,
@@ -25,63 +26,87 @@ use stm32f4xx_hal::{
},
timer::Timer,
time::U32Ext,
+ time::MegaHertz
};
-
+use fugit::RateExtU32;
use stm32_eth::EthPins;
+use crate::laser_diode::current_sources::*;
+
pub type EthernetPins = EthPins<
- PA1>,
- PA7>,
- PB11>,
- PG13>,
- PB13>,
- PC4>,
- PC5>,
+ PA1,
+ PA7,
+ PB11,
+ PG13,
+ PB13,
+ PC4,
+ PC5,
>;
-impl thermostatPins for thermostat {
- type DacSpi = Dac0Spi;
- type DacSync = PE4