Difference between revisions of "Component: SPI Slave (Comms: Interface)"
(2 intermediate revisions by the same user not shown) | |||
Line 86: | Line 86: | ||
{{Fcfile|SPI_Slave2.fcfx|SPI_Slave2}} | {{Fcfile|SPI_Slave2.fcfx|SPI_Slave2}} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
Line 94: | Line 100: | ||
==Macro reference== | ==Macro reference== | ||
− | === | + | ===GetChar=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetChar''' |
|- | |- | ||
− | | colspan="2" | General purpose SPI | + | | colspan="2" | General purpose SPI get byte macro |
|- | |- | ||
|- | |- | ||
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | |
− | |||
− | |||
− | |||
− | |||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===Initialise=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Activates the SPI peripheral and claims control over the I/O pins. |
|- | |- | ||
|- | |- | ||
− | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9- | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID |
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | === | + | ===SendChar=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendChar''' |
+ | |- | ||
+ | | colspan="2" | General purpose SPI send byte macro | ||
+ | |- | ||
|- | |- | ||
− | | | + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE |
+ | | width="90%" | Char | ||
|- | |- | ||
+ | | colspan="2" | Data byte to send | ||
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
Line 141: | Line 147: | ||
− | === | + | ===UnInitialise=== |
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
− | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UnInitialise''' |
|- | |- | ||
− | | colspan="2" | | + | | colspan="2" | Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O. |
|- | |- | ||
|- | |- | ||
Line 153: | Line 159: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
− | |||
− | |||
Latest revision as of 13:12, 7 February 2023
Author | Matrix Ltd |
Version | 1.0 |
Category | Comms: Interface |
Contents
SPI Slave component
Low level routines for controlling or interacting with an SPI interface. SPI or Serial Peripheral Interface is a bus used for board level communications between devices. A target microcontroller will usually have at least one hardware SPI peripheral built in.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_SPI_Slave.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_SPI_Slave.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Simple Master program that sends an incrementing test value to the SPI bus as well as outputting the value onto LEDs.
Simple Slave program that collects the value sent by the master and outputs the value onto LEDs. Allows the master slave comms to be compared to check that everything is working correctly.
Another simple example to buffer incoming SPI bytes sent by the master and output these to the LCD.
Macro reference
GetChar
![]() |
GetChar |
General purpose SPI get byte macro | |
![]() |
Return |
Initialise
![]() |
Initialise |
Activates the SPI peripheral and claims control over the I/O pins. | |
![]() |
Return |
SendChar
![]() |
SendChar |
General purpose SPI send byte macro | |
![]() |
Char |
Data byte to send | |
![]() |
Return |
UnInitialise
![]() |
UnInitialise |
Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O. | |
![]() |
Return |