-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix System Pin Feature Gate #38
Changes from 8 commits
028882a
ebe7736
9db3119
99d2191
bb35b27
878c615
abbb0c0
dc6a27c
b364e40
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,8 @@ | |
### Fixed | ||
|
||
- HAL build when targeting `sams70n19b`. | ||
- The special-on-reset pins `PB4/5/6/7/12` are now completely unavailable, if the `reconfigurable-system-pins` feature is not enabled. | ||
- `Usart<Usart1>` and `Twi<TwiHS1>` are now only available if the `reconfigurable-system-pins` feature is enabled, as they cannot obtain a valid pin configuration without it. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move these under |
||
|
||
## [v0.3.0] 2022-08-26 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ feripheral, by use of the [`Twi`] abstraction. The peripheral | |
supports I²C, which is also the only protocol currently | ||
implemented. | ||
|
||
# System [`Pin`]s | ||
|
||
[`Twi<TwiHS1>`] can only obtain a legal pin configuration with the `reconfigurable-system-pins` feature and is therefore also hidden behind said feature gate. | ||
|
||
# Example usage | ||
|
||
```no_run | ||
|
@@ -41,11 +45,13 @@ twi.write_read(0x0, &[0b1000_0000], &mut buffer).unwrap(); | |
use crate::clocks::{Clock, Hertz, HostClock, PeripheralIdentifier}; | ||
use crate::ehal::blocking; | ||
use crate::generics; | ||
#[cfg(feature = "reconfigurable-system-pins")] | ||
use crate::pac::TWIHS1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this gated? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nevermind. It's because the peripheral requires the system pins. |
||
#[cfg(not(feature = "pins-64"))] | ||
use crate::pac::TWIHS2; | ||
use crate::pac::{ | ||
twihs0::{sr::R as StatusRegister, RegisterBlock}, | ||
TWIHS0, TWIHS1, | ||
TWIHS0, | ||
}; | ||
use crate::pio::*; | ||
|
||
|
@@ -286,6 +292,8 @@ impl_twi!( | |
DATA: Pin<PA3, PeripheralA>, | ||
CLOCK: Pin<PA4, PeripheralA>, | ||
}, | ||
|
||
#[cfg(feature = "reconfigurable-system-pins")] | ||
TwiHS1: { | ||
DATA: Pin<PB4, PeripheralA>, | ||
CLOCK: Pin<PB5, PeripheralA>, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,10 @@ these have yet to be implemented. | |
Mode support depends on what [`Pin`]s that are available for the | ||
[`Usart`]; refer to [`UsartPins`]. | ||
|
||
# System [`Pin`]s | ||
|
||
[`Usart<Usart1>`] can only obtain a legal pin configuration with the `reconfigurable-system-pins` feature and is therefore also hidden behind said feature gate. | ||
|
||
# Example usage | ||
|
||
```no_run | ||
|
@@ -83,15 +87,17 @@ let _ = spi.read().unwrap(); | |
pub use super::uart::{ChannelMode, ParityMode, UartConfiguration}; | ||
use crate::clocks::{Clock, Hertz, HostClock, Pck, Pck4, PeripheralIdentifier}; | ||
use crate::generics::{self, Token}; | ||
#[cfg(feature = "reconfigurable-system-pins")] | ||
use crate::pac::USART1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
#[cfg(not(feature = "pins-64"))] | ||
use crate::pac::USART2; | ||
use crate::pac::{ | ||
usart0::us_mr_usart_mode::CHMODESELECT_A as HwChannelMode, | ||
usart0::us_mr_usart_mode::PARSELECT_A as HwParityMode, | ||
usart0::us_mr_usart_mode::USART_MODESELECT_A as HwUsartMode, | ||
usart0::us_mr_usart_mode::USCLKSSELECT_A as UsartClockSource, usart0::RegisterBlock, USART0, | ||
USART1, | ||
}; | ||
|
||
use crate::pio::*; | ||
use crate::serial::Bps; | ||
|
||
|
@@ -630,6 +636,7 @@ impl_usart!( | |
CTS: [ Pin<PB2,PeripheralC> ], | ||
RTS: [ Pin<PB3,PeripheralC> ], | ||
}, | ||
#[cfg(feature = "reconfigurable-system-pins")] | ||
Usart1: { | ||
SCK: [ | ||
#[cfg(not(feature = "pins-64"))] | ||
|
@@ -676,6 +683,7 @@ cfg_if::cfg_if! { | |
} | ||
} | ||
); | ||
#[cfg(feature = "reconfigurable-system-pins")] | ||
impl_pins!( | ||
Usart1: { | ||
(/* TX */ Pin<PB4, PeripheralD>, /* RX */ Pin<PA21, PeripheralA>, /* SCK */ Pin<PA23, PeripheralA>): { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the features hard coded like this isn't pretty, but I have no idea how to parse the actual list of features and not catch the internal-only features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is probably a better way to check different feature permutations (and maybe streamline the CI further), but we can delay that until we have more feature gates. Ideally they will be de-coupled, so we could just check with
--all-features
, but I don't know if we can separate the PACs from this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There a cargo extensions crate called cargo-hack that can do feature permutations.
Raised #42 about this.