mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-10 04:21:32 +11:00
Use InstalledProgram::share() in examples/pio_synchronized.rs
This commit is contained in:
parent
39190c357f
commit
e9923cbcd2
|
@ -64,16 +64,16 @@ fn main() -> ! {
|
||||||
let (int, frac) = (256, 0);
|
let (int, frac) = (256, 0);
|
||||||
|
|
||||||
let installed = pio.install(&program.program).unwrap();
|
let installed = pio.install(&program.program).unwrap();
|
||||||
let (mut sm0, _, _) = rp2040_hal::pio::PIOBuilder::from_program(installed)
|
let (mut sm0, _, _) = rp2040_hal::pio::PIOBuilder::from_program(
|
||||||
.set_pins(pin0, 1)
|
// Safety: We won't uninstall the program, ever
|
||||||
.clock_divisor_fixed_point(int, frac)
|
unsafe { installed.share() },
|
||||||
.build(sm0);
|
)
|
||||||
|
.set_pins(pin0, 1)
|
||||||
|
.clock_divisor_fixed_point(int, frac)
|
||||||
|
.build(sm0);
|
||||||
// The GPIO pin needs to be configured as an output.
|
// The GPIO pin needs to be configured as an output.
|
||||||
sm0.set_pindirs([(pin0, hal::pio::PinDir::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)
|
let (mut sm1, _, _) = rp2040_hal::pio::PIOBuilder::from_program(installed)
|
||||||
.set_pins(pin1, 1)
|
.set_pins(pin1, 1)
|
||||||
.clock_divisor_fixed_point(int, frac)
|
.clock_divisor_fixed_point(int, frac)
|
||||||
|
|
Loading…
Reference in a new issue