mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-09 20:11:31 +11:00
Merge pull request #467 from jannic/fix-466
Use InstalledProgram::share() in examples/pio_synchronized.rs
This commit is contained in:
commit
8e79f438ba
|
@ -64,16 +64,16 @@ fn main() -> ! {
|
|||
let (int, frac) = (256, 0);
|
||||
|
||||
let installed = pio.install(&program.program).unwrap();
|
||||
let (mut sm0, _, _) = rp2040_hal::pio::PIOBuilder::from_program(installed)
|
||||
.set_pins(pin0, 1)
|
||||
.clock_divisor_fixed_point(int, frac)
|
||||
.build(sm0);
|
||||
let (mut sm0, _, _) = rp2040_hal::pio::PIOBuilder::from_program(
|
||||
// Safety: We won't uninstall the program, ever
|
||||
unsafe { installed.share() },
|
||||
)
|
||||
.set_pins(pin0, 1)
|
||||
.clock_divisor_fixed_point(int, frac)
|
||||
.build(sm0);
|
||||
// The GPIO pin needs to be configured as an output.
|
||||
sm0.set_pindirs([(pin0, hal::pio::PinDir::Output)]);
|
||||
|
||||
// NOTE: with the current rp-hal, I need to call pio.install() twice. This
|
||||
// should be investigated further as it seems wrong.
|
||||
let installed = pio.install(&program.program).unwrap();
|
||||
let (mut sm1, _, _) = rp2040_hal::pio::PIOBuilder::from_program(installed)
|
||||
.set_pins(pin1, 1)
|
||||
.clock_divisor_fixed_point(int, frac)
|
||||
|
|
Loading…
Reference in a new issue