Skip to content

Commit ac66e33

Browse files
bors[bot]burrbull
andauthored
Merge #321
321: u8 as default SPI Word r=eldruin a=burrbull Part of #320 Co-authored-by: Andrey Zgarbul <[email protected]>
2 parents 11d541b + 4f5c8f6 commit ac66e33

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
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 as Serial 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/serial/blocking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Blocking serial API
22
33
/// Write half of a serial interface (blocking variant)
4-
pub trait Write<Word> {
4+
pub trait Write<Word = u8> {
55
/// The type of error that can occur when writing
66
type Error: crate::serial::Error;
77

src/serial/nb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
///
55
/// Some serial interfaces support different data sizes (8 bits, 9 bits, etc.);
66
/// This can be encoded in this trait via the `Word` type parameter.
7-
pub trait Read<Word> {
7+
pub trait Read<Word = u8> {
88
/// Read error
99
type Error: crate::serial::Error;
1010

@@ -21,7 +21,7 @@ impl<T: Read<Word>, Word> Read<Word> for &mut T {
2121
}
2222

2323
/// Write half of a serial interface
24-
pub trait Write<Word> {
24+
pub trait Write<Word = u8> {
2525
/// Write error
2626
type Error: crate::serial::Error;
2727

src/spi/blocking.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Blocking SPI API
22
33
/// Blocking transfer
4-
pub trait Transfer<W> {
4+
pub trait Transfer<W = u8> {
55
/// Error type
66
type Error: crate::spi::Error;
77

@@ -20,7 +20,7 @@ impl<T: Transfer<W>, W> Transfer<W> for &mut T {
2020
}
2121

2222
/// Blocking write
23-
pub trait Write<W> {
23+
pub trait Write<W = u8> {
2424
/// Error type
2525
type Error: crate::spi::Error;
2626

@@ -37,7 +37,7 @@ impl<T: Write<W>, W> Write<W> for &mut T {
3737
}
3838

3939
/// Blocking write (iterator version)
40-
pub trait WriteIter<W> {
40+
pub trait WriteIter<W = u8> {
4141
/// Error type
4242
type Error: crate::spi::Error;
4343

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

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

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)