Crates.io | variegated-board-cfg |
lib.rs | variegated-board-cfg |
version | 0.1.2 |
source | src |
created_at | 2024-10-08 20:37:25.275184 |
updated_at | 2024-10-08 20:40:40.35313 |
description | Store pin and other HAL configurations for your embedded project in a TOML file. |
homepage | |
repository | https://github.com/variegated-coffee/variegated-board-cfg |
max_upload_size | |
id | 1401662 |
size | 11,239 |
Substantial credits go to James Munns for the toml-cfg crate, Adam Greig for the assign-resources crate, and Adin Ackerman for the procedural overhaul PR for assign-resources.
#[variegated_board_cfg::config_section("hid_bus")]
struct HidBus {
tx_pin: (),
rx_pin: impl embassy_rp::peripherals::Pin, // Forces a compile error if the type of rx_pin doesn't implement Pin
uart: (),
baud_rate: u32,
}
[hid_bus]
tx_pin = "embassy_rp::peripherals::PIN_0"
rx_pin = "embassy_rp::peripherals::PIN_1"
uart = "embassy_rp::peripherals::UART0"
baud_rate = 115200
type HidBusTxPin = embassy_rp::peripherals::PIN_0;
type HidBusRxPin = embassy_rp::peripherals::PIN_1;
type HidBusUart = embassy_rp::peripherals::UART0;
struct HidBus {
tx_pin: HidBusTxPin,
rx_pin: HidBusRxPin,
uart: HidBusUart,
baud_rate: u32,
}
impl HidBus where HidBusRxPin: embassy_rp::peripherals::Pin {
}
macro_rules! hid_bus {
($P : ident) => {
HidBus {
tx_pin: $P.PIN_0,
rx_pin: $P.PIN_1,
uart: $P.UART0,
baud_rate: 115200
}
};
}