1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Define a trait to track the [`CharSize`], which represents the [`Config`]
//! [`Size`] for SAMD11 and SAMD21 chips
//!
//! [`Config`]: super::Config
//! [`Size`]: super::Size
use crateSealed;
//=============================================================================
// Character size
//=============================================================================
/// Type-level enum representing the SPI character size
///
/// This trait acts as both a [type-level enum], forming a type class for
/// character sizes, as well as a [type-level function] mapping the
/// corresponding word size.
///
/// The SPI character size affects the word size for the embedded HAL traits.
/// Eight-bit transactions use a `u8` word, while nine-bit transactions use a
/// `u16` word.
///
/// [type-level enum]: crate::typelevel#type-level-enums
/// [type-level function]: crate::typelevel#type-level-functions
/// Type alias to recover the [`Word`](CharSize::Word) type from an
/// implementation of [`CharSize`]
pub type Word<C> = Word;
/// [`CharSize`] variant for 8-bit transactions
/// [`CharSize`] variant for 9-bit transactions