Skip to content

Commit 6a26062

Browse files
authored
Merge pull request #537 from stm32-rs/nopin
SPI NoPin
2 parents e78625e + 0b23107 commit 6a26062

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717
- Use independent `Spi` and `SpiSlave` structures instead of `OP` generic [#462]
1818
- Take `&Clocks` instead of `Clocks` [#498]
1919
- Update to `stm32f1` v0.16.0 [#503] [#534]
20-
- `Spi` now takes `Option<PIN>` for `SCK`, `MISO`, `MOSI` [#514]
20+
- `Spi` now takes `Option<PIN>` for `SCK`, `MISO`, `MOSI` [#514],
21+
add `SPIx::NoSck`, etc. [#537]
2122
- move `Qei` mod inside `pwm_input` mod [#516]
2223

2324
### Changed

src/spi.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
As some STM32F1xx chips have 5V tolerant SPI pins, it is also possible to configure Sck and Mosi outputs as `Alternate<PushPull>`. Then
77
a simple Pull-Up to 5V can be used to use SPI on a 5V bus without a level shifter.
88
9-
You can also use `None::<PA6>` if you don't want to use the pins
9+
You can also use `None::<PA6>` or `SPI1::NoMiso` if you don't want to use the pins
1010
1111
## Alternate function remapping
1212
@@ -133,7 +133,14 @@ pub enum Error {
133133

134134
use core::marker::PhantomData;
135135

136+
#[allow(non_upper_case_globals)]
136137
pub trait SpiExt: Sized + Instance {
138+
const NoSck: Option<Self::MSck> = None;
139+
const NoMiso: Option<Self::Mi<Floating>> = None;
140+
const NoMosi: Option<Self::Mo> = None;
141+
const NoSSck: Option<Self::SSck> = None;
142+
const NoSo: Option<Self::So<PushPull>> = None;
143+
const NoSi: Option<Self::Si<Floating>> = None;
137144
fn spi<PULL: UpMode>(
138145
self,
139146
pins: (

0 commit comments

Comments
 (0)