Skip to content

Commit 63dc712

Browse files
committed
u8 as default SPI Word
1 parent 4f3ada1 commit 63dc712

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Use `u8` as default SPI Word type
13+
1014
### Added
1115
- Added `Can` Controller Area Network traits.
1216
- `Error` traits for SPI, I2C and Serial traits. The error types used in those must

src/spi/blocking.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! Implementing that marker trait will opt in your type into a blanket implementation.
66
77
/// Blocking transfer
8-
pub trait Transfer<W> {
8+
pub trait Transfer<W = u8> {
99
/// Error type
1010
type Error: crate::spi::Error;
1111

@@ -24,7 +24,7 @@ impl<T: Transfer<W>, W> Transfer<W> for &mut T {
2424
}
2525

2626
/// Blocking write
27-
pub trait Write<W> {
27+
pub trait Write<W = u8> {
2828
/// Error type
2929
type Error: crate::spi::Error;
3030

@@ -41,7 +41,7 @@ impl<T: Write<W>, W> Write<W> for &mut T {
4141
}
4242

4343
/// Blocking write (iterator version)
44-
pub trait WriteIter<W> {
44+
pub trait WriteIter<W = u8> {
4545
/// Error type
4646
type Error: crate::spi::Error;
4747

@@ -66,7 +66,7 @@ impl<T: WriteIter<W>, W> WriteIter<W> for &mut T {
6666
///
6767
/// This allows composition of SPI operations into a single bus transaction
6868
#[derive(Debug, PartialEq)]
69-
pub enum Operation<'a, W: 'static> {
69+
pub enum Operation<'a, W: 'static = u8> {
7070
/// Write data from the provided buffer, discarding read data
7171
Write(&'a [W]),
7272
/// Write data out while reading data into the provided buffer
@@ -75,7 +75,7 @@ pub enum Operation<'a, W: 'static> {
7575

7676
/// Transactional trait allows multiple actions to be executed
7777
/// as part of a single SPI transaction
78-
pub trait Transactional<W: 'static> {
78+
pub trait Transactional<W: 'static = u8> {
7979
/// Associated error type
8080
type Error: crate::spi::Error;
8181

src/spi/nb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
///
1717
/// - Some SPIs can work with 8-bit *and* 16-bit words. You can overload this trait with different
1818
/// `Word` types to allow operation in both modes.
19-
pub trait FullDuplex<Word> {
19+
pub trait FullDuplex<Word = u8> {
2020
/// An enumeration of SPI errors
2121
type Error: crate::spi::Error;
2222

0 commit comments

Comments
 (0)