Skip to content

SPI NoPin #537

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

Merged
merged 1 commit into from
Jun 9, 2025
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Use independent `Spi` and `SpiSlave` structures instead of `OP` generic [#462]
- Take `&Clocks` instead of `Clocks` [#498]
- Update to `stm32f1` v0.16.0 [#503] [#534]
- `Spi` now takes `Option<PIN>` for `SCK`, `MISO`, `MOSI` [#514]
- `Spi` now takes `Option<PIN>` for `SCK`, `MISO`, `MOSI` [#514],
add `SPIx::NoSck`, etc. [#537]
- move `Qei` mod inside `pwm_input` mod [#516]

### Changed
Expand Down
9 changes: 8 additions & 1 deletion src/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
As some STM32F1xx chips have 5V tolerant SPI pins, it is also possible to configure Sck and Mosi outputs as `Alternate<PushPull>`. Then
a simple Pull-Up to 5V can be used to use SPI on a 5V bus without a level shifter.

You can also use `None::<PA6>` if you don't want to use the pins
You can also use `None::<PA6>` or `SPI1::NoMiso` if you don't want to use the pins

## Alternate function remapping

Expand Down Expand Up @@ -133,7 +133,14 @@ pub enum Error {

use core::marker::PhantomData;

#[allow(non_upper_case_globals)]
pub trait SpiExt: Sized + Instance {
const NoSck: Option<Self::MSck> = None;
const NoMiso: Option<Self::Mi<Floating>> = None;
const NoMosi: Option<Self::Mo> = None;
const NoSSck: Option<Self::SSck> = None;
const NoSo: Option<Self::So<PushPull>> = None;
const NoSi: Option<Self::Si<Floating>> = None;
fn spi<PULL: UpMode>(
self,
pins: (
Expand Down
Loading