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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! Helpers and functions relating to W5500 SPI transfers.
/// SPI Access Modes.
/// SPI header length.
pub const HEADER_LEN: usize = 3;
/// Helper to create a variable data length SPI header.
///
/// # Example
///
/// SPI header to read the VERSIONR register in variable data length mode.
///
/// ```
/// use w5500_ll::{spi, Reg, COMMON_BLOCK_OFFSET};
///
/// let hdr = spi::vdm_header(
/// Reg::VERSIONR.addr(),
/// COMMON_BLOCK_OFFSET,
/// spi::AccessMode::Read,
/// );
/// assert_eq!(hdr, [0x00, 0x39, 0x00]);
/// ```
pub const
/// Helper to create a 1 byte fixed data length SPI header.
///
/// # Example
///
/// SPI header to read the VERSIONR register in fixed data length mode.
///
/// ```
/// use w5500_ll::{spi, Reg, COMMON_BLOCK_OFFSET};
///
/// let hdr = spi::fdm_header_1b(
/// Reg::VERSIONR.addr(),
/// COMMON_BLOCK_OFFSET,
/// spi::AccessMode::Read,
/// );
/// assert_eq!(hdr, [0x00, 0x39, 0x01]);
/// ```
pub const
/// Helper to create a 2 byte fixed data length SPI header.
///
/// # Example
///
/// SPI header to read the UPORTR register in fixed data length mode.
///
/// ```
/// use w5500_ll::{spi, Reg, COMMON_BLOCK_OFFSET};
///
/// let hdr = spi::fdm_header_2b(
/// Reg::UPORTR0.addr(),
/// COMMON_BLOCK_OFFSET,
/// spi::AccessMode::Read,
/// );
/// assert_eq!(hdr, [0x00, 0x2C, 0x02]);
/// ```
pub const
/// Helper to create a 4 byte fixed data length SPI header.
///
/// # Example
///
/// SPI header to read the UIPR register in fixed data length mode.
///
/// ```
/// use w5500_ll::{spi, Reg, COMMON_BLOCK_OFFSET};
///
/// let hdr = spi::fdm_header_4b(
/// Reg::UIPR0.addr(),
/// COMMON_BLOCK_OFFSET,
/// spi::AccessMode::Read,
/// );
/// assert_eq!(hdr, [0x00, 0x28, 0x03]);
/// ```
pub const