Expand description
A Hardware Abstraction Layer for the Raspberry Pi Pico.
This crate serves as a HAL (Hardware Abstraction Layer) for the Raspberry Pi Pico. Since the Raspberry Pi Pico is based on the RP2040 chip, it re-exports the rp2040_hal crate which contains the tooling to work with the rp2040 chip.
§Examples:
The following example turns on the onboard LED. Note that most of the logic works through the rp2040_hal crate.
ⓘ
#![no_main]
use rp_pico::entry;
use panic_halt as _;
use embedded_hal::digital::v2::OutputPin;
use rp_pico::hal::pac;
use rp_pico::hal;
#[entry]
fn does_not_have_to_be_main() -> ! {
let mut pac = pac::Peripherals::take().unwrap();
let sio = hal::Sio::new(pac.SIO);
let pins = rp_pico::Pins::new(
pac.IO_BANK0,
pac.PADS_BANK0,
sio.gpio_bank0,
&mut pac.RESETS,
);
let mut led_pin = pins.led.into_push_pull_output();
led_pin.set_high().unwrap();
loop {
}
}
Re-exports§
pub extern crate rp2040_hal as hal;
pub use hal::pac;
Structs§
- BSP replacement for the HAL
Pins
type
Constants§
Statics§
- The linker will place this boot block at the start of our program image. We need this to help the ROM bootloader get our code up and running.
Type Aliases§
- I2C Function alias for pin crate::Pins::gpio0. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio0. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio0. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio0. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio0. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio0. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio1. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio1. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio1. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio1. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio1. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio1. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio2. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio2. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio2. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio2. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio2. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio2. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio3. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio3. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio3. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio3. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio3. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio3. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio4. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio4. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio4. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio4. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio4. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio4. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio5. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio5. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio5. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio5. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio5. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio5. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio6. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio6. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio6. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio6. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio6. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio6. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio7. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio7. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio7. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio7. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio7. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio7. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio8. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio8. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio8. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio8. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio8. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio8. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio9. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio9. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio9. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio9. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio9. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio9. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio10. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio10. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio10. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio10. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio10. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio10. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio11. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio11. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio11. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio11. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio11. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio11. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio12. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio12. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio12. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio12. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio12. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio12. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio13. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio13. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio13. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio13. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio13. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio13. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio14. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio14. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio14. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio14. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio14. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio14. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio15. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio15. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio15. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio15. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio15. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio15. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio16. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio16. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio16. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio16. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio16. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio16. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio17. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio17. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio17. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio17. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio17. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio17. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio18. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio18. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio18. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio18. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio18. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio18. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio19. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio19. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio19. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio19. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio19. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio19. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio20. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio20. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio20. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio20. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio20. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio20. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio21. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio21. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio21. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio21. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio21. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio21. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio22. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio22. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio22. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio22. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio22. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio22. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio26. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio26. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio26. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio26. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio26. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio26. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio27. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio27. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio27. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio27. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio27. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio27. Alias for a configured
Pin
- I2C Function alias for pin crate::Pins::gpio28. Alias for a configured
Pin
- PIO0 Function alias for pin crate::Pins::gpio28. Alias for a configured
Pin
- PIO1 Function alias for pin crate::Pins::gpio28. Alias for a configured
Pin
- PWM Function alias for pin crate::Pins::gpio28. Alias for a configured
Pin
- SPI Function alias for pin crate::Pins::gpio28. Alias for a configured
Pin
- UART Function alias for pin crate::Pins::gpio28. Alias for a configured
Pin
Attribute Macros§
- The
entry
macro declares the starting function to the linker. This is similar to themain
function in console applications.