pimoroni_plasma_2040/lib.rs
1#![no_std]
2
3pub extern crate rp2040_hal as hal;
4
5#[cfg(feature = "rt")]
6pub use rp2040_hal::entry;
7
8/// The linker will place this boot block at the start of our program image. We
9/// need this to help the ROM bootloader get our code up and running.
10#[cfg(feature = "boot2")]
11#[link_section = ".boot2"]
12#[no_mangle]
13#[used]
14pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
15
16pub use hal::pac;
17
18hal::bsp_pins!(
19 /// GPIO 0 is connected to I2C0_SDA
20 Gpio0 { name: i2c0_sda },
21 /// GPIO 1 is connected to I2C0_SCL
22 Gpio1 { name: i2c0_scl },
23 /// GPIO 2 is connected to I2C1_SDA
24 Gpio2 { name: i2c1_sda },
25 /// GPIO 3 is connected to I2C1_SCL
26 Gpio3 { name: i2c1_scl },
27 Gpio4 { name: gpio4 },
28 Gpio5 { name: gpio5 },
29 /// GPIO 12 is connected to button A, active low
30 Gpio12 { name: button_a },
31 /// GPIO 13 is connected to button B, active low
32 Gpio13 { name: button_b },
33 /// GPIO 14 is connected to CLK for APA102 only
34 Gpio14 { name: clk },
35 /// GPIO 15 is connected to DAT for Apa102 and Ws2812
36 Gpio15 { name: data },
37 /// GPIO 16 is red LED, active low
38 Gpio16 { name: led_red },
39 /// GPIO 17 is green LED, active low
40 Gpio17 { name: led_green },
41 /// GPIO 18 is blue LED, active low
42 Gpio18 { name: led_blue },
43 /// GPIO 19 is I2C_INT
44 Gpio19 { name: i2c_int },
45 /// GPIO 20 is I2C_SDA
46 Gpio20 {
47 name: i2c_sda,
48 aliases: { FunctionI2C, PullUp: Sda }
49 },
50 /// GPIO 21 is I2C_SCL
51 Gpio21 {
52 name: i2c_scl,
53 aliases: { FunctionI2C, PullUp: Scl }
54 },
55 /// GPIO 23 is connected to the USER_SW, the BOOT button, active low
56 Gpio23 { name: user_sw },
57 /// GPIO 26 is connected to ADC0
58 Gpio26 { name: adc0 },
59 /// GPIO 27 is connected to ADC1
60 Gpio27 { name: adc1 },
61 /// GPIO 28 is connected to ADC2
62 Gpio28 { name: adc2 },
63 /// GPIO 29 is connected to ADC3 which is used for low side current sensing
64 Gpio29 {
65 name: current_sense,
66 },
67);
68
69pub const XOSC_CRYSTAL_FREQ: u32 = 12_000_000;
70
71pub const ADC_GAIN: u32 = 50;
72pub const SHUNT_RESISTOR: f32 = 0.015;