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

Support Non-zero Chip Selects for lpspi4 #34

Merged
merged 2 commits into from
Mar 16, 2023
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ target/
Cargo.lock
.vscode/
*.hex
.DS_Store
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- **BREAKING** Add support for additional chip select pins for `lpspi4`.
ameliamariecollins marked this conversation as resolved.
Show resolved Hide resolved

- **BREAKING** Remove the deprecated pull / keeper configuration API.

- **BREAKING** Change the type of the `lpspi::Pins::DAISY` associated constant
Expand Down
5 changes: 4 additions & 1 deletion src/imxrt1060/lpspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::pads::{
};
use crate::{
consts::*,
lpspi::{Pcs0, Pin, Sck, Sdi, Sdo},
lpspi::{Pcs0, Pcs1, Pcs2, Pcs3, Pin, Sck, Sdi, Sdo},
Daisy,
};

Expand Down Expand Up @@ -56,6 +56,9 @@ spi!(module: U4, alt: 1, pad: GPIO_B1_05, signal: Sdi, daisy: Some(DAISY_LPSPI4
spi!(module: U4, alt: 3, pad: GPIO_B0_01, signal: Sdi, daisy: Some(DAISY_LPSPI4_SDI_GPIO_B0_01));
spi!(module: U4, alt: 1, pad: GPIO_B1_04, signal: Pcs0, daisy: Some(DAISY_LPSPI4_PCS0_GPIO_B1_04));
spi!(module: U4, alt: 3, pad: GPIO_B0_00, signal: Pcs0, daisy: Some(DAISY_LPSPI4_PCS0_GPIO_B0_00));
spi!(module: U4, alt: 2, pad: GPIO_B1_03, signal: Pcs1, daisy: None);
spi!(module: U4, alt: 2, pad: GPIO_B1_02, signal: Pcs2, daisy: None);
spi!(module: U4, alt: 6, pad: GPIO_B1_11, signal: Pcs3, daisy: None);

/// Auto-generated DAISY values
mod daisy {
Expand Down
14 changes: 13 additions & 1 deletion src/lpspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,32 @@ pub enum Sck {}
pub enum Sdo {}
/// A tag that indicates a SPI data in pad
pub enum Sdi {}
/// A tag that indicates a SPI chip select pad
/// A tag that indicates the Pcs0 chip select pad
pub enum Pcs0 {}
/// A tag that indicates the Pcs1 chip select pad
pub enum Pcs1 {}
/// A tag that indicates the Pcs2 chip select pad
pub enum Pcs2 {}
/// A tag that indicates the Pcs3 chip select pad
pub enum Pcs3 {}

impl Signal for Sck {}
impl Signal for Sdo {}
impl Signal for Sdi {}
impl Signal for Pcs0 {}
impl Signal for Pcs1 {}
impl Signal for Pcs2 {}
impl Signal for Pcs3 {}

mod private {
pub trait Sealed {}
impl Sealed for super::Sck {}
impl Sealed for super::Sdo {}
impl Sealed for super::Sdi {}
impl Sealed for super::Pcs0 {}
impl Sealed for super::Pcs1 {}
impl Sealed for super::Pcs2 {}
impl Sealed for super::Pcs3 {}
}

/// A SPI pin
Expand Down