Component: SPI Slave (Comms: Interface)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.0 (Release)
Category Comms: Interface


Image 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.

Examples

Simple Master program that sends an incrementing test value to the SPI bus as well as outputting the value onto LEDs.

FC6 Icon.png SPI_Master


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.

FC6 Icon.png SPI_Slave


Another simple example to buffer incoming SPI bytes sent by the master and output these to the LCD.

FC6 Icon.png SPI_Slave2


Downloadable macro reference

SendChar

General purpose SPI send byte macro

Parameters

BYTE Char
Data byte to send


Return value

This call does not return a value


GetChar

General purpose SPI get byte macro

Parameters

This macro has no parameters


Return value

BYTE


UnInitialise

Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O.

Parameters

This macro has no parameters


Return value

This call does not return a value


Initialise

Activates the SPI peripheral and claims control over the I/O pins.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Channel

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi::CHANNEL.

SPI Channel selector

MOSI

This property is of type Single digital pin and can be referenced with the variable name cal_spi::MOSI.

SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.

MISO

This property is of type Single digital pin and can be referenced with the variable name cal_spi::MISO.

SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.

CLK

This property is of type Single digital pin and can be referenced with the variable name cal_spi::CLK.

SPI Clock Pin CLK - The Clock signal is driven by the SPI master.

Use Slave Select

This property is of type True or false and can be referenced with the variable name cal_spi::UseCS.

No additional information


CS / SS

This property is of type Single digital pin and can be referenced with the variable name cal_spi::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.

Clock Phase

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi::CKE.

Clock Phase (data change edge) selection

Clock Polarity

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi::CKP.

Clock Polarity setting, inactive (idle) state

Sample Point

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi::SMP.

Data bit read sample point

Label

This property is of type Line of text and can be referenced with the variable name label.

Label used to identify the component on the panel.

Scope Traces

This property is of type True or false and can be referenced with the variable name cal_spi::ScopeTraces.

Selects if the scope traces are automatically generated or not

Console Data

This property is of type True or false and can be referenced with the variable name cal_spi::ConsoleData.

Selects if the console data is automatically generated or not

Injector

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi::Injector.

No additional information