Jump to content

Component: SPI (CAL) (Misc): Difference between revisions

From Flowcode Help
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
m Text replacement - "style="background-color:#EAE1EA; color:#4B008D;"" to "class="mtx-class-propfolder""
Line 367: Line 367:
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
| width="90%" class="mtx-class-propfolder" | Connections
|-
|-
|-
|-
Line 406: Line 406:
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Options
| width="90%" class="mtx-class-propfolder" | Options
|-
|-
|-
|-
Line 435: Line 435:
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-
|-
|-

Revision as of 14:36, 13 July 2026

Author Matrix TSL
Version 21.21
Category Misc


SPI component

CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. A low level implementation giving direct access to the Serial Peripheral Interface peripheral.

Version information

Library Version, Component Version, Date, Author, Info
15, 2.1, 04-11-24, BR, Added pin caption to the remap port pin selection property
16, 2.2, 04-11-24, BR, Cleaned up pin caption from none remap port pin property
17, 2.2, 04-11-24, BR, Minor change to source to reflect change to I2C
21, 21.0, 28-04-25, MW, Minor change sim only to prevent chars FCD Helper from appearing on the display

Detailed description

No detailed description exists yet for this component

Examples

No additional examples









Macro reference

GetConsoleHandle

GetConsoleHandle
Returns a handle to the console used by this component 
- HANDLE Return


GetList

GetList
returns Named property list 
- STRING Name
 
- STRING Return


GetValue

GetValue
Reads Named property Value.  
- STRING Name
 
- STRING Return


Master_Byte

Master_Byte
Sends and receives a data byte 
- BYTE DataOut
 
- BYTE Return


Master_Disable_CS

Master_Disable_CS
Outputs a high signal to the chip select pin to deselect the remote slave device. 
- VOID Return


Master_Enable_CS

Master_Enable_CS
Outputs a low signal to the chip select pin to select the remote slave device. 
- VOID Return


Master_Init

Master_Init
Initialise the Master 
- BYTE Return


Master_Transaction

Master_Transaction
Sends and receives data bytes via the SPI channel. The Buffer is to contain the data to be sent, and is overwritten by the retuning data from the device. Returns 1 for success, 0 for failure 
- BYTE Buffer
 
- UINT Length
Number of bytes to transfer 
- BYTE Return


Master_Uninit

Master_Uninit
Uninitialise the Master 
- VOID Return


Prv_TextConsole

Prv_TextConsole
Send text to the SPI console. Exposed as part of the CAL_SPI component to allow none AutoCS pins and other. 
- STRING str
 
- BYTE Colour
0=Default, 1=TX, 2=RX 
- BYTE AppendTimestamp
0=Don't Append / 1=Do Append 
- VOID Return


SetPrescaler

SetPrescaler
Sets the prescaler value for the clock divider chain 
- BYTE Prescaler
 
- VOID Return


SetValue

SetValue
Change Named property to new Value.  
- STRING Name
 
- STRING Value
 
- VOID Return


Slave_Init

Slave_Init
Initialise the Slave 
- VOID Return


Slave_RxByte

Slave_RxByte
Returns the data received from the SPI Master 
- BYTE Return


Slave_TxByte

Slave_TxByte
Sets the data to be transmitted to the SPI master. 
- BYTE Data
 
- VOID Return


Slave_Uninit

Slave_Uninit
Uninitialise the Slave 
- VOID Return


Property reference

Properties
Component Enable
A global flag to enable or disable the SPI component from producing code. Useful for generating components with multiple communications options. 
Connections
Channel
SPI Channel selector 
MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
Use Auto CS
Allow the SPI component to manage the CS pin for us in Master mode. On initialise the CS pin is automatically set high to disable the remote SPI device. Set to No if you want to create a component with multiple CS pins or if you want to manage the CS pin yourself. 
CS / SS
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
CS Polarity
 
Options
Mode
Configures the mode of the SPI component. Currently only Master mode is supported. 
Prescale
Prescale option selector 
Clock Phase
Clock Phase (data change edge) selection 
Clock Polarity
Clock Polarity setting, inactive (idle) state 
Sample Point
Data bit read sample point 
Simulation
Scope Traces
Selects if the scope traces are automatically generated or not 
Console Data
Selects if the console data is automatically generated or not 
API
Selects the API Slave to use to send and receive real world SPI data during simulation. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_SPI.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_SPI.fcfx