This commit is contained in:
parent
5a6227e764
commit
480f9c38ed
@ -15,7 +15,7 @@ embedded-hal-nb = "1"
|
|||||||
embedded-io = "0.6"
|
embedded-io = "0.6"
|
||||||
|
|
||||||
[dependencies.va108xx-hal]
|
[dependencies.va108xx-hal]
|
||||||
version = "0.6"
|
version = "0.7"
|
||||||
path = "../va108xx-hal"
|
path = "../va108xx-hal"
|
||||||
features = ["rt"]
|
features = ["rt"]
|
||||||
|
|
||||||
|
@ -28,6 +28,6 @@ version = "1"
|
|||||||
features = ["cortex-m-systick"]
|
features = ["cortex-m-systick"]
|
||||||
|
|
||||||
[dependencies.va108xx-hal]
|
[dependencies.va108xx-hal]
|
||||||
version = "0.6"
|
version = "0.7"
|
||||||
path = "../../va108xx-hal"
|
path = "../../va108xx-hal"
|
||||||
features = ["rt", "defmt"]
|
features = ["rt", "defmt"]
|
@ -21,9 +21,9 @@ fn main() -> ! {
|
|||||||
let mut dp = pac::Peripherals::take().unwrap();
|
let mut dp = pac::Peripherals::take().unwrap();
|
||||||
let pinsa = PinsA::new(&mut dp.sysconfig, None, dp.porta);
|
let pinsa = PinsA::new(&mut dp.sysconfig, None, dp.porta);
|
||||||
let mut pwm = pwm::PwmPin::new(
|
let mut pwm = pwm::PwmPin::new(
|
||||||
(pinsa.pa3.into_funsel_1(), dp.tim3),
|
|
||||||
50.MHz(),
|
|
||||||
&mut dp.sysconfig,
|
&mut dp.sysconfig,
|
||||||
|
50.MHz(),
|
||||||
|
(pinsa.pa3.into_funsel_1(), dp.tim3),
|
||||||
10.Hz(),
|
10.Hz(),
|
||||||
);
|
);
|
||||||
let mut delay = set_up_ms_delay_provider(&mut dp.sysconfig, 50.MHz(), dp.tim0);
|
let mut delay = set_up_ms_delay_provider(&mut dp.sysconfig, 50.MHz(), dp.tim0);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "va108xx-hal"
|
name = "va108xx-hal"
|
||||||
version = "0.6.0"
|
version = "0.7.0"
|
||||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "HAL for the Vorago VA108xx family of microcontrollers"
|
description = "HAL for the Vorago VA108xx family of microcontrollers"
|
||||||
|
@ -158,9 +158,9 @@ where
|
|||||||
{
|
{
|
||||||
/// Create a new stronlgy typed PWM pin
|
/// Create a new stronlgy typed PWM pin
|
||||||
pub fn new(
|
pub fn new(
|
||||||
vtp: (Pin, Tim),
|
|
||||||
sys_clk: impl Into<Hertz> + Copy,
|
|
||||||
sys_cfg: &mut pac::Sysconfig,
|
sys_cfg: &mut pac::Sysconfig,
|
||||||
|
sys_clk: impl Into<Hertz> + Copy,
|
||||||
|
tim_and_pin: (Pin, Tim),
|
||||||
initial_period: impl Into<Hertz> + Copy,
|
initial_period: impl Into<Hertz> + Copy,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut pin = PwmPin {
|
let mut pin = PwmPin {
|
||||||
@ -171,7 +171,7 @@ where
|
|||||||
current_rst_val: 0,
|
current_rst_val: 0,
|
||||||
sys_clk: sys_clk.into(),
|
sys_clk: sys_clk.into(),
|
||||||
},
|
},
|
||||||
reg: unsafe { TimAndPinRegister::new(vtp.0, vtp.1) },
|
reg: unsafe { TimAndPinRegister::new(tim_and_pin.0, tim_and_pin.1) },
|
||||||
mode: PhantomData,
|
mode: PhantomData,
|
||||||
};
|
};
|
||||||
enable_peripheral_clock(sys_cfg, crate::clock::PeripheralClocks::Gpio);
|
enable_peripheral_clock(sys_cfg, crate::clock::PeripheralClocks::Gpio);
|
||||||
@ -225,12 +225,13 @@ where
|
|||||||
(Pin, Tim): ValidTimAndPin<Pin, Tim>,
|
(Pin, Tim): ValidTimAndPin<Pin, Tim>,
|
||||||
{
|
{
|
||||||
pub fn pwma(
|
pub fn pwma(
|
||||||
vtp: (Pin, Tim),
|
|
||||||
sys_clk: impl Into<Hertz> + Copy,
|
|
||||||
sys_cfg: &mut pac::Sysconfig,
|
sys_cfg: &mut pac::Sysconfig,
|
||||||
|
sys_clk: impl Into<Hertz> + Copy,
|
||||||
|
pin_and_tim: (Pin, Tim),
|
||||||
initial_period: impl Into<Hertz> + Copy,
|
initial_period: impl Into<Hertz> + Copy,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut pin: PwmPin<Pin, Tim, PwmA> = Self::new(vtp, sys_clk, sys_cfg, initial_period);
|
let mut pin: PwmPin<Pin, Tim, PwmA> =
|
||||||
|
Self::new(sys_cfg, sys_clk, pin_and_tim, initial_period);
|
||||||
pin.enable_pwm_a();
|
pin.enable_pwm_a();
|
||||||
pin
|
pin
|
||||||
}
|
}
|
||||||
@ -241,12 +242,13 @@ where
|
|||||||
(Pin, Tim): ValidTimAndPin<Pin, Tim>,
|
(Pin, Tim): ValidTimAndPin<Pin, Tim>,
|
||||||
{
|
{
|
||||||
pub fn pwmb(
|
pub fn pwmb(
|
||||||
vtp: (Pin, Tim),
|
|
||||||
sys_clk: impl Into<Hertz> + Copy,
|
|
||||||
sys_cfg: &mut pac::Sysconfig,
|
sys_cfg: &mut pac::Sysconfig,
|
||||||
|
sys_clk: impl Into<Hertz> + Copy,
|
||||||
|
pin_and_tim: (Pin, Tim),
|
||||||
initial_period: impl Into<Hertz> + Copy,
|
initial_period: impl Into<Hertz> + Copy,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut pin: PwmPin<Pin, Tim, PwmB> = Self::new(vtp, sys_clk, sys_cfg, initial_period);
|
let mut pin: PwmPin<Pin, Tim, PwmB> =
|
||||||
|
Self::new(sys_cfg, sys_clk, pin_and_tim, initial_period);
|
||||||
pin.enable_pwm_b();
|
pin.enable_pwm_b();
|
||||||
pin
|
pin
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ version = "0.3"
|
|||||||
|
|
||||||
[dependencies.va108xx-hal]
|
[dependencies.va108xx-hal]
|
||||||
path = "../va108xx-hal"
|
path = "../va108xx-hal"
|
||||||
version = "0.6"
|
version = "0.7"
|
||||||
features = ["rt"]
|
features = ["rt"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
Loading…
Reference in New Issue
Block a user