2021-07-03 18:15:39 +10:00
|
|
|
#![no_std]
|
|
|
|
|
2021-07-26 20:24:58 +10:00
|
|
|
pub extern crate rp2040_hal as hal;
|
2021-07-03 18:15:39 +10:00
|
|
|
|
|
|
|
#[cfg(feature = "rt")]
|
|
|
|
extern crate cortex_m_rt;
|
|
|
|
#[cfg(feature = "rt")]
|
|
|
|
pub use cortex_m_rt::entry;
|
|
|
|
|
2021-12-27 06:29:14 +11:00
|
|
|
/// 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.
|
2021-12-05 01:00:09 +11:00
|
|
|
#[cfg(feature = "boot2")]
|
|
|
|
#[link_section = ".boot2"]
|
|
|
|
#[no_mangle]
|
|
|
|
#[used]
|
|
|
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
|
|
|
|
2021-07-03 18:15:39 +10:00
|
|
|
pub use hal::pac;
|
|
|
|
|
|
|
|
hal::bsp_pins!(
|
2022-01-09 23:24:00 +11:00
|
|
|
/// GPIO 0 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 RX`
|
|
|
|
/// - `UART0 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SDA`
|
|
|
|
/// - `PWM0 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio0 { name: gpio0 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 1 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 CSn`
|
|
|
|
/// - `UART0 RX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SCL`
|
|
|
|
/// - `PWM0 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio1 { name: gpio1 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 2 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 SCK`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART0 CTS`
|
|
|
|
/// - `I2C1 SDA`
|
|
|
|
/// - `PWM1 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio2 { name: gpio2 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 3 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART0 RTS`
|
|
|
|
/// - `I2C1 SCL`
|
|
|
|
/// - `PWM1 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio3 { name: gpio3 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 4 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 RX`
|
|
|
|
/// - `UART1 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SDA`
|
|
|
|
/// - `PWM2 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio4 { name: gpio4 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 5 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 CSn`
|
|
|
|
/// - `UART1 RX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SCL`
|
|
|
|
/// - `PWM2 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio5 { name: gpio5 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 6 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 SCK`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART1 CTS`
|
|
|
|
/// - `I2C1 SDA`
|
|
|
|
/// - `PWM3 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio6 { name: gpio6 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 7 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART1 RTS`
|
|
|
|
/// - `I2C1 SCL`
|
|
|
|
/// - `PWM3 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio7 { name: gpio7 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 8 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI1 RX`
|
|
|
|
/// - `UART1 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SDA`
|
|
|
|
/// - `PWM4 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio8 { name: gpio8 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 9 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI1 CSn`
|
|
|
|
/// - `UART1 RX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SCL`
|
|
|
|
/// - `PWM4 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio9 { name: gpio9 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 10 supports following functions:
|
|
|
|
/// - `SPI1 SCK`
|
|
|
|
/// - `UART1 CTS`
|
|
|
|
/// - `I2C1 SDA`
|
|
|
|
/// - `PWM5 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio10 { name: gpio10 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 11 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI1 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART1 RTS`
|
|
|
|
/// - `I2C1 SCL`
|
|
|
|
/// - `PWM5 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio11 { name: gpio11 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 12 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI1 RX`
|
|
|
|
/// - `UART0 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SDA`
|
|
|
|
/// - `PWM6 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio12 { name: gpio12 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 13 supports following functions:
|
|
|
|
/// - `SPI1 CSn`
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `UART0 RX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SCL`
|
|
|
|
/// - `PWM6 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio13 { name: gpio13 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 14 supports following functions:
|
|
|
|
/// - `SPI1 SCK`
|
|
|
|
/// - `UART0 CTS`
|
|
|
|
/// - `I2C1 SDA`
|
|
|
|
/// - `PWM7 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio14 { name: gpio14 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 15 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI1 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART0 RTS`
|
|
|
|
/// - `I2C1 SCL`
|
|
|
|
/// - `PWM7 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio15 { name: gpio15 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 16 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 RX`
|
|
|
|
/// - `UART0 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SDA`
|
|
|
|
/// - `PWM0 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio16 { name: gpio16 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 17 supports following functions:
|
|
|
|
/// - `SPI0 CSn`
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `UART0 RX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SCL`
|
|
|
|
/// - `PWM0 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio17 { name: gpio17 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 18 supports following functions:
|
|
|
|
/// - `SPI0 SCK`
|
|
|
|
/// - `UART0 CTS`
|
|
|
|
/// - `I2C1 SDA`
|
|
|
|
/// - `PWM1 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio18 { name: gpio18 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 19 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART0 RTS`
|
|
|
|
/// - `I2C1 SCL`
|
|
|
|
/// - `PWM1 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio19 { name: gpio19 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 20 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI0 RX`
|
|
|
|
/// - `UART1 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SDA`
|
|
|
|
/// - `PWM2 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio20 { name: gpio20 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 21 supports following functions:
|
|
|
|
/// - `SPI0 CSn`
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `UART1 RX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SCL`
|
|
|
|
/// - `PWM2 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio21 { name: gpio21 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 22 supports following functions:
|
|
|
|
/// - `SPI0 SCK`
|
|
|
|
/// - `UART1 CTS`
|
|
|
|
/// - `I2C1 SDA`
|
|
|
|
/// - `PWM3 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio22 { name: gpio22 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 23 is connected to b_power_save of the Raspberry Pi Pico board.
|
2021-11-17 06:15:04 +11:00
|
|
|
Gpio23 { name: b_power_save },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 24 is connected to vbus_detect of the Raspberry Pi Pico board.
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio24 { name: vbus_detect },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 25 is connected to the LED of the Raspberry Pi Pico board.
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio25 { name: led },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 26 supports following functions:
|
|
|
|
/// - `SPI1 SCK`
|
|
|
|
/// - `UART1 CTS`
|
|
|
|
/// - `I2C1 SDA`
|
|
|
|
/// - `PWM5 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio26 { name: gpio26 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 27 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI1 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `UART1 RTS`
|
|
|
|
/// - `I2C1 SCL`
|
|
|
|
/// - `PWM5 B`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio27 { name: gpio27 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 28 supports following functions:
|
2022-01-09 23:31:10 +11:00
|
|
|
/// - `SPI1 RX`
|
|
|
|
/// - `UART0 TX`
|
2022-01-09 23:24:00 +11:00
|
|
|
/// - `I2C0 SDA`
|
|
|
|
/// - `PWM6 A`
|
|
|
|
/// - `SIO`, `PIO0`, `PIO1`
|
2021-07-03 18:15:39 +10:00
|
|
|
Gpio28 { name: gpio28 },
|
2022-01-09 23:24:00 +11:00
|
|
|
|
|
|
|
/// GPIO 29 is connected to voltage_monitor of the Raspberry Pi Pico board.
|
|
|
|
Gpio29 { name: voltage_monitor },
|
2021-07-03 18:15:39 +10:00
|
|
|
);
|
2021-07-26 20:24:58 +10:00
|
|
|
|
|
|
|
pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
|