Component: SPI (CAL) (Misc)

From Flowcode Help
Jump to navigationJump to search
Author Matrix TSL
Version 2.1
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.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples









Macro reference

GetConsoleHandle

Fc9-comp-macro.png GetConsoleHandle
Returns a handle to the console used by this component 
Fc9-h32-icon.png - HANDLE Return


GetList

Fc9-comp-macro.png GetList
returns Named property list 
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Return


GetValue

Fc9-comp-macro.png GetValue
Reads Named property Value.  
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Return


Master_Byte

Fc9-comp-macro.png Master_Byte
Sends and receives a data byte 
Fc9-u8-icon.png - BYTE DataOut
 
Fc9-u8-icon.png - BYTE Return


Master_Disable_CS

Fc9-comp-macro.png Master_Disable_CS
Outputs a high signal to the chip select pin to deselect the remote slave device. 
Fc9-void-icon.png - VOID Return


Master_Enable_CS

Fc9-comp-macro.png Master_Enable_CS
Outputs a low signal to the chip select pin to select the remote slave device. 
Fc9-void-icon.png - VOID Return


Master_Init

Fc9-comp-macro.png Master_Init
Initialise the Master 
Fc9-u8-icon.png - BYTE Return


Master_Transaction

Fc9-comp-macro.png 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 
Fc9-u8-icon.png - BYTE Buffer
 
Fc9-u16-icon.png - UINT Length
Number of bytes to transfer 
Fc9-u8-icon.png - BYTE Return


Master_Uninit

Fc9-comp-macro.png Master_Uninit
Uninitialise the Master 
Fc9-void-icon.png - VOID Return


Prv_TextConsole

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


SetPrescaler

Fc9-comp-macro.png SetPrescaler
Sets the prescaler value for the clock divider chain 
Fc9-u8-icon.png - BYTE Prescaler
 
Fc9-void-icon.png - VOID Return


SetValue

Fc9-comp-macro.png SetValue
Change Named property to new Value.  
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Value
 
Fc9-void-icon.png - VOID Return


Slave_Init

Fc9-comp-macro.png Slave_Init
Initialise the Slave 
Fc9-void-icon.png - VOID Return


Slave_RxByte

Fc9-comp-macro.png Slave_RxByte
Returns the data received from the SPI Master 
Fc9-u8-icon.png - BYTE Return


Slave_TxByte

Fc9-comp-macro.png Slave_TxByte
Sets the data to be transmitted to the SPI master. 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


Slave_Uninit

Fc9-comp-macro.png Slave_Uninit
Uninitialise the Slave 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-7-icon.png Component Enable
A global flag to enable or disable the SPI component from producing code. Useful for generating components with multiple communications options. 
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
SPI Channel selector 
Fc9-type-5-icon.png MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
Fc9-type-5-icon.png MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
Fc9-type-5-icon.png CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
Fc9-type-7-icon.png 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. 
Fc9-type-5-icon.png 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.  
Fc9-type-16-icon.png CS Polarity
 
Fc9-conn-icon.png Options
Fc9-type-16-icon.png Mode
Configures the mode of the SPI component. Currently only Master mode is supported. 
Fc9-type-16-icon.png Prescale
Prescale option selector 
Fc9-type-16-icon.png Clock Phase
Clock Phase (data change edge) selection 
Fc9-type-16-icon.png Clock Polarity
Clock Polarity setting, inactive (idle) state 
Fc9-type-16-icon.png Sample Point
Data bit read sample point 
Fc9-conn-icon.png Simulation
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically generated or not 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-16-icon.png 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