Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for XipCS1 pin function. #873

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rp235x-hal/src/gpio/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub enum DynFunction {
/// The 'Clock' function. This can be used to input or output clock references to or from the
/// rp235x.
Clock,
/// The XIP CS1 function.
XipCs1,
thejpster marked this conversation as resolved.
Show resolved Hide resolved
/// The 'USB' function. Only VBUS detect, VBUS enable and overcurrent detect are configurable.
/// Other USB io have dedicated pins.
Usb,
Expand Down Expand Up @@ -105,7 +107,7 @@ macro_rules! pin_func {
})*
};
}
pin_func!(Xip, Spi, Uart, I2c as I2C, Pwm, Pio0, Pio1, Pio2, Clock, Usb, UartAux, Null);
pin_func!(Xip, Spi, Uart, I2c as I2C, Pwm, Pio0, Pio1, Pio2, Clock, XipCs1, Usb, UartAux, Null);

//==============================================================================
// SIO sub-types
Expand Down Expand Up @@ -169,6 +171,7 @@ impl DynFunction {
let dyn_pin = id.as_dyn();
match (self, dyn_pin.bank, dyn_pin.num) {
(Xip, Bank0, _) => false,
(XipCs1, Bank0, 0 | 8 | 19 | 47) => true,
(Clock, _, 0..=19 | 26..=29) => false,
(UartAux, _, n) if (n & 0x02) == 0 => false,
(_, Bank0, 0..=29) => true,
Expand Down Expand Up @@ -205,6 +208,7 @@ pin_valid_func!(
[2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27]
);
pin_valid_func!(bank0 as Gpio, [Clock], [20, 21, 22, 23, 24, 25]);
pin_valid_func!(bank0 as Gpio, [XipCs1], [0, 8, 19, 47]);
pin_valid_func!(qspi as Qspi, [Xip, Null], [Sclk, Sd0, Sd1, Sd2, Sd3, Ss]);

macro_rules! pin_valid_func_sio {
Expand Down
1 change: 1 addition & 0 deletions rp235x-hal/src/gpio/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ pub(crate) fn set_function<P: PinId>(pin: &P, function: DynFunction) {
DynFunction::Pio1 => FUNCSEL_A::PIO1,
DynFunction::Pio2 => FUNCSEL_A::PIO2,
DynFunction::Clock => FUNCSEL_A::GPCK,
DynFunction::XipCs1 => FUNCSEL_A::GPCK,
thejpster marked this conversation as resolved.
Show resolved Hide resolved
DynFunction::Usb => FUNCSEL_A::USB,
DynFunction::UartAux => FUNCSEL_A::UART_AUX,
DynFunction::Null => FUNCSEL_A::NULL,
Expand Down