Difference between revisions of "Unit SPI"
Line 131: | Line 131: | ||
---- | ---- | ||
− | '' | + | |
+ | '''SPI properties''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSPIProperties = ^TSPIProperties;</code> | ||
+ | |||
+ | <code>TSPIProperties = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Flags:LongWord;</code> | ||
+ | | Device flags (eg SPI_FLAG_SLAVE) | ||
+ | |- | ||
+ | | <code>MaxSize:LongWord;</code> | ||
+ | | Maximum supported data transfer size | ||
+ | |- | ||
+ | | <code>MinClock:LongWord;</code> | ||
+ | | Minimum supported clock rate | ||
+ | |- | ||
+ | | <code>MaxClock:LongWord;</code> | ||
+ | | Maximum supported clock rate | ||
+ | |- | ||
+ | | <code>SelectCount:LongWord;</code> | ||
+ | | Number of chip selects supported | ||
+ | |- | ||
+ | | <code>Mode:LongWord;</code> | ||
+ | | Current mode (eg SPI_MODE_4WIRE) | ||
+ | |- | ||
+ | | <code>ClockRate:LongWord;</code> | ||
+ | | Current clock rate | ||
+ | |- | ||
+ | | <code>ClockPhase:LongWord;</code> | ||
+ | | Current clock phase (CPHA) (eg SPI_CLOCK_PHASE_LOW) | ||
+ | |- | ||
+ | | <code>ClockPolarity:LongWord;</code> | ||
+ | | Current clock polarity (CPOL) (eg SPI_CLOCK_POLARITY_LOW) | ||
+ | |- | ||
+ | | <code>SelectPolarity:LongWord;</code> | ||
+ | | Default chip select polarity (eg SPI_CS_POLARITY_LOW) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SPI chip select''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSPIChipSelect = ^TSPIChipSelect;</code> | ||
+ | |||
+ | <code>TSPIChipSelect = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Pin:LongWord;</code> | ||
+ | | The GPIO pin for this chip select (eg GPIO_PIN_46)(GPIO_PIN_UNKNOWN for internal) | ||
+ | |- | ||
+ | | <code>Mode:LongWord;</code> | ||
+ | | The mode for this chip select (eg SPI_MODE_0) | ||
+ | |- | ||
+ | | <code>Divider:LongWord;</code> | ||
+ | | The clock divider for this chip select (Used internally by drivers) | ||
+ | |- | ||
+ | | <code>ClockRate:LongWord;</code> | ||
+ | | The clock rate for this chip select | ||
+ | |- | ||
+ | | <code>ClockPhase:LongWord;</code> | ||
+ | | The clock phase (CPHA) for this chip select (eg SPI_CLOCK_PHASE_LOW) | ||
+ | |- | ||
+ | | <code>ClockPolarity:LongWord;</code> | ||
+ | | The clock polarity (CPOL) for this chip select (eg SPI_CLOCK_POLARITY_LOW) | ||
+ | |- | ||
+ | | <code>SelectPolarity:LongWord;</code> | ||
+ | | The chip select polarity for this chip select (eg SPI_CS_POLARITY_LOW) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SPI enumeration callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIEnumerate = function(SPI:PSPIDevice; Data:Pointer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI notification callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPINotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device start''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceStart = function(SPI:PSPIDevice; Mode,ClockRate,ClockPhase,ClockPolarity:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device stop''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceStop = function(SPI:PSPIDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device read''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceRead = function(SPI:PSPIDevice; ChipSelect:Word; Dest:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device write''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceWrite = function(SPI:PSPIDevice; ChipSelect:Word; Source:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device write read''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceWriteRead = function(SPI:PSPIDevice; ChipSelect:Word; Source,Dest:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device get mode''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceGetMode = function(SPI:PSPIDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device set mode''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceSetMode = function(SPI:PSPIDevice; Mode:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device get clock rate''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceGetClockRate = function(SPI:PSPIDevice; ChipSelect:Word):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device set clock rate''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceSetClockRate = function(SPI:PSPIDevice; ChipSelect:Word; ClockRate:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device get clock phase''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceGetClockPhase = function(SPI:PSPIDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device set clock phase''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceSetClockPhase = function(SPI:PSPIDevice; ClockPhase:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device get clock polarity''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceGetClockPolarity = function(SPI:PSPIDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device set clock polarity''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceSetClockPolarity = function(SPI:PSPIDevice; ClockPolarity:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device get select polarity''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceGetSelectPolarity = function(SPI:PSPIDevice; ChipSelect:Word):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device set select polarity''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceSetSelectPolarity = function(SPI:PSPIDevice; ChipSelect:Word; SelectPolarity:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device properties''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSPIDeviceProperties = function(SPI:PSPIDevice; Properties:PSPIProperties):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SPI device''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSPIDevice = ^TSPIDevice;</code> | ||
+ | |||
+ | <code>TSPIDevice = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Device Properties'' | ||
+ | |- | ||
+ | | <code>Device:TDevice;</code> | ||
+ | | The Device entry for this SPI | ||
+ | |- | ||
+ | |colspan="2"|''SPI Properties'' | ||
+ | |- | ||
+ | | <code>SPIId:LongWord;</code> | ||
+ | | Unique Id of this SPI in the SPI table | ||
+ | |- | ||
+ | | <code>SPIState:LongWord;</code> | ||
+ | | SPI state (eg SPI_STATE_ENABLED) | ||
+ | |- | ||
+ | | <code>SPIMode:LongWord;</code> | ||
+ | | SPI mode (eg SPI_MODE_4WIRE) | ||
+ | |- | ||
+ | | <code>DeviceStart:TSPIDeviceStart;</code> | ||
+ | | A Device specific DeviceStart method implementing the standard SPI device interface (Mandatory) | ||
+ | |- | ||
+ | | <code>DeviceStop:TSPIDeviceStop;</code> | ||
+ | | A Device specific DeviceStop method implementing the standard SPI device interface (Mandatory) | ||
+ | |- | ||
+ | | <code>DeviceRead:TSPIDeviceRead;</code> | ||
+ | | A Device specific DeviceRead method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceWrite:TSPIDeviceWrite;</code> | ||
+ | | A Device specific DeviceWrite method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceWriteRead:TSPIDeviceWriteRead;</code> | ||
+ | | A Device specific DeviceWriteRead method implementing the standard SPI device interface (Mandatory) | ||
+ | |- | ||
+ | | <code>DeviceGetMode:TSPIDeviceGetMode;</code> | ||
+ | | A Device specific DeviceGetMode method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetMode:TSPIDeviceSetMode;</code> | ||
+ | | A Device specific DeviceSetMode method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetClockRate:TSPIDeviceGetClockRate;</code> | ||
+ | | A Device specific DeviceGetClockRate method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetClockRate:TSPIDeviceSetClockRate;</code> | ||
+ | | A Device specific DeviceSetClockRate method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetClockPhase:TSPIDeviceGetClockPhase;</code> | ||
+ | | A Device specific DeviceGetClockPhase method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetClockPhase:TSPIDeviceSetClockPhase;</code> | ||
+ | | A Device specific DeviceSetClockPhase method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetClockPolarity:TSPIDeviceGetClockPolarity;</code> | ||
+ | | A Device specific DeviceGetClockPolarity method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetClockPolarity:TSPIDeviceSetClockPolarity;</code> | ||
+ | | A Device specific DeviceSetClockPolarity method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetSelectPolarity:TSPIDeviceGetSelectPolarity;</code> | ||
+ | | A Device specific DeviceGetSelectPolarity method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetSelectPolarity:TSPIDeviceSetSelectPolarity;</code> | ||
+ | | A Device specific DeviceSetSelectPolarity method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceProperties:TSPIDeviceProperties;</code> | ||
+ | | A Device specific DeviceProperties method implementing the standard SPI device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>TransferCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TransferErrors:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Device lock | ||
+ | |- | ||
+ | | <code>Wait:TSemaphoreHandle;</code> | ||
+ | | Write/Read wait event | ||
+ | |- | ||
+ | | <code>Divider:LongWord;</code> | ||
+ | | Clock divider (Used internally by drivers) | ||
+ | |- | ||
+ | | <code>ClockRate:LongWord;</code> | ||
+ | | Clock rate (Hz) | ||
+ | |- | ||
+ | | <code>ClockPhase:LongWord;</code> | ||
+ | | Clock Phase (eg SPI_CLOCK_PHASE_LOW) | ||
+ | |- | ||
+ | | <code>ClockPolarity:LongWord;</code> | ||
+ | | Clock Polarity (eg SPI_CLOCK_POLARITY_LOW) | ||
+ | |- | ||
+ | | <code>SelectPolarity:LongWord;</code> | ||
+ | | Default Chip Select Polarity (eg SPI_CS_POLARITY_LOW) | ||
+ | |- | ||
+ | | <code>Properties:TSPIProperties;</code> | ||
+ | | Device properties | ||
+ | |- | ||
+ | | <code>ChipSelects:array[0..SPI_CS_MAX] of TSPIChipSelect;</code> | ||
+ | | Chip selects | ||
+ | |- | ||
+ | |colspan="2"|''Internal Properties'' | ||
+ | |- | ||
+ | | <code>Prev:PSPIDevice;</code> | ||
+ | | Previous entry in SPI table | ||
+ | |- | ||
+ | | <code>Next:PSPIDevice;</code> | ||
+ | | Next entry in SPI table | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 03:33, 25 January 2017
Return to Unit Reference
Contents
[hide]Description
Ultibo SPI interface unit
SPI (Serial Peripheral Interface) is a synchronous serial bus for communication with peripheral components.
The SPI protocol is not defined by any actual standard but some psuedo standards exist with all of the available devices. SPI is a master-slave protocol where the master asserts the chip selectline (CS) to select the slave device before sending data one byte at a time. For every byte written to the bus by the master the selected slave returns a byte as well so for every write there is an equivalent read. SPI can also operate in either 4 wire (standard) or 3 wire(bidirectional) modes.
Due to the lack of formal standards and the range of devices that exist various options are provided to allow setting clock phase and polarity as well chip select polarity.
For the purpose of this interface a device is the SPI controller attached to the local system and may be either a master or a slave. Since the protocol does not include any form of enumeration or identification the interface does not attempt to represent the devices connected to the bus, any driver written to communicate with a connected SPI device should know (or allow configuration of) the chip select for the for the device and the specific message format required for that device.
Constants
SPI_*
SPI_TYPE_*
SPI_STATE_*
SPI_FLAG_*
SPI_TRANSFER_*
SPI_LOG_*
Type definitions
SPI properties
SPI chip select
SPI enumeration callback
TSPIEnumerate = function(SPI:PSPIDevice; Data:Pointer):LongWord;
|
SPI notification callback
TSPINotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
|
SPI device start
TSPIDeviceStart = function(SPI:PSPIDevice; Mode,ClockRate,ClockPhase,ClockPolarity:LongWord):LongWord;
|
SPI device stop
TSPIDeviceStop = function(SPI:PSPIDevice):LongWord;
|
SPI device read
TSPIDeviceRead = function(SPI:PSPIDevice; ChipSelect:Word; Dest:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
|
SPI device write
TSPIDeviceWrite = function(SPI:PSPIDevice; ChipSelect:Word; Source:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
|
SPI device write read
TSPIDeviceWriteRead = function(SPI:PSPIDevice; ChipSelect:Word; Source,Dest:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
|
SPI device get mode
TSPIDeviceGetMode = function(SPI:PSPIDevice):LongWord;
|
SPI device set mode
TSPIDeviceSetMode = function(SPI:PSPIDevice; Mode:LongWord):LongWord;
|
SPI device get clock rate
TSPIDeviceGetClockRate = function(SPI:PSPIDevice; ChipSelect:Word):LongWord;
|
SPI device set clock rate
TSPIDeviceSetClockRate = function(SPI:PSPIDevice; ChipSelect:Word; ClockRate:LongWord):LongWord;
|
SPI device get clock phase
TSPIDeviceGetClockPhase = function(SPI:PSPIDevice):LongWord;
|
SPI device set clock phase
TSPIDeviceSetClockPhase = function(SPI:PSPIDevice; ClockPhase:LongWord):LongWord;
|
SPI device get clock polarity
TSPIDeviceGetClockPolarity = function(SPI:PSPIDevice):LongWord;
|
SPI device set clock polarity
TSPIDeviceSetClockPolarity = function(SPI:PSPIDevice; ClockPolarity:LongWord):LongWord;
|
SPI device get select polarity
TSPIDeviceGetSelectPolarity = function(SPI:PSPIDevice; ChipSelect:Word):LongWord;
|
SPI device set select polarity
TSPIDeviceSetSelectPolarity = function(SPI:PSPIDevice; ChipSelect:Word; SelectPolarity:LongWord):LongWord;
|
SPI device properties
TSPIDeviceProperties = function(SPI:PSPIDevice; Properties:PSPIProperties):LongWord;
|
SPI device
Public variables
SPI logging
SPI_DEFAULT_LOG_LEVEL:LongWord = SPI_LOG_LEVEL_DEBUG;
|
Minimum level for SPI messages. Only messages with level greater than or equal to this will be printed. |
SPI_LOG_ENABLED:Boolean;
|
Function declarations
Initialization functions
SPI functions
function SPIDeviceStart(SPI:PSPIDevice; Mode,ClockRate,ClockPhase,ClockPolarity:LongWord):LongWord;
function SPIDeviceStop(SPI:PSPIDevice):LongWord;
function SPIDeviceRead(SPI:PSPIDevice; ChipSelect:Word; Dest:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
function SPIDeviceWrite(SPI:PSPIDevice; ChipSelect:Word; Source:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
function SPIDeviceWriteRead(SPI:PSPIDevice; ChipSelect:Word; Source,Dest:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
function SPIDeviceGetMode(SPI:PSPIDevice):LongWord;
function SPIDeviceSetMode(SPI:PSPIDevice; Mode:LongWord):LongWord;
function SPIDeviceGetClockRate(SPI:PSPIDevice; ChipSelect:Word):LongWord;
function SPIDeviceSetClockRate(SPI:PSPIDevice; ChipSelect:Word; ClockRate:LongWord):LongWord;
function SPIDeviceGetClockPhase(SPI:PSPIDevice):LongWord;
function SPIDeviceSetClockPhase(SPI:PSPIDevice; ClockPhase:LongWord):LongWord;
function SPIDeviceGetClockPolarity(SPI:PSPIDevice):LongWord;
function SPIDeviceSetClockPolarity(SPI:PSPIDevice; ClockPolarity:LongWord):LongWord;
function SPIDeviceGetSelectPolarity(SPI:PSPIDevice; ChipSelect:Word):LongWord;
function SPIDeviceSetSelectPolarity(SPI:PSPIDevice; ChipSelect:Word; SelectPolarity:LongWord):LongWord;
function SPIDeviceProperties(SPI:PSPIDevice; Properties:PSPIProperties):LongWord;
function SPIDeviceDestroy(SPI:PSPIDevice):LongWord;
function SPIDeviceRegister(SPI:PSPIDevice):LongWord;
function SPIDeviceDeregister(SPI:PSPIDevice):LongWord;
function SPIDeviceFindByName(const Name:String):PSPIDevice; inline;
function SPIDeviceFindByDescription(const Description:String):PSPIDevice; inline;
function SPIDeviceEnumerate(Callback:TSPIEnumerate; Data:Pointer):LongWord;
function SPIDeviceNotification(SPI:PSPIDevice; Callback:TSPINotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
RTL SPI functions
function SysSPIStart(Mode,ClockRate,ClockPhase,ClockPolarity:LongWord):LongWord;
function SysSPIStop:LongWord;
function SysSPIRead(ChipSelect:Word; Dest:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function SysSPIWrite(ChipSelect:Word; Source:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function SysSPIWriteRead(ChipSelect:Word; Source,Dest:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function SysSPIGetMode:LongWord;
function SysSPISetMode(Mode:LongWord):LongWord;
function SysSPIGetClockRate(ChipSelect:Word):LongWord;
function SysSPISetClockRate(ChipSelect:Word; ClockRate:LongWord):LongWord;
function SysSPIGetClockPhase:LongWord;
function SysSPISetClockPhase(ClockPhase:LongWord):LongWord;
function SysSPIGetClockPolarity:LongWord;
function SysSPISetClockPolarity(ClockPolarity:LongWord):LongWord;
function SysSPIGetSelectPolarity(ChipSelect:Word):LongWord;
</div></div>
function SysSPISetSelectPolarity(ChipSelect:Word; SelectPolarity:LongWord):LongWord;
SPI helper functions
function SPIDeviceGetDefault:PSPIDevice; inline;
function SPIDeviceSetDefault(SPI:PSPIDevice):LongWord;
function SPIDeviceCheck(SPI:PSPIDevice):PSPIDevice;
procedure SPILog(Level:LongWord; SPI:PSPIDevice; const AText:String);
procedure SPILogInfo(SPI:PSPIDevice; const AText:String); inline;
procedure SPILogError(SPI:PSPIDevice; const AText:String); inline;
procedure SPILogDebug(SPI:PSPIDevice; const AText:String); inline;
function SPISelectPolarityToString(Polarity:LongWord):String;
Return to Unit Reference