Skip to content

Commit

Permalink
Merge pull request #866 from jannic/port-861-to-rp235x
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic authored Oct 20, 2024
2 parents 1bce4c9 + 343f63f commit 247dce8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rp235x-hal/src/gpio/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ macro_rules! pin_func {
($($fn:ident $(as $alias:ident)?),*) => {
$(paste! {
/// Type-level `variant` for pin [`Function`].
#[derive(Debug)]
pub struct [<Function $fn>](pub(super) ());
impl Function for [<Function $fn>] {}
impl func_sealed::Function for [<Function $fn>] {
Expand All @@ -111,6 +112,7 @@ pin_func!(Xip, Spi, Uart, I2c as I2C, Pwm, Pio0, Pio1, Pio2, Clock, Usb, UartAux
//==============================================================================

/// Type-level `variant` for pin [`Function`].
#[derive(Debug)]
pub struct FunctionSio<C>(PhantomData<C>);
impl<C: SioConfig> Function for FunctionSio<C> {}
impl<C: SioConfig> func_sealed::Function for FunctionSio<C> {
Expand All @@ -133,12 +135,14 @@ pub trait SioConfig {
}

/// Type-level `variant` for SIO configuration.
#[derive(Debug)]
pub enum SioInput {}
impl SioConfig for SioInput {
#[allow(missing_docs)]
const DYN: DynSioConfig = DynSioConfig::Input;
}
/// Type-level `variant` for SIO configuration.
#[derive(Debug)]
pub enum SioOutput {}
impl SioConfig for SioOutput {
#[allow(missing_docs)]
Expand Down
2 changes: 2 additions & 0 deletions rp235x-hal/src/gpio/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ pub enum OutputOverride {

/// Represents a pin, with a given ID (e.g. Gpio3), a given function (e.g. FunctionUart) and a given pull type
/// (e.g. pull-down).
#[derive(Debug)]
pub struct Pin<I: PinId, F: func::Function, P: PullType> {
id: I,
function: F,
Expand Down Expand Up @@ -1115,6 +1116,7 @@ macro_rules! gpio {
(struct: $bank:ident $prefix:ident $($PXi:ident, $id:expr, $func:ident, $pull_type:ident),*) => {
paste::paste!{
/// Collection of all the individual [`Pin`]s
#[derive(Debug)]
pub struct Pins {
_io: [<IO_ $bank:upper>],
_pads: [<PADS_ $bank:upper>],
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 @@ -88,6 +88,7 @@ macro_rules! pin_ids {
paste::paste!{
$(
#[doc = "Type level variant for the pin `" $name "` in bank `" $prefix "`."]
#[derive(Debug)]
pub struct [<$prefix $name>] (pub(crate) ());
impl crate::typelevel::Sealed for [<$prefix $name>] {}
impl PinId for [<$prefix $name>] {
Expand Down
1 change: 1 addition & 0 deletions rp235x-hal/src/gpio/pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ macro_rules! pin_pull_type {
($($pull_type:ident),*) => {
$(paste! {
/// Type-level `variant` of [`PullType`].
#[derive(Debug)]
pub struct [<Pull $pull_type>](pub(super) ());
impl PullType for [<Pull $pull_type>] {}
impl pull_sealed::PullType for [<Pull $pull_type>] {
Expand Down
3 changes: 3 additions & 0 deletions rp235x-hal/src/sio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ pub enum CoreId {
}

/// Marker struct for ownership of SIO gpio bank0
#[derive(Debug)]
pub struct SioGpioBank0 {
_private: (),
}

/// Marker struct for ownership of SIO FIFO
#[derive(Debug)]
pub struct SioFifo {
_private: (),
}

/// Marker struct for ownership of SIO gpio qspi
#[derive(Debug)]
pub struct SioGpioQspi {
_private: (),
}
Expand Down

0 comments on commit 247dce8

Please sign in to comment.