-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19: timers, bugfix: fix periodic CountDown timer r=richardeoin a=richardeoin Previously the `CountDown` timer failed to start a new countdown if the periodic timer was running and no `wait()` call was made in the previous period. This was as the UIF bit was already set. See embedded-hal docs for the contract: https://docs.rs/embedded-hal/0.2.3/embedded_hal/timer/trait.CountDown.html#tymethod.start Add example to demonstrate correct behaviour. 26: rcc: add options to configure more PLL outputs r=richardeoin a=richardeoin * All 3 outputs of PLL1 can be configured. * Moving closer to a generic interface for PLL2/PLL3; just needs macro definitions and call to setup. * An `assert` will occour if pll1_p_ck is set independently when it is requried for sys_ck. * When `pll1_r_ck` is `None` in the configuration struct, it is set if required to keep `traceclk` running. Afaict there's no documentation on acceptable frequencies for `traceclk`, set p_ck/2 as a sensible choice (can be overridden by setting some `pll1_r_ck`). 27: Init traits prelude r=richardeoin a=richardeoin adc: Add initialisation trait Simplifies usage: ```rust let _ = adc::Adc::adc3(dp.ADC3, &mut delay, &mut ccdr); ``` to ```rust let _ = dp.ADC3.adc(&mut delay, &mut ccdr); ``` Previous method still works. Re-work arguments for timer, doesn't break anything as there aren't any examples yet. Closes #20 28: Porting i2c to the extension trait pattern r=richardeoin a=hargoniX See #27 31: dependencies: use stm32h7 PAC 0.8 r=richardeoin a=jordens * remove and warnings notes on using the local build of stm32h7 * bump cortex-m-rt to 0.6.10 (.ARM.exidx section) * mention that this works with beta close: #5 Co-authored-by: Richard Meadows <[email protected]> Co-authored-by: Henrik Böving <[email protected]> Co-authored-by: Robert Jördens <[email protected]>
- Loading branch information
Showing
13 changed files
with
469 additions
and
164 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#![deny(warnings)] | ||
#![deny(unsafe_code)] | ||
#![no_main] | ||
#![no_std] | ||
|
||
extern crate panic_itm; | ||
|
||
#[macro_use(block)] | ||
extern crate nb; | ||
|
||
use cortex_m; | ||
use cortex_m_rt::entry; | ||
use stm32h7xx_hal::hal::digital::v2::{OutputPin, ToggleableOutputPin}; | ||
use stm32h7xx_hal::{pac, prelude::*}; | ||
|
||
use cortex_m_log::println; | ||
use cortex_m_log::{ | ||
destination::Itm, printer::itm::InterruptSync as InterruptSyncItm, | ||
}; | ||
|
||
#[entry] | ||
fn main() -> ! { | ||
let cp = cortex_m::Peripherals::take().unwrap(); | ||
let dp = pac::Peripherals::take().unwrap(); | ||
let mut log = InterruptSyncItm::new(Itm::new(cp.ITM)); | ||
|
||
// Constrain and Freeze power | ||
println!(log, "Setup PWR... "); | ||
let pwr = dp.PWR.constrain(); | ||
let vos = pwr.freeze(); | ||
|
||
// Constrain and Freeze clock | ||
println!(log, "Setup RCC... "); | ||
let rcc = dp.RCC.constrain(); | ||
let mut ccdr = rcc.freeze(vos, &dp.SYSCFG); | ||
|
||
println!(log, ""); | ||
println!(log, "stm32h7xx-hal example - Blinky timer"); | ||
println!(log, ""); | ||
|
||
let gpioe = dp.GPIOE.split(&mut ccdr.ahb4); | ||
|
||
// Configure PE1 as output. | ||
let mut led = gpioe.pe1.into_push_pull_output(); | ||
led.set_low().unwrap(); | ||
|
||
// Get the delay provider. | ||
let mut delay = cp.SYST.delay(ccdr.clocks); | ||
|
||
// Configure the timer. | ||
let mut timer = dp.TIM2.timer(1.hz(), &mut ccdr); | ||
|
||
loop { | ||
for _ in 0..5 { | ||
// 20ms wait with timer | ||
led.toggle().unwrap(); | ||
timer.start(20.ms()); | ||
block!(timer.wait()).ok(); | ||
|
||
// Delay for 500ms. Timer must operate correctly on next | ||
// use. | ||
led.toggle().unwrap(); | ||
delay.delay_ms(500_u16); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.