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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SPI Interface</title>
<title>CMSIS-Driver: SPI Interface</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="printComponentTabs.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 46px;">
<td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">CMSIS-Driver
 <span id="projectnumber">Version 2.7.1</span>
</div>
<div id="projectbrief">Peripheral Interface for Middleware and Application Code</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
<ul class="tablist">
<script type="text/javascript">
<!--
writeComponentTabs.call(this);
//-->
</script>
</ul>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Usage and Description</span></a></li>
<li><a href="modules.html"><span>Reference</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__spi__interface__gr.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#groups">Content</a> |
<a href="#nested-classes">Data Structures</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">SPI Interface</div> </div>
</div><!--header-->
<div class="contents">
<p>Driver API for SPI Bus Peripheral (Driver_SPI.h)
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Content</h2></td></tr>
<tr class="memitem:group__spi__execution__status"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__execution__status.html">Status Error Codes</a></td></tr>
<tr class="memdesc:group__spi__execution__status"><td class="mdescLeft"> </td><td class="mdescRight">Negative values indicate errors (SPI has specific codes in addition to common <a class="el" href="group__execution__status.html">Status Error Codes</a>). <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:group__SPI__events"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__SPI__events.html">SPI Events</a></td></tr>
<tr class="memdesc:group__SPI__events"><td class="mdescLeft"> </td><td class="mdescRight">The SPI driver generates call back events that are notified via the function <a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a>. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:group__SPI__control"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__SPI__control.html">SPI Control Codes</a></td></tr>
<tr class="memdesc:group__SPI__control"><td class="mdescLeft"> </td><td class="mdescRight">Many parameters of the SPI driver are configured using the <a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> function. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:structARM__DRIVER__SPI"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a></td></tr>
<tr class="memdesc:structARM__DRIVER__SPI"><td class="mdescLeft"> </td><td class="mdescRight">Access structure of the SPI Driver. <a href="group__spi__interface__gr.html#structARM__DRIVER__SPI">More...</a><br/></td></tr>
<tr class="separator:structARM__DRIVER__SPI"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:structARM__SPI__CAPABILITIES"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a></td></tr>
<tr class="memdesc:structARM__SPI__CAPABILITIES"><td class="mdescLeft"> </td><td class="mdescRight">SPI Driver Capabilities. <a href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">More...</a><br/></td></tr>
<tr class="separator:structARM__SPI__CAPABILITIES"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:structARM__SPI__STATUS"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__STATUS">ARM_SPI_STATUS</a></td></tr>
<tr class="memdesc:structARM__SPI__STATUS"><td class="mdescLeft"> </td><td class="mdescRight">SPI Status. <a href="group__spi__interface__gr.html#structARM__SPI__STATUS">More...</a><br/></td></tr>
<tr class="separator:structARM__SPI__STATUS"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:gafde9205364241ee81290adc0481c6640"><td class="memItemLeft" align="right" valign="top">typedef void(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#gafde9205364241ee81290adc0481c6640">ARM_SPI_SignalEvent_t</a> )(uint32_t event)</td></tr>
<tr class="memdesc:gafde9205364241ee81290adc0481c6640"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a> : Signal SPI Event. <a href="#gafde9205364241ee81290adc0481c6640">More...</a><br/></td></tr>
<tr class="separator:gafde9205364241ee81290adc0481c6640"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gad5db9209ef1d64a7915a7278d6a402c8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#gad5db9209ef1d64a7915a7278d6a402c8">ARM_SPI_GetVersion</a> (void)</td></tr>
<tr class="memdesc:gad5db9209ef1d64a7915a7278d6a402c8"><td class="mdescLeft"> </td><td class="mdescRight">Get driver version. <a href="#gad5db9209ef1d64a7915a7278d6a402c8">More...</a><br/></td></tr>
<tr class="separator:gad5db9209ef1d64a7915a7278d6a402c8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaf4823a11ab5efcd47c79b13801513ddc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#gaf4823a11ab5efcd47c79b13801513ddc">ARM_SPI_GetCapabilities</a> (void)</td></tr>
<tr class="memdesc:gaf4823a11ab5efcd47c79b13801513ddc"><td class="mdescLeft"> </td><td class="mdescRight">Get driver capabilities. <a href="#gaf4823a11ab5efcd47c79b13801513ddc">More...</a><br/></td></tr>
<tr class="separator:gaf4823a11ab5efcd47c79b13801513ddc"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1a3c11ed523a4355cd91069527945906"><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ga1a3c11ed523a4355cd91069527945906">ARM_SPI_Initialize</a> (<a class="el" href="group__spi__interface__gr.html#gafde9205364241ee81290adc0481c6640">ARM_SPI_SignalEvent_t</a> cb_event)</td></tr>
<tr class="memdesc:ga1a3c11ed523a4355cd91069527945906"><td class="mdescLeft"> </td><td class="mdescRight">Initialize SPI Interface. <a href="#ga1a3c11ed523a4355cd91069527945906">More...</a><br/></td></tr>
<tr class="separator:ga1a3c11ed523a4355cd91069527945906"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga0c480ee3eabb82fc746e89741ed2e03e"><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ga0c480ee3eabb82fc746e89741ed2e03e">ARM_SPI_Uninitialize</a> (void)</td></tr>
<tr class="memdesc:ga0c480ee3eabb82fc746e89741ed2e03e"><td class="mdescLeft"> </td><td class="mdescRight">De-initialize SPI Interface. <a href="#ga0c480ee3eabb82fc746e89741ed2e03e">More...</a><br/></td></tr>
<tr class="separator:ga0c480ee3eabb82fc746e89741ed2e03e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1a1e7e80ea32ae381b75213c32aa8067"><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ga1a1e7e80ea32ae381b75213c32aa8067">ARM_SPI_PowerControl</a> (<a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a> state)</td></tr>
<tr class="memdesc:ga1a1e7e80ea32ae381b75213c32aa8067"><td class="mdescLeft"> </td><td class="mdescRight">Control SPI Interface Power. <a href="#ga1a1e7e80ea32ae381b75213c32aa8067">More...</a><br/></td></tr>
<tr class="separator:ga1a1e7e80ea32ae381b75213c32aa8067"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab2a303d1071e926280d50682f4808479"><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#gab2a303d1071e926280d50682f4808479">ARM_SPI_Send</a> (const void *data, uint32_t num)</td></tr>
<tr class="memdesc:gab2a303d1071e926280d50682f4808479"><td class="mdescLeft"> </td><td class="mdescRight">Start sending data to SPI transmitter. <a href="#gab2a303d1071e926280d50682f4808479">More...</a><br/></td></tr>
<tr class="separator:gab2a303d1071e926280d50682f4808479"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga726aff54e782ed9b47f7ba1280a3d8f6"><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ga726aff54e782ed9b47f7ba1280a3d8f6">ARM_SPI_Receive</a> (void *data, uint32_t num)</td></tr>
<tr class="memdesc:ga726aff54e782ed9b47f7ba1280a3d8f6"><td class="mdescLeft"> </td><td class="mdescRight">Start receiving data from SPI receiver. <a href="#ga726aff54e782ed9b47f7ba1280a3d8f6">More...</a><br/></td></tr>
<tr class="separator:ga726aff54e782ed9b47f7ba1280a3d8f6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa24026b3822c10272e301f1505136ec2"><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#gaa24026b3822c10272e301f1505136ec2">ARM_SPI_Transfer</a> (const void *data_out, void *data_in, uint32_t num)</td></tr>
<tr class="memdesc:gaa24026b3822c10272e301f1505136ec2"><td class="mdescLeft"> </td><td class="mdescRight">Start sending/receiving data to/from SPI transmitter/receiver. <a href="#gaa24026b3822c10272e301f1505136ec2">More...</a><br/></td></tr>
<tr class="separator:gaa24026b3822c10272e301f1505136ec2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaaaecaaf4ec1922f22e7f9de63af5ccdb"><td class="memItemLeft" align="right" valign="top">uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#gaaaecaaf4ec1922f22e7f9de63af5ccdb">ARM_SPI_GetDataCount</a> (void)</td></tr>
<tr class="memdesc:gaaaecaaf4ec1922f22e7f9de63af5ccdb"><td class="mdescLeft"> </td><td class="mdescRight">Get transferred data count. <a href="#gaaaecaaf4ec1922f22e7f9de63af5ccdb">More...</a><br/></td></tr>
<tr class="separator:gaaaecaaf4ec1922f22e7f9de63af5ccdb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gad18d229992598d6677bec250015e5d1a"><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> (uint32_t control, uint32_t arg)</td></tr>
<tr class="memdesc:gad18d229992598d6677bec250015e5d1a"><td class="mdescLeft"> </td><td class="mdescRight">Control SPI Interface. <a href="#gad18d229992598d6677bec250015e5d1a">More...</a><br/></td></tr>
<tr class="separator:gad18d229992598d6677bec250015e5d1a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga60d33d8788a76c388cc36e066240b817"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__STATUS">ARM_SPI_STATUS</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817">ARM_SPI_GetStatus</a> (void)</td></tr>
<tr class="memdesc:ga60d33d8788a76c388cc36e066240b817"><td class="mdescLeft"> </td><td class="mdescRight">Get SPI status. <a href="#ga60d33d8788a76c388cc36e066240b817">More...</a><br/></td></tr>
<tr class="separator:ga60d33d8788a76c388cc36e066240b817"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga505b2d787348d51351d38fee98ccba7e"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a> (uint32_t event)</td></tr>
<tr class="memdesc:ga505b2d787348d51351d38fee98ccba7e"><td class="mdescLeft"> </td><td class="mdescRight">Signal SPI Events. <a href="#ga505b2d787348d51351d38fee98ccba7e">More...</a><br/></td></tr>
<tr class="separator:ga505b2d787348d51351d38fee98ccba7e"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<p>Driver API for SPI Bus Peripheral (Driver_SPI.h) </p>
<p>The <b>Serial Peripheral Interface Bus</b> (SPI) implements a synchronous serial bus for data exchange. In microcontroller (MCU) applications, the interface is often used to connect peripheral components at board (PCB) level. SPI devices can operate as Master (SCLK and SS are outputs) or Slave (SCLK and SS are inputs). Wikipedia offers more information about the <a href="http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus" target="_blank"><b>Serial Peripheral Interface Bus</b></a>.</p>
<p><b>Block Diagram</b></p>
<p>The SPI Driver API defines a <b>SPI</b> interface for middleware components. The SPI Driver supports multiple slaves, but if only one slave is connected, then the Slave Select signal can be omitted.</p>
<div class="image">
<img src="SPI_Master1Slaves.png" alt="SPI_Master1Slaves.png"/>
<div class="caption">
SPI Master connected to a single slave</div></div>
<p> </p>
<div class="image">
<img src="SPI_Master3Slaves.png" alt="SPI_Master3Slaves.png"/>
<div class="caption">
SPI Master connected to 3 slaves</div></div>
<p> The SPI Driver functions control the following SPI signal lines.</p>
<table class="doxtable">
<tr>
<th>Signal </th><th>Name </th><th>Description </th></tr>
<tr>
<td>SS </td><td>Slave Select (active low) </td><td>Selects the slave. This signal can be part of the SPI peripheral or implemented using a GPIO pin. </td></tr>
<tr>
<td>MOSI </td><td>Master Out, Slave In </td><td>MOSI output of the Master connects to MOSI input of the Slave. </td></tr>
<tr>
<td>SCLK </td><td>Serial Clock </td><td>Serial clock output from Master. Controls the transfer speed and when data are sent and read. </td></tr>
<tr>
<td>MISO </td><td>Master In, Slave Out </td><td>MISO input of the Master connects to MISO output of the Slave. </td></tr>
</table>
<p><b>SPI API</b></p>
<p>The following header files define the Application Programming Interface (API) for the SPI interface:</p>
<ul>
<li><b>Driver_SPI.h</b> : Driver API for SPI Bus Peripheral</li>
</ul>
<p>The driver implementation is a typical part of the Device Family Pack (DFP) that supports the peripherals of the microcontroller family.</p>
<p><b>Driver Functions</b></p>
<p>The driver functions are published in the access struct as explained in <a class="el" href="theoryOperation.html#DriverFunctions">Common Driver Functions</a></p>
<ul>
<li><a class="el" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a> : access struct for SPI driver functions</li>
</ul>
<p><b>Example Code</b></p>
<p>The following example code shows the usage of the SPI interface.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#include "<a class="code" href="Driver__SPI_8h.html">Driver_SPI.h</a>"</span></div>
<div class="line"><span class="preprocessor">#include "cmsis_os.h"</span> <span class="comment">// ARM::CMSIS:RTOS:Keil RTX</span></div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> mySPI_Thread(<span class="keywordtype">void</span> <span class="keyword">const</span> *argument);</div>
<div class="line">osThreadId tid_mySPI_Thread;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="comment">/* SPI Driver */</span></div>
<div class="line"><span class="keyword">extern</span> <a class="code" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a> Driver_SPI0;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> mySPI_callback(uint32_t event)</div>
<div class="line">{</div>
<div class="line"> <span class="keywordflow">switch</span> (event)</div>
<div class="line"> {</div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a>:</div>
<div class="line"> <span class="comment">/* Success: Wakeup Thread */</span></div>
<div class="line"> osSignalSet(tid_mySPI_Thread, 0x01);</div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="group__SPI__events.html#ga8e63d99c80ea56de596a8d0a51fd8244">ARM_SPI_EVENT_DATA_LOST</a>:</div>
<div class="line"> <span class="comment">/* Occurs in slave mode when data is requested/sent by master</span></div>
<div class="line"><span class="comment"> but send/receive/transfer operation has not been started</span></div>
<div class="line"><span class="comment"> and indicates that data is lost. Occurs also in master mode</span></div>
<div class="line"><span class="comment"> when driver cannot transfer data fast enough. */</span></div>
<div class="line"> __breakpoint(0); <span class="comment">/* Error: Call debugger or replace with custom error handling */</span></div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> <span class="keywordflow">case</span> <a class="code" href="group__SPI__events.html#ga7eaa229003689aa18598273490b3e630">ARM_SPI_EVENT_MODE_FAULT</a>:</div>
<div class="line"> <span class="comment">/* Occurs in master mode when Slave Select is deactivated and</span></div>
<div class="line"><span class="comment"> indicates Master Mode Fault. */</span></div>
<div class="line"> __breakpoint(0); <span class="comment">/* Error: Call debugger or replace with custom error handling */</span></div>
<div class="line"> <span class="keywordflow">break</span>;</div>
<div class="line"> }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"><span class="comment">/* Test data buffers */</span></div>
<div class="line"><span class="keyword">const</span> uint8_t testdata_out[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; </div>
<div class="line">uint8_t testdata_in [8];</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> mySPI_Thread(<span class="keywordtype">void</span> <span class="keyword">const</span>* arg)</div>
<div class="line">{</div>
<div class="line"> <a class="code" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a>* SPIdrv = &Driver_SPI0;</div>
<div class="line"> osEvent evt;</div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#ifdef DEBUG</span></div>
<div class="line"><span class="preprocessor"></span> <a class="code" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a> version;</div>
<div class="line"> <a class="code" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a> drv_capabilities;</div>
<div class="line"> </div>
<div class="line"> version = SPIdrv-><a class="code" href="group__spi__interface__gr.html#a8834b281da48583845c044a81566c1b3">GetVersion</a>();</div>
<div class="line"> <span class="keywordflow">if</span> (version.<a class="code" href="group__common__drv__gr.html#ad180da20fbde1d3dafc074af87c19540">api</a> < 0x200) <span class="comment">/* requires at minimum API version 2.00 or higher */</span></div>
<div class="line"> { <span class="comment">/* error handling */</span></div>
<div class="line"> <span class="keywordflow">return</span>;</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> drv_capabilities = SPIdrv-><a class="code" href="group__spi__interface__gr.html#a065b5fc24d0204692f0f95a44351ac1e">GetCapabilities</a>();</div>
<div class="line"> <span class="keywordflow">if</span> (drv_capabilities.<a class="code" href="group__spi__interface__gr.html#a309619714f0c4febaa497ebdb9b7e3ca">event_mode_fault</a> == 0)</div>
<div class="line"> { <span class="comment">/* error handling */</span></div>
<div class="line"> <span class="keywordflow">return</span>;</div>
<div class="line"> }</div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span> </div>
<div class="line"> <span class="comment">/* Initialize the SPI driver */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#afac50d0b28860f7b569293e6b713f8a4">Initialize</a>(mySPI_callback);</div>
<div class="line"> <span class="comment">/* Power up the SPI peripheral */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#aba8f1c8019af95ffe19c32403e3240ef">PowerControl</a>(<a class="code" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5abed52b77a9ce4775570e44a842b1295e">ARM_POWER_FULL</a>);</div>
<div class="line"> <span class="comment">/* Configure the SPI to Master, 8-bit mode @10000 kBits/sec */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__spi__mode__ctrls.html#ga3143ef07c1607b9bc57e29df35cf2fa8">ARM_SPI_MODE_MASTER</a> | <a class="code" href="group__spi__frame__format__ctrls.html#ga7fab572b2fec303e979e47eb2d13ca74">ARM_SPI_CPOL1_CPHA1</a> | <a class="code" href="group__spi__bit__order__ctrls.html#ga98228a708cbab6e214c7ac696f77dab6">ARM_SPI_MSB_LSB</a> | <a class="code" href="group__spi__slave__select__mode__ctrls.html#gab5e319aa3f9d4d8c9ed92f0fe865f624">ARM_SPI_SS_MASTER_SW</a> | <a class="code" href="group__spi__data__bits__ctrls.html#gaf6c099a1d67256a32010120c66c55250">ARM_SPI_DATA_BITS</a>(8), 10000000);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">/* SS line = INACTIVE = HIGH */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>, <a class="code" href="Driver__SPI_8h.html#a335b448e07422e9c25616a693ec581cc">ARM_SPI_SS_INACTIVE</a>);</div>
<div class="line"> </div>
<div class="line"> <span class="comment">/* thread loop */</span></div>
<div class="line"> <span class="keywordflow">while</span> (1)</div>
<div class="line"> {</div>
<div class="line"> <span class="comment">/* SS line = ACTIVE = LOW */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>, <a class="code" href="Driver__SPI_8h.html#a3f465cdbd1238ddd74f78e14457076c4">ARM_SPI_SS_ACTIVE</a>);</div>
<div class="line"> <span class="comment">/* Transmit some data */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#a44eedddf4428cf4b98883b6c27d31922">Send</a>(testdata_out, <span class="keyword">sizeof</span>(testdata_out));</div>
<div class="line"> <span class="comment">/* Wait for completion */</span></div>
<div class="line"> evt = osSignalWait(0x01, 100);</div>
<div class="line"> <span class="keywordflow">if</span> (evt.status == osEventTimeout) {</div>
<div class="line"> __breakpoint(0); <span class="comment">/* Timeout error: Call debugger */</span></div>
<div class="line"> }</div>
<div class="line"> <span class="comment">/* SS line = INACTIVE = HIGH */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>, <a class="code" href="Driver__SPI_8h.html#a335b448e07422e9c25616a693ec581cc">ARM_SPI_SS_INACTIVE</a>);</div>
<div class="line"></div>
<div class="line"> <span class="comment">/* SS line = ACTIVE = LOW */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>, <a class="code" href="Driver__SPI_8h.html#a3f465cdbd1238ddd74f78e14457076c4">ARM_SPI_SS_ACTIVE</a>);</div>
<div class="line"> <span class="comment">/* Receive 8 bytes of reply */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#adb9224a35fe16c92eb0dd103638e4cf3">Receive</a>(testdata_in, 8);</div>
<div class="line"> evt = osSignalWait(0x01, 100);</div>
<div class="line"> <span class="keywordflow">if</span> (evt.status == osEventTimeout) {</div>
<div class="line"> __breakpoint(0); <span class="comment">/* Timeout error: Call debugger */</span></div>
<div class="line"> }</div>
<div class="line"> <span class="comment">/* SS line = INACTIVE = HIGH */</span></div>
<div class="line"> SPIdrv-><a class="code" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>, <a class="code" href="Driver__SPI_8h.html#a335b448e07422e9c25616a693ec581cc">ARM_SPI_SS_INACTIVE</a>);</div>
<div class="line"> }</div>
<div class="line">}</div>
</div><!-- fragment --> <hr/><h2 class="groupheader">Data Structure Documentation</h2>
<a name="structARM__DRIVER__SPI" id="structARM__DRIVER__SPI"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct ARM_DRIVER_SPI</td>
</tr>
</table>
</div><div class="memdoc">
<div class="textblock"><p>Access structure of the SPI Driver. </p>
<p>The functions of the SPI driver are accessed by function pointers exposed by this structure. Refer to <a class="el" href="theoryOperation.html#DriverFunctions">Common Driver Functions</a> for overview information.</p>
<p>Each instance of a SPI interface provides such an access structure. The instance is identified by a postfix number in the symbol name of the access structure, for example:</p>
<ul>
<li><b>Driver_SPI0</b> is the name of the access struct of the first instance (no. 0).</li>
<li><b>Driver_SPI1</b> is the name of the access struct of the second instance (no. 1).</li>
</ul>
<p>A middleware configuration setting allows connecting the middleware to a specific driver instance <b>Driver_SPI<em>n</em></b>. The default is <span class="XML-Token">0</span>, which connects a middleware to the first instance of a driver. </p>
</div><table class="memberdecls">
<tr><td colspan="2"><h3>Data Fields</h3></td></tr>
<tr class="memitem:a8834b281da48583845c044a81566c1b3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#a8834b281da48583845c044a81566c1b3">GetVersion</a> )(void)</td></tr>
<tr class="memdesc:a8834b281da48583845c044a81566c1b3"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#gad5db9209ef1d64a7915a7278d6a402c8">ARM_SPI_GetVersion</a> : Get driver version. <a href="#a8834b281da48583845c044a81566c1b3">More...</a><br/></td></tr>
<tr class="separator:a8834b281da48583845c044a81566c1b3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a065b5fc24d0204692f0f95a44351ac1e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#a065b5fc24d0204692f0f95a44351ac1e">GetCapabilities</a> )(void)</td></tr>
<tr class="memdesc:a065b5fc24d0204692f0f95a44351ac1e"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#gaf4823a11ab5efcd47c79b13801513ddc">ARM_SPI_GetCapabilities</a> : Get driver capabilities. <a href="#a065b5fc24d0204692f0f95a44351ac1e">More...</a><br/></td></tr>
<tr class="separator:a065b5fc24d0204692f0f95a44351ac1e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afac50d0b28860f7b569293e6b713f8a4"><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#afac50d0b28860f7b569293e6b713f8a4">Initialize</a> )(<a class="el" href="group__spi__interface__gr.html#gafde9205364241ee81290adc0481c6640">ARM_SPI_SignalEvent_t</a> cb_event)</td></tr>
<tr class="memdesc:afac50d0b28860f7b569293e6b713f8a4"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#ga1a3c11ed523a4355cd91069527945906">ARM_SPI_Initialize</a> : Initialize SPI Interface. <a href="#afac50d0b28860f7b569293e6b713f8a4">More...</a><br/></td></tr>
<tr class="separator:afac50d0b28860f7b569293e6b713f8a4"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adcf20681a1402869ecb5c6447fada17b"><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#adcf20681a1402869ecb5c6447fada17b">Uninitialize</a> )(void)</td></tr>
<tr class="memdesc:adcf20681a1402869ecb5c6447fada17b"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#ga0c480ee3eabb82fc746e89741ed2e03e">ARM_SPI_Uninitialize</a> : De-initialize SPI Interface. <a href="#adcf20681a1402869ecb5c6447fada17b">More...</a><br/></td></tr>
<tr class="separator:adcf20681a1402869ecb5c6447fada17b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aba8f1c8019af95ffe19c32403e3240ef"><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#aba8f1c8019af95ffe19c32403e3240ef">PowerControl</a> )(<a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a> state)</td></tr>
<tr class="memdesc:aba8f1c8019af95ffe19c32403e3240ef"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#ga1a1e7e80ea32ae381b75213c32aa8067">ARM_SPI_PowerControl</a> : Control SPI Interface Power. <a href="#aba8f1c8019af95ffe19c32403e3240ef">More...</a><br/></td></tr>
<tr class="separator:aba8f1c8019af95ffe19c32403e3240ef"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a44eedddf4428cf4b98883b6c27d31922"><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#a44eedddf4428cf4b98883b6c27d31922">Send</a> )(const void *data, uint32_t num)</td></tr>
<tr class="memdesc:a44eedddf4428cf4b98883b6c27d31922"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#gab2a303d1071e926280d50682f4808479">ARM_SPI_Send</a> : Start sending data to SPI Interface. <a href="#a44eedddf4428cf4b98883b6c27d31922">More...</a><br/></td></tr>
<tr class="separator:a44eedddf4428cf4b98883b6c27d31922"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adb9224a35fe16c92eb0dd103638e4cf3"><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#adb9224a35fe16c92eb0dd103638e4cf3">Receive</a> )(void *data, uint32_t num)</td></tr>
<tr class="memdesc:adb9224a35fe16c92eb0dd103638e4cf3"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#ga726aff54e782ed9b47f7ba1280a3d8f6">ARM_SPI_Receive</a> : Start receiving data from SPI Interface. <a href="#adb9224a35fe16c92eb0dd103638e4cf3">More...</a><br/></td></tr>
<tr class="separator:adb9224a35fe16c92eb0dd103638e4cf3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad88b63ed74c03ba06b0599ab06ad4cf7"><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ad88b63ed74c03ba06b0599ab06ad4cf7">Transfer</a> )(const void *data_out, void *data_in, uint32_t num)</td></tr>
<tr class="memdesc:ad88b63ed74c03ba06b0599ab06ad4cf7"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#gaa24026b3822c10272e301f1505136ec2">ARM_SPI_Transfer</a> : Start sending/receiving data to/from SPI. <a href="#ad88b63ed74c03ba06b0599ab06ad4cf7">More...</a><br/></td></tr>
<tr class="separator:ad88b63ed74c03ba06b0599ab06ad4cf7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad1d892ab3932f65cd7cdf2d0a91ae5da"><td class="memItemLeft" align="right" valign="top">uint32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#ad1d892ab3932f65cd7cdf2d0a91ae5da">GetDataCount</a> )(void)</td></tr>
<tr class="memdesc:ad1d892ab3932f65cd7cdf2d0a91ae5da"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#gaaaecaaf4ec1922f22e7f9de63af5ccdb">ARM_SPI_GetDataCount</a> : Get transferred data count. <a href="#ad1d892ab3932f65cd7cdf2d0a91ae5da">More...</a><br/></td></tr>
<tr class="separator:ad1d892ab3932f65cd7cdf2d0a91ae5da"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6e0f47a92f626a971c5197fca6545505"><td class="memItemLeft" align="right" valign="top">int32_t(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a> )(uint32_t control, uint32_t arg)</td></tr>
<tr class="memdesc:a6e0f47a92f626a971c5197fca6545505"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> : Control SPI Interface. <a href="#a6e0f47a92f626a971c5197fca6545505">More...</a><br/></td></tr>
<tr class="separator:a6e0f47a92f626a971c5197fca6545505"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7305e7248420cdb4b02ceba87672178d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__STATUS">ARM_SPI_STATUS</a>(* </td><td class="memItemRight" valign="bottom"><a class="el" href="group__spi__interface__gr.html#a7305e7248420cdb4b02ceba87672178d">GetStatus</a> )(void)</td></tr>
<tr class="memdesc:a7305e7248420cdb4b02ceba87672178d"><td class="mdescLeft"> </td><td class="mdescRight">Pointer to <a class="el" href="group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817">ARM_SPI_GetStatus</a> : Get SPI status. <a href="#a7305e7248420cdb4b02ceba87672178d">More...</a><br/></td></tr>
<tr class="separator:a7305e7248420cdb4b02ceba87672178d"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h4 class="groupheader">Field Documentation</h4>
<a class="anchor" id="a8834b281da48583845c044a81566c1b3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a>(* GetVersion)(void)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#gad5db9209ef1d64a7915a7278d6a402c8">ARM_SPI_GetVersion</a> : Get driver version. </p>
</div>
</div>
<a class="anchor" id="a065b5fc24d0204692f0f95a44351ac1e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a>(* GetCapabilities)(void)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#gaf4823a11ab5efcd47c79b13801513ddc">ARM_SPI_GetCapabilities</a> : Get driver capabilities. </p>
</div>
</div>
<a class="anchor" id="afac50d0b28860f7b569293e6b713f8a4"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* Initialize)(<a class="el" href="group__spi__interface__gr.html#gafde9205364241ee81290adc0481c6640">ARM_SPI_SignalEvent_t</a> cb_event)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#ga1a3c11ed523a4355cd91069527945906">ARM_SPI_Initialize</a> : Initialize SPI Interface. </p>
</div>
</div>
<a class="anchor" id="adcf20681a1402869ecb5c6447fada17b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* Uninitialize)(void)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#ga0c480ee3eabb82fc746e89741ed2e03e">ARM_SPI_Uninitialize</a> : De-initialize SPI Interface. </p>
</div>
</div>
<a class="anchor" id="aba8f1c8019af95ffe19c32403e3240ef"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* PowerControl)(<a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a> state)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#ga1a1e7e80ea32ae381b75213c32aa8067">ARM_SPI_PowerControl</a> : Control SPI Interface Power. </p>
</div>
</div>
<a class="anchor" id="a44eedddf4428cf4b98883b6c27d31922"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* Send)(const void *data, uint32_t num)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#gab2a303d1071e926280d50682f4808479">ARM_SPI_Send</a> : Start sending data to SPI Interface. </p>
</div>
</div>
<a class="anchor" id="adb9224a35fe16c92eb0dd103638e4cf3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* Receive)(void *data, uint32_t num)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#ga726aff54e782ed9b47f7ba1280a3d8f6">ARM_SPI_Receive</a> : Start receiving data from SPI Interface. </p>
</div>
</div>
<a class="anchor" id="ad88b63ed74c03ba06b0599ab06ad4cf7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* Transfer)(const void *data_out, void *data_in, uint32_t num)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#gaa24026b3822c10272e301f1505136ec2">ARM_SPI_Transfer</a> : Start sending/receiving data to/from SPI. </p>
</div>
</div>
<a class="anchor" id="ad1d892ab3932f65cd7cdf2d0a91ae5da"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t(* GetDataCount)(void)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#gaaaecaaf4ec1922f22e7f9de63af5ccdb">ARM_SPI_GetDataCount</a> : Get transferred data count. </p>
</div>
</div>
<a class="anchor" id="a6e0f47a92f626a971c5197fca6545505"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t(* Control)(uint32_t control, uint32_t arg)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> : Control SPI Interface. </p>
</div>
</div>
<a class="anchor" id="a7305e7248420cdb4b02ceba87672178d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__STATUS">ARM_SPI_STATUS</a>(* GetStatus)(void)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817">ARM_SPI_GetStatus</a> : Get SPI status. </p>
</div>
</div>
</div>
</div>
<a name="structARM__SPI__CAPABILITIES" id="structARM__SPI__CAPABILITIES"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct ARM_SPI_CAPABILITIES</td>
</tr>
</table>
</div><div class="memdoc">
<div class="textblock"><p>SPI Driver Capabilities. </p>
<p>A SPI driver can be implemented with different capabilities. The data fields of this structure encode the capabilities implemented by this driver.</p>
<p><b>Returned by:</b></p>
<ul>
<li><a class="el" href="group__spi__interface__gr.html#gaf4823a11ab5efcd47c79b13801513ddc">ARM_SPI_GetCapabilities</a> </li>
</ul>
</div><table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a class="anchor" id="af244e2c2facf6414e3886495ee6b40bc"></a>uint32_t</td>
<td class="fieldname">
simplex: 1</td>
<td class="fielddoc">
supports Simplex Mode (Master and Slave) </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a8053c540e5d531b692224bdc2463f36a"></a>uint32_t</td>
<td class="fieldname">
ti_ssi: 1</td>
<td class="fielddoc">
supports TI Synchronous Serial Interface </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a9b4e858eb1d414128994742bf121f94c"></a>uint32_t</td>
<td class="fieldname">
microwire: 1</td>
<td class="fielddoc">
supports Microwire Interface </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a309619714f0c4febaa497ebdb9b7e3ca"></a>uint32_t</td>
<td class="fieldname">
event_mode_fault: 1</td>
<td class="fielddoc">
Signal Mode Fault event: <a class="el" href="group__SPI__events.html#ga7eaa229003689aa18598273490b3e630">ARM_SPI_EVENT_MODE_FAULT</a>. </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="aa43c4c21b173ada1b6b7568956f0d650"></a>uint32_t</td>
<td class="fieldname">
reserved: 28</td>
<td class="fielddoc">
Reserved (must be zero) </td></tr>
</table>
</div>
</div>
<a name="structARM__SPI__STATUS" id="structARM__SPI__STATUS"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct ARM_SPI_STATUS</td>
</tr>
</table>
</div><div class="memdoc">
<div class="textblock"><p>SPI Status. </p>
<p>Structure with information about the status of the SPI. The data fields encode busy flag and error flags.</p>
<p><b>Returned by:</b></p>
<ul>
<li><a class="el" href="group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817">ARM_SPI_GetStatus</a> </li>
</ul>
</div><table class="fieldtable">
<tr><th colspan="3">Data Fields</th></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a50c88f3c1d787773e2ac1b59533f034a"></a>uint32_t</td>
<td class="fieldname">
busy: 1</td>
<td class="fielddoc">
Transmitter/Receiver busy flag. </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="a9675630df67587ecd171c7ef12b9d22a"></a>uint32_t</td>
<td class="fieldname">
data_lost: 1</td>
<td class="fielddoc">
Data lost: Receive overflow / Transmit underflow (cleared on start of transfer operation) </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="aeaf54ec655b7a64b9e88578c5f39d4e3"></a>uint32_t</td>
<td class="fieldname">
mode_fault: 1</td>
<td class="fielddoc">
Mode fault detected; optional (cleared on start of transfer operation) </td></tr>
<tr><td class="fieldtype">
<a class="anchor" id="aa43c4c21b173ada1b6b7568956f0d650"></a>uint32_t</td>
<td class="fieldname">
reserved: 29</td>
<td class="fielddoc">
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="gafde9205364241ee81290adc0481c6640"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">ARM_SPI_SignalEvent_t</td>
</tr>
</table>
</div><div class="memdoc">
<p>Pointer to <a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a> : Signal SPI Event. </p>
<p>Provides the typedef for the callback function <a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a>.</p>
<p><b>Parameter for:</b></p>
<ul>
<li><a class="el" href="group__spi__interface__gr.html#ga1a3c11ed523a4355cd91069527945906">ARM_SPI_Initialize</a> </li>
</ul>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gad5db9209ef1d64a7915a7278d6a402c8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a> ARM_SPI_GetVersion </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get driver version. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a></dd></dl>
<p>The function <b>ARM_SPI_GetVersion</b> returns version information of the driver implementation in <a class="el" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a></p>
<ul>
<li>API version is the version of the CMSIS-Driver specification used to implement this driver.</li>
<li>Driver version is source code version of the actual driver implementation.</li>
</ul>
<p>Example: </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a> Driver_SPI0;</div>
<div class="line"><a class="code" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a> *drv_info;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> setup_spi (<span class="keywordtype">void</span>) {</div>
<div class="line"> <a class="code" href="group__common__drv__gr.html#structARM__DRIVER__VERSION">ARM_DRIVER_VERSION</a> version;</div>
<div class="line"> </div>
<div class="line"> drv_info = &Driver_SPI0; </div>
<div class="line"> version = drv_info-><a class="code" href="group__spi__interface__gr.html#a8834b281da48583845c044a81566c1b3">GetVersion</a> ();</div>
<div class="line"> <span class="keywordflow">if</span> (version.<a class="code" href="group__common__drv__gr.html#ad180da20fbde1d3dafc074af87c19540">api</a> < 0x10A) { <span class="comment">// requires at minimum API version 1.10 or higher</span></div>
<div class="line"> <span class="comment">// error handling</span></div>
<div class="line"> <span class="keywordflow">return</span>;</div>
<div class="line"> }</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="gaf4823a11ab5efcd47c79b13801513ddc"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a> ARM_SPI_GetCapabilities </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get driver capabilities. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a></dd></dl>
<p>The function <b>ARM_SPI_GetCapabilities</b> returns information about the capabilities in this driver implementation. The data fields of the structure <a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a> encode various capabilities, for example supported modes.</p>
<p>Example: </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a> Driver_SPI0;</div>
<div class="line"><a class="code" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a> *drv_info;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> read_capabilities (<span class="keywordtype">void</span>) {</div>
<div class="line"> <a class="code" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a> drv_capabilities;</div>
<div class="line"> </div>
<div class="line"> drv_info = &Driver_SPI0; </div>
<div class="line"> drv_capabilities = drv_info-><a class="code" href="group__spi__interface__gr.html#a065b5fc24d0204692f0f95a44351ac1e">GetCapabilities</a> ();</div>
<div class="line"> <span class="comment">// interrogate capabilities</span></div>
<div class="line"> </div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ga1a3c11ed523a4355cd91069527945906"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t ARM_SPI_Initialize </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__spi__interface__gr.html#gafde9205364241ee81290adc0481c6640">ARM_SPI_SignalEvent_t</a> </td>
<td class="paramname"><em>cb_event</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initialize SPI Interface. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">cb_event</td><td>Pointer to <a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a> </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_SPI_Initialize</b> initializes the SPI interface.</p>
<p>The parameter <em>cb_event</em> is a pointer to the <a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a> callback function; use a NULL pointer when no callback signals are required.</p>
<p>The function is called when the middleware component starts operation and performs the following:</p>
<ul>
<li>Initializes the resources needed for the SPI interface.</li>
<li>Registers the <a class="el" href="group__spi__interface__gr.html#ga505b2d787348d51351d38fee98ccba7e">ARM_SPI_SignalEvent</a> callback function.</li>
</ul>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__spi__interface__gr.html">SPI Interface</a> - Driver Functions </li>
</ul>
</div>
</div>
<a class="anchor" id="ga0c480ee3eabb82fc746e89741ed2e03e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t ARM_SPI_Uninitialize </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>De-initialize SPI Interface. </p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_SPI_Uninitialize</b> de-initializes the resources of SPI interface.</p>
<p>It is called when the middleware component stops operation and releases the software resources used by the interface. </p>
</div>
</div>
<a class="anchor" id="ga1a1e7e80ea32ae381b75213c32aa8067"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t ARM_SPI_PowerControl </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group__common__drv__gr.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5">ARM_POWER_STATE</a> </td>
<td class="paramname"><em>state</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Control SPI Interface Power. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">state</td><td>Power state </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_SPI_PowerControl</b> controls the power modes of the SPI interface.</p>
<p>The parameter <em>state</em> sets the operation and can have the following values:</p>
<ul>
<li><a class="el" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5abed52b77a9ce4775570e44a842b1295e">ARM_POWER_FULL</a> : set-up peripheral for data transfers, enable interrupts (NVIC) and optionally DMA. Can be called multiple times. If the peripheral is already in this mode the function performs no operation and returns with <a class="el" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>.</li>
<li><a class="el" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5a9ef9e57cbcc948d0e22314e73dc8c434">ARM_POWER_LOW</a> : may use power saving. Returns <a class="el" href="group__execution__status.html#ga2efa59e480d82697795439220e6884e4">ARM_DRIVER_ERROR_UNSUPPORTED</a> when not implemented.</li>
<li><a class="el" href="Driver__Common_8h.html#ga47d6d7c31f88f3b8ae4aaf9d8444afa5ab6f5becc85ebd51c3dd2524a95d2ca35">ARM_POWER_OFF</a> : terminates any pending data transfers, disables peripheral, disables related interrupts and DMA.</li>
</ul>
<p>Refer to <a class="el" href="theoryOperation.html#CallSequence">Function Call Sequence</a> for more information. </p>
</div>
</div>
<a class="anchor" id="gab2a303d1071e926280d50682f4808479"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t ARM_SPI_Send </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>num</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start sending data to SPI transmitter. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>Pointer to buffer with data to send to SPI transmitter </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>Number of data items to send </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>This function <b>ARM_SPI_Send</b> is used to send data to the SPI transmitter (received data is ignored).</p>
<p>The parameter <em>data</em> specifies the data buffer. <br/>
The parameter <em>num</em> specifies the number of items to send. <br/>
The item size is defined by the data type, which depends on the configured number of data bits.</p>
<p>Data type is:</p>
<ul>
<li><em>uint8_t</em> when configured for 1..8 data bits</li>
<li><em>uint16_t</em> when configured for 9..16 data bits</li>
<li><em>uint32_t</em> when configured for 17..32 data bits</li>
</ul>
<p>Calling the function <b>ARM_SPI_Send</b> only starts the send operation. When in slave mode, the operation is only registered and started when the master starts the transfer. The function is non-blocking and returns as soon as the driver has started the operation (driver typically configures DMA or the interrupt system for continuous transfer). During the operation it is not allowed to call this function or any other data transfer function again. Also the data buffer must stay allocated and the contents of unsent data must not be modified. When send operation is completed (requested number of items sent), the <a class="el" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a> event is generated. Progress of send operation can also be monitored by reading the number of items already sent by calling <a class="el" href="group__spi__interface__gr.html#gaaaecaaf4ec1922f22e7f9de63af5ccdb">ARM_SPI_GetDataCount</a>.</p>
<p>Status of the transmitter can also be monitored by calling the <a class="el" href="group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817">ARM_SPI_GetStatus</a> and checking the <em>busy</em> data field, which indicates if transmission is still in progress or pending.</p>
<p>When in master mode and configured to monitor slave select and the slave select gets deactivated during transfer, then the SPI mode changes to inactive and the <a class="el" href="group__SPI__events.html#ga7eaa229003689aa18598273490b3e630">ARM_SPI_EVENT_MODE_FAULT</a> event is generated (instead of <a class="el" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a>).</p>
<p>When in slave mode but send/receive/transfer operation is not started and data is sent/requested by the master, then the <a class="el" href="group__SPI__events.html#ga8e63d99c80ea56de596a8d0a51fd8244">ARM_SPI_EVENT_DATA_LOST</a> event is generated.</p>
<p>Send operation can be aborted by calling <a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> with <a class="el" href="group__spi__misc__ctrls.html#ga44708b80e48984be099cd6eb11780dc3">ARM_SPI_ABORT_TRANSFER</a> as the control parameter. </p>
</div>
</div>
<a class="anchor" id="ga726aff54e782ed9b47f7ba1280a3d8f6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t ARM_SPI_Receive </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>num</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start receiving data from SPI receiver. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>Pointer to buffer for data to receive from SPI receiver </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>Number of data items to receive </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_SPI_Receive</b> is used to receive data (transmits the default value as specified by <a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> with <a class="el" href="group__spi__misc__ctrls.html#gae9861221dee78d52bd1522b7846535ce">ARM_SPI_SET_DEFAULT_TX_VALUE</a> as control parameter).</p>
<p>The parameter <em>data</em> specifies the data buffer. <br/>
The parameter <em>num</em> specifies the number of items to receive. <br/>
The item size is defined by the data type, which depends on the configured number of data bits.</p>
<p>Data type is:</p>
<ul>
<li><em>uint8_t</em> when configured for 1..8 data bits</li>
<li><em>uint16_t</em> when configured for 9..16 data bits</li>
<li><em>uint32_t</em> when configured for 17..32 data bits</li>
</ul>
<p>Calling the function <b>ARM_SPI_Receive</b> only starts the receive operation. The function is non-blocking and returns as soon as the driver has started the operation (driver typically configures DMA or the interrupt system for continuous transfer). When in slave mode, the operation is only registered and started when the master starts the transfer. During the operation it is not allowed to call this function or any other data transfer function again. Also the data buffer must stay allocated. When receive operation is completed (requested number of items received), the <a class="el" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a> event is generated. Progress of receive operation can also be monitored by reading the number of items already received by calling <a class="el" href="group__spi__interface__gr.html#gaaaecaaf4ec1922f22e7f9de63af5ccdb">ARM_SPI_GetDataCount</a>.</p>
<p>Status of the receiver can also be monitored by calling the <a class="el" href="group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817">ARM_SPI_GetStatus</a> and checking the <em>busy</em> data field, which indicates if reception is still in progress or pending.</p>
<p>When in master mode and configured to monitor slave select and the slave select gets deactivated during transfer, then the SPI mode changes to inactive and the <a class="el" href="group__SPI__events.html#ga7eaa229003689aa18598273490b3e630">ARM_SPI_EVENT_MODE_FAULT</a> event is generated (instead of <a class="el" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a>).</p>
<p>When in slave mode but send/receive/transfer operation is not started and data is sent/requested by the master, then the <a class="el" href="group__SPI__events.html#ga8e63d99c80ea56de596a8d0a51fd8244">ARM_SPI_EVENT_DATA_LOST</a> event is generated.</p>
<p>Receive operation can be aborted by calling <a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> with <a class="el" href="group__spi__misc__ctrls.html#ga44708b80e48984be099cd6eb11780dc3">ARM_SPI_ABORT_TRANSFER</a> as the control parameter. </p>
</div>
</div>
<a class="anchor" id="gaa24026b3822c10272e301f1505136ec2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t ARM_SPI_Transfer </td>
<td>(</td>
<td class="paramtype">const void * </td>
<td class="paramname"><em>data_out</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void * </td>
<td class="paramname"><em>data_in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>num</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start sending/receiving data to/from SPI transmitter/receiver. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">data_out</td><td>Pointer to buffer with data to send to SPI transmitter </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">data_in</td><td>Pointer to buffer for data to receive from SPI receiver </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">num</td><td>Number of data items to transfer </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_SPI_Transfer</b> transfers data via SPI. It synchronously sends data to the SPI transmitter and receives data from the SPI receiver.</p>
<p>The parameter <em>data_out</em> is a pointer to the buffer with data to send. <br/>
The parameter <em>data_in</em> is a pointer to the buffer which receives data. <br/>
The parameter <em>num</em> specifies the number of items to transfer. <br/>
The item size is defined by the data type which depends on the configured number of data bits.</p>
<p>Data type is:</p>
<ul>
<li><em>uint8_t</em> when configured for 1..8 data bits</li>
<li><em>uint16_t</em> when configured for 9..16 data bits</li>
<li><em>uint32_t</em> when configured for 17..32 data bits</li>
</ul>
<p>Calling the function <b>ARM_SPI_Transfer</b> only starts the transfer operation. The function is non-blocking and returns as soon as the driver has started the operation (driver typically configures DMA or the interrupt system for continuous transfer). When in slave mode, the operation is only registered and started when the master starts the transfer. During the operation it is not allowed to call this function or any other data transfer function again. Also the data buffers must stay allocated and the contents of unsent data must not be modified. When transfer operation is completed (requested number of items transferred), the <a class="el" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a> event is generated. Progress of transfer operation can also be monitored by reading the number of items already transferred by calling <a class="el" href="group__spi__interface__gr.html#gaaaecaaf4ec1922f22e7f9de63af5ccdb">ARM_SPI_GetDataCount</a>.</p>
<p>Status of the transmitter and receiver can also be monitored by calling the <a class="el" href="group__spi__interface__gr.html#ga60d33d8788a76c388cc36e066240b817">ARM_SPI_GetStatus</a> and checking the <em>busy</em> flag.</p>
<p>When in master mode and configured to monitor slave select and the slave select gets deactivated during transfer, then the SPI mode changes to inactive and the <a class="el" href="group__SPI__events.html#ga7eaa229003689aa18598273490b3e630">ARM_SPI_EVENT_MODE_FAULT</a> event is generated (instead of <a class="el" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a>).</p>
<p>When in slave mode but send/receive/transfer operation is not started and data is sent/requested by the master, then the <a class="el" href="group__SPI__events.html#ga8e63d99c80ea56de596a8d0a51fd8244">ARM_SPI_EVENT_DATA_LOST</a> event is generated.</p>
<p>Transfer operation can also be aborted by calling <a class="el" href="group__spi__interface__gr.html#gad18d229992598d6677bec250015e5d1a">ARM_SPI_Control</a> with <a class="el" href="group__spi__misc__ctrls.html#ga44708b80e48984be099cd6eb11780dc3">ARM_SPI_ABORT_TRANSFER</a> as the control parameter. </p>
</div>
</div>
<a class="anchor" id="gaaaecaaf4ec1922f22e7f9de63af5ccdb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t ARM_SPI_GetDataCount </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get transferred data count. </p>
<dl class="section return"><dt>Returns</dt><dd>number of data items transferred</dd></dl>
<p>The function <b>ARM_SPI_GetDataCount</b> returns the number of currently transferred data items during <a class="el" href="group__spi__interface__gr.html#gab2a303d1071e926280d50682f4808479">ARM_SPI_Send</a>, <a class="el" href="group__spi__interface__gr.html#ga726aff54e782ed9b47f7ba1280a3d8f6">ARM_SPI_Receive</a> and <a class="el" href="group__spi__interface__gr.html#gaa24026b3822c10272e301f1505136ec2">ARM_SPI_Transfer</a> operation. </p>
</div>
</div>
<a class="anchor" id="gad18d229992598d6677bec250015e5d1a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t ARM_SPI_Control </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>control</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>arg</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Control SPI Interface. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">control</td><td>Operation </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">arg</td><td>Argument of operation (optional) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>common <a class="el" href="group__execution__status.html">Status Error Codes</a> and driver specific <a class="el" href="group__spi__execution__status.html">Status Error Codes</a></dd></dl>
<p>The function <b>ARM_SPI_Control</b> controls the SPI interface settings and executes various operations.</p>
<p>The parameter <em>control</em> is a bit mask that specifies various operations.</p>
<ul>
<li>Controls form different categories can be ORed.</li>
<li>If one control is omitted, then the default value of that category is used.</li>
<li>Miscellaneous controls cannot be combined.</li>
</ul>
<p>The parameter <em>arg</em> provides (depending on the parameter <em>control</em>) additional information, for example the Bus Speed.</p>
<table class="cmtable">
<tr>
<th>Parameter <em>control</em> </th><th style="text-align:right">Bit </th><th>Category </th><th>Description </th></tr>
<tr>
<td><a class="el" href="group__spi__mode__ctrls.html#ga974e3d7c178b76b0540d7644b977bff3">ARM_SPI_MODE_INACTIVE</a> </td><td rowspan="5" style="text-align:right">0..7 </td><td rowspan="5"><a class="anchor" id="spi_mode_tab"></a>Mode Controls </td><td>Set SPI to inactive. </td></tr>
<tr>
<td><a class="el" href="group__spi__mode__ctrls.html#ga3143ef07c1607b9bc57e29df35cf2fa8">ARM_SPI_MODE_MASTER</a> </td><td>Set the SPI Master (Output on MOSI, and the Input on MISO); <em>arg</em> = Bus Speed in <span class="XML-Token">bps</span> </td></tr>
<tr>
<td><a class="el" href="group__spi__mode__ctrls.html#gaf34d849c7cde1151a768887f154e19bd">ARM_SPI_MODE_MASTER_SIMPLEX</a> </td><td>Set the SPI Master (Output and Input on MOSI); <em>arg</em> = Bus Speed in <span class="XML-Token">bps</span> </td></tr>
<tr>
<td><a class="el" href="group__spi__mode__ctrls.html#ga382b394c5e68f7d1206b837843732a3e">ARM_SPI_MODE_SLAVE</a> </td><td>Set the SPI Slave (Output on MISO, and the Input on MOSI) </td></tr>
<tr>
<td><a class="el" href="group__spi__mode__ctrls.html#ga9b113d8b336047e1c22f73ad44851fdf">ARM_SPI_MODE_SLAVE_SIMPLEX</a> </td><td>Set the SPI Slave (Output and Input on MISO) </td></tr>
<tr>
<td><a class="el" href="group__spi__frame__format__ctrls.html#gab4ac9a609c078d1e8332cf95da34e50e">ARM_SPI_CPOL0_CPHA0</a> (default) </td><td rowspan="6" style="text-align:right">8..11 </td><td rowspan="6">Clock Polarity <br/>
(Frame Format) </td><td>CPOL=<span class="XML-Token">0</span> and CPHA=<span class="XML-Token">0</span>: Clock Polarity 0, Clock Phase 0 </td></tr>
<tr>
<td><a class="el" href="group__spi__frame__format__ctrls.html#ga5498eb08c2ba8de2e1c2801428e79d71">ARM_SPI_CPOL0_CPHA1</a> </td><td>CPOL=<span class="XML-Token">0</span> and CPHA=<span class="XML-Token">1</span>: Clock Polarity 0, Clock Phase 1 </td></tr>
<tr>
<td><a class="el" href="group__spi__frame__format__ctrls.html#ga67193d9b5af1ec312a66d007c33b597f">ARM_SPI_CPOL1_CPHA0</a> </td><td>CPOL=<span class="XML-Token">1</span> and CPHA=<span class="XML-Token">0</span>: Clock Polarity 1, Clock Phase 0 </td></tr>
<tr>
<td><a class="el" href="group__spi__frame__format__ctrls.html#ga7fab572b2fec303e979e47eb2d13ca74">ARM_SPI_CPOL1_CPHA1</a> </td><td>CPOL=<span class="XML-Token">1</span> and CPHA=<span class="XML-Token">1</span>: Clock Polarity 1, Clock Phase 1 </td></tr>
<tr>
<td><a class="el" href="group__spi__frame__format__ctrls.html#ga225185710ba38848a489013ba4475915">ARM_SPI_TI_SSI</a> </td><td>Specifies that the frame format corresponds to the Texas Instruments Frame Format </td></tr>
<tr>
<td><a class="el" href="group__spi__frame__format__ctrls.html#ga44f481d32b9a9ea93673f05af82ccf86">ARM_SPI_MICROWIRE</a> </td><td>Specifies that the frame format corresponds to the National Microwire Frame Format </td></tr>
<tr>
<td><a class="el" href="group__spi__data__bits__ctrls.html#gaf6c099a1d67256a32010120c66c55250">ARM_SPI_DATA_BITS(n)</a> </td><td style="text-align:right">12..17 </td><td>Data Bits </td><td>Set the number of bits per SPI frame; range for <em>n</em> = <span class="XML-Token">1..32</span>. This is the minimum required parameter. </td></tr>
<tr>
<td><a class="el" href="group__spi__bit__order__ctrls.html#ga98228a708cbab6e214c7ac696f77dab6">ARM_SPI_MSB_LSB</a> (default) </td><td rowspan="2" style="text-align:right">18 </td><td rowspan="2">Bit Order </td><td>Set the bit order from MSB to LSB </td></tr>
<tr>
<td><a class="el" href="group__spi__bit__order__ctrls.html#ga41c53c3b396a89ce78018467e561aaaf">ARM_SPI_LSB_MSB</a> </td><td>Set the bit order from LSB to MSB </td></tr>
<tr>
<td><a class="el" href="group__spi__slave__select__mode__ctrls.html#gae19343adc7bd71408b51733171f99dc7">ARM_SPI_SS_MASTER_UNUSED</a> (default) </td><td rowspan="6" style="text-align:right">19..21 </td><td rowspan="6">Slave Select <br/>
when Master <div style="min-height:200px"> </div> Must be used with the corresponding master or slave controls from category <a href="#spi_mode_tab"><b>Mode Controls</b></a>. <div style="min-height:200px"> </div> Slave Select <br/>
when Slave </td><td>Set the Slave Select mode for the master to <b>Not used</b>. Used with Mode Control ARM_SPI_MODE_MASTER. Master does not drive or monitor the SS line. For example, when connecting to a single slave, which has the SS line connected to a fixed low level. </td></tr>
<tr>
<td><a class="el" href="group__spi__slave__select__mode__ctrls.html#gab5e319aa3f9d4d8c9ed92f0fe865f624">ARM_SPI_SS_MASTER_SW</a> </td><td>Set the Slave Select mode for the master to <b>Software controlled</b>. Used with Mode Control ARM_SPI_MODE_MASTER. The Slave Select line is configured as output and controlled via the Miscellaneous Control <a class="el" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>. By default, the line it is not active (high), and is not affected by transfer-, send-, or receive functions. </td></tr>
<tr>
<td><a class="el" href="group__spi__slave__select__mode__ctrls.html#ga07762709a40dc90aca85553f500c8761">ARM_SPI_SS_MASTER_HW_OUTPUT</a> </td><td>Set the Slave Select mode for the master to <b>Hardware controlled Output</b>. Used with Mode Control ARM_SPI_MODE_MASTER. The Slave Select line is configured as output and controlled by hardware. The line gets activated or deactivated automatically by the hardware for transfers and is not controlled by the Miscellaneous Control <a class="el" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>. When exactly the line is activated or deactivated is hardware dependent. Typically, the hardware will activate the line before starting the transfer and deactivate it after the transfer completes. Some hardware will leave the line activated until the SPI stays master. <dl class="section note"><dt>Note</dt><dd>Some devices require that the SS signal is strictly defined regarding transfers. Refer to the documentaiton of your device. </dd></dl>
</td></tr>
<tr>
<td><a class="el" href="group__spi__slave__select__mode__ctrls.html#ga8561bd0cc25ab2bb02b138c1c6a586cd">ARM_SPI_SS_MASTER_HW_INPUT</a> </td><td>Set the Slave Select mode for the master to <b>Hardware monitored Input</b>. Used with Mode Control ARM_SPI_MODE_MASTER. Used in multi-master configuration where a master does not drive the Slave Select when driving the bus, but rather monitors it. When another master activates this line, the active master backs off. This is called Mode Fault. Slave Select is configured as input and hardware only monitors the line. When the line is deactivated externally while we are master, it presents a Mode Fault (<a class="el" href="group__SPI__events.html#ga7eaa229003689aa18598273490b3e630">ARM_SPI_EVENT_MODE_FAULT</a>) and the SPI switches to inactive mode. </td></tr>
<tr>
<td><a class="el" href="group__spi__slave__select__mode__ctrls.html#ga2bd0d1f3ade2dc0cc48cc0593336ad70">ARM_SPI_SS_SLAVE_HW</a> (default) </td><td>Set the Slave Select mode for the slave to <b>Hardware monitored</b>. Used with Mode Control ARM_SPI_MODE_SLAVE. Hardware monitors the Slave Select line and accepts transfers only when the line is active. Transfers are ignored while the Slave Select line is inactive. </td></tr>
<tr>
<td><a class="el" href="group__spi__slave__select__mode__ctrls.html#gad371f6ba0d12a57bdcc3217c351abfb0">ARM_SPI_SS_SLAVE_SW</a> </td><td>Set the Slave Select mode for the slave to <b>Software controlled</b>. Used with Mode Control ARM_SPI_MODE_SLAVE. Used only when the Slave Select line is not used. For example, when a single master and slave are connected in the system then the Slave Select line is not needed. Software controls if the slave is responding or not (by default it is not responding). Software enables or disables transfers by using the Miscellaneous Control <a class="el" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a>. </td></tr>
<tr>
<td><a class="el" href="group__spi__misc__ctrls.html#ga5ef3d114979f3fd6010d0df16c2bf5c1">ARM_SPI_SET_BUS_SPEED</a> </td><td rowspan="5" style="text-align:right">0..21 </td><td rowspan="5">Miscellaneous Controls <br/>
(cannot be ORed) </td><td>Set the bus speed; <em>arg=</em> Bus Speed in <span class="XML-Token">bps</span> </td></tr>
<tr>
<td><a class="el" href="group__spi__misc__ctrls.html#gafc00fe35bb4c89b076d014b43168b2b3">ARM_SPI_GET_BUS_SPEED</a> </td><td>Get the bus speed; Retrun values >= <span class="XML-Token">0</span> reperesent the bus speed in <span class="XML-Token">bps</span>. Negative values are <a class="el" href="group__spi__execution__status.html">Status Error Codes</a>. </td></tr>
<tr>
<td><a class="el" href="group__spi__misc__ctrls.html#gae9861221dee78d52bd1522b7846535ce">ARM_SPI_SET_DEFAULT_TX_VALUE</a> </td><td>Set the default transmission value; the parameter <em>arg</em> sets the value </td></tr>
<tr>
<td><a class="el" href="group__spi__misc__ctrls.html#ga5776272b82decff92da003568540c92f">ARM_SPI_CONTROL_SS</a> </td><td>Control the Slave Select signal (SS); the values for the parameter <em>arg</em> are: <span class="XML-Token">ARM_SPI_SS_INACTIVE; ARM_SPI_SS_ACTIVE</span> </td></tr>
<tr>
<td><a class="el" href="group__spi__misc__ctrls.html#ga44708b80e48984be099cd6eb11780dc3">ARM_SPI_ABORT_TRANSFER</a> </td><td>Abort the current data transfer </td></tr>
</table>
<p><b>Example</b> </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__spi__interface__gr.html#structARM__DRIVER__SPI">ARM_DRIVER_SPI</a> Driver_SPI0;</div>
<div class="line"></div>
<div class="line"><span class="comment">// configure: SPI master | clock polarity=1, clock phase=1 | bits per frame=16 | bus speed : 1000000 </span></div>
<div class="line">status = Driver_SPI0.<a class="code" href="group__spi__interface__gr.html#a6e0f47a92f626a971c5197fca6545505">Control</a>(<a class="code" href="group__spi__mode__ctrls.html#ga3143ef07c1607b9bc57e29df35cf2fa8">ARM_SPI_MODE_MASTER</a> | </div>
<div class="line"> <a class="code" href="group__spi__frame__format__ctrls.html#ga7fab572b2fec303e979e47eb2d13ca74">ARM_SPI_CPOL1_CPHA1</a> | </div>
<div class="line"> <a class="code" href="group__spi__data__bits__ctrls.html#gaf6c099a1d67256a32010120c66c55250">ARM_SPI_DATA_BITS</a>(16), 1000000);</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ga60d33d8788a76c388cc36e066240b817"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="group__spi__interface__gr.html#structARM__SPI__STATUS">ARM_SPI_STATUS</a> ARM_SPI_GetStatus </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get SPI status. </p>
<dl class="section return"><dt>Returns</dt><dd>SPI status <a class="el" href="group__spi__interface__gr.html#structARM__SPI__STATUS">ARM_SPI_STATUS</a></dd></dl>
<p>The function <b>ARM_SPI_GetStatus</b> returns the current SPI interface status. </p>
</div>
</div>
<a class="anchor" id="ga505b2d787348d51351d38fee98ccba7e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void ARM_SPI_SignalEvent </td>
<td>(</td>
<td class="paramtype">uint32_t </td>
<td class="paramname"><em>event</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Signal SPI Events. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">event</td><td><a class="el" href="group__SPI__events.html">SPI Events</a> notification mask </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>none</dd></dl>
<p>The function <b>ARM_SPI_SignalEvent</b> is a callback function registered by the function <a class="el" href="group__spi__interface__gr.html#ga1a3c11ed523a4355cd91069527945906">ARM_SPI_Initialize</a>.</p>
<p>The parameter <em>event</em> indicates one or more events that occurred during driver operation. Each event is encoded in a separate bit and therefore it is possible to signal multiple events within the same call.</p>
<p>Not every event is necessarily generated by the driver. This depends on the implemented capabilities stored in the data fields of the structure <a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES">ARM_SPI_CAPABILITIES</a>, which can be retrieved with the function <a class="el" href="group__spi__interface__gr.html#gaf4823a11ab5efcd47c79b13801513ddc">ARM_SPI_GetCapabilities</a>.</p>
<p>The following events can be generated:</p>
<table class="cmtable">
<tr>
<th>Parameter <em>event</em> </th><th>Bit </th><th>Description </th><th>supported when <a class="el" href="group__spi__interface__gr.html#structARM__SPI__CAPABILITIES" title="SPI Driver Capabilities. ">ARM_SPI_CAPABILITIES</a> </th></tr>
<tr>
<td><a class="el" href="group__SPI__events.html#gaabdfc9e17641144cd50d36d15511a1b8">ARM_SPI_EVENT_TRANSFER_COMPLETE</a> </td><td>0 </td><td>Occurs after call to <a class="el" href="group__spi__interface__gr.html#gab2a303d1071e926280d50682f4808479">ARM_SPI_Send</a>, <a class="el" href="group__spi__interface__gr.html#ga726aff54e782ed9b47f7ba1280a3d8f6">ARM_SPI_Receive</a>, or <a class="el" href="group__spi__interface__gr.html#gaa24026b3822c10272e301f1505136ec2">ARM_SPI_Transfer</a> to indicate that all the data has been transferred. The driver is ready for the next transfer operation. </td><td><em>always supported</em> </td></tr>
<tr>
<td><a class="el" href="group__SPI__events.html#ga8e63d99c80ea56de596a8d0a51fd8244">ARM_SPI_EVENT_DATA_LOST</a> </td><td>1 </td><td>Occurs in slave mode when data is requested/sent by master but send/receive/transfer operation has not been started and indicates that data is lost. Occurs also in master mode when driver cannot transfer data fast enough. </td><td><em>always supported</em> </td></tr>
<tr>
<td><a class="el" href="group__SPI__events.html#ga7eaa229003689aa18598273490b3e630">ARM_SPI_EVENT_MODE_FAULT</a> </td><td>2 </td><td>Occurs in master mode when Slave Select is deactivated and indicates Master Mode Fault. The driver is ready for the next transfer operation. </td><td>data field <em>event_mode_fault</em> = <span class="XML-Token">1</span> </td></tr>
</table>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated on Wed Jul 10 2019 15:20:31 for CMSIS-Driver Version 2.7.1 by Arm Ltd. All rights reserved.
<!--
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6
-->
</li>
</ul>
</div>
</body>
</html>
|