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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/**
* <rc/spi.h>
*
* @brief General purpose C interface to the Linux SPI driver.
*
* It allows use of both dedicated hardware slave-select pins as well as GPIO
* pins for slave select. While this was developed on the BeagleBone platform,
* it should also work on Raspberry Pi and other embedded Linux systems.
*
* For the Robotics Cape and BeagleBone blue, the SPI bus 1 is broken out on two
* JST SH 6-pin sockets labeled SPI1.1 and SPI1.2 These share clock and serial
* IO signals, but have independent slave select lines so two devices can share
* the same bus. Note that these ports labeled for slaves 1 and 2 correspond to
* slaves 0 and 1 in software. To make source code more clear, the macros
* RC_BB_SPI1_SS1 and RC_BB_SPI1_SS2 are provided in this header which are
* defined as 1,0 and 1,1. the GPIO channels corresponding to these slave select
* pins are also provided as macros in this header.For example:
*
* ```C
* rc_spi_init_manual_slave(RC_BB_SPI1_SS1, SPI_MODE_0, \
* RC_SPI_MAX_SPEED, RC_BLUE_SS1_GPIO);
* ```
*
* pinout on Robotics Cape and BeagleBone Blue:
* 1. GND
* 2. 3.3V
* 3. MOSI (P9_30)
* 4. MISO (P9_29)
* 5. SCK (P9_31)
* 6. Slave Select
*
*
* The slaves can be selected automatically by the SPI Linux driver or manually
* with rc_spi_select() function. On the Robotics Cape, slave 1 can be used in
* either mode, but slave 2 must be selected manually. On the BB Blue either
* slave can be used in manual or automatic modes. Only initialize once with
* either mode.
*
* @author James Strawson
* @date 1/19/2018
*
* @addtogroup SPI
* @ingroup IO
* @{
*/
extern "C" __cplusplus
}
// RC_SPI_H
///@} end group SPI