Hi, I am very new to Rust and am starting with the rp-pico crate for the RP2040 board.
I have 3 pwm signals working but I want to generate an interrupt on the pwm wrap interrupt, so far I have:
// Interrupt handling
use rp_pico::hal::pac::interrupt;
In main I have:
unsafe {
pac::NVIC::unmask(hal::pac::Interrupt::PWM_IRQ_WRAP);
};
.. and my interrupt handler is:
#[interrupt]
fn PWM_IRQ_WRAP() {
gpio15.set_high();
}
That obviously gives me an error on the gpio15.set_high();, as I have no mutex on it. Can someone show me how I can "borrow" that gpio so I can use it in the interrupt routine?
my GPIO's were set up like this:
// The single-cycle I/O block controls our GPIO pins
let sio = hal::Sio::new(pac.SIO);
// Set the pins up according to their function on this particular board
let pins = rp_pico::Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
pins
represents all the RP2040 pins (How do I "borrow" pins.gpio15
for use in the interrupt routine, I guess is what I am asking.)