![]() |
Ultibo API
C/C++ API for Ultibo Core
|
Go to the source code of this file.
Data Structures | |
| struct | _SPI_PROPERTIES |
| struct | _SPI_CHIP_SELECT |
| struct | _SPI_DEVICE |
Macros | |
| #define | SPI_NAME_PREFIX "SPI" |
| Name prefix for SPI Devices. | |
| #define | SPISLAVE_NAME_PREFIX "SPISlave" |
| Name prefix for SPI Slave Devices. | |
| #define | SPI_TYPE_NONE 0 |
| #define | SPI_TYPE_MASTER 1 |
| #define | SPI_TYPE_SLAVE 2 |
| #define | SPI_TYPE_MAX 2 |
| #define | SPI_STATE_DISABLED 0 |
| #define | SPI_STATE_ENABLED 1 |
| #define | SPI_STATE_MAX 1 |
| #define | SPI_FLAG_NONE 0x00000000 |
| #define | SPI_FLAG_SLAVE 0x00000001 |
| Device is a slave not a master. | |
| #define | SPI_FLAG_4WIRE 0x00000002 |
| Device supports 4 wire operation (CS/MISO/MOSI/SCLK). | |
| #define | SPI_FLAG_3WIRE 0x00000004 |
| Device supports 3 wire operation (CS/MIMO/SCLK). | |
| #define | SPI_FLAG_LOSSI 0x00000008 |
| Device supports LoSSI (Low Speed Serial) mode (CS/SCL/SDA). | |
| #define | SPI_FLAG_CPOL 0x00000010 |
| Device supports Clock Polarity setting. | |
| #define | SPI_FLAG_CPHA 0x00000020 |
| Device supports Clock Phase setting. | |
| #define | SPI_FLAG_CSPOL 0x00000040 |
| Device supports Chip Select Polarity setting. | |
| #define | SPI_FLAG_NO_CS 0x00000080 |
| Device supports Chip Select None (CS handled externally). | |
| #define | SPI_FLAG_DMA 0x00000100 |
| Device supports DMA transfers. | |
| #define | SPI_TRANSFER_NONE 0x00000000 |
| #define | SPI_TRANSFER_DMA 0x00000001 |
| Use DMA for transfer (Write/Read) (If supported) (Note: Buffers must be DMA compatible). | |
| #define | SPI_TRANSFER_PIO 0x00000002 |
| Use PIO (Polling) for transfer (Write/Read). | |
| #define | SPI_TRANSFER_DELAY 0x00000004 |
| Add a delay after each byte written (Write/Read) (Note: Only available with PIO transfer unless provided directly by hardware). | |
Typedefs | |
| typedef struct _SPI_PROPERTIES | SPI_PROPERTIES |
| typedef struct _SPI_CHIP_SELECT | SPI_CHIP_SELECT |
| typedef struct _SPI_DEVICE | SPI_DEVICE |
| typedef uint32_t STDCALL(* | spi_enumerate_cb) (SPI_DEVICE *spi, void *data) |
| typedef uint32_t STDCALL(* | spi_notification_cb) (DEVICE *device, void *data, uint32_t notification) |
| typedef uint32_t STDCALL(* | spi_device_start_proc) (SPI_DEVICE *spi, uint32_t mode, uint32_t clockrate, uint32_t clockphase, uint32_t clockpolarity) |
| typedef uint32_t STDCALL(* | spi_device_stop_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* | spi_device_read_proc) (SPI_DEVICE *spi, uint16_t chipselect, void *dest, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* | spi_device_write_proc) (SPI_DEVICE *spi, uint16_t chipselect, void *source, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* | spi_device_write_read_proc) (SPI_DEVICE *spi, uint16_t chipselect, void *source, void *dest, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* | spi_device_get_mode_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* | spi_device_set_mode_proc) (SPI_DEVICE *spi, uint32_t mode) |
| typedef uint32_t STDCALL(* | spi_device_get_clock_rate_proc) (SPI_DEVICE *spi, uint16_t chipselect) |
| typedef uint32_t STDCALL(* | spi_device_set_clock_rate_proc) (SPI_DEVICE *spi, uint16_t chipselect, uint32_t clockrate) |
| typedef uint32_t STDCALL(* | spi_device_get_clock_phase_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* | spi_device_set_clock_phase_proc) (SPI_DEVICE *spi, uint32_t clockphase) |
| typedef uint32_t STDCALL(* | spi_device_get_clock_polarity_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* | spi_device_set_clock_polarity_proc) (SPI_DEVICE *spi, uint32_t clockpolarity) |
| typedef uint32_t STDCALL(* | spi_device_get_select_polarity_proc) (SPI_DEVICE *spi, uint16_t chipselect) |
| typedef uint32_t STDCALL(* | spi_device_set_select_polarity_proc) (SPI_DEVICE *spi, uint16_t chipselect, uint32_t selectpolarity) |
| typedef uint32_t STDCALL(* | spi_device_get_byte_delay_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* | spi_device_set_byte_delay_proc) (SPI_DEVICE *spi, uint32_t delay) |
| typedef uint32_t STDCALL(* | spi_device_get_properties_proc) (SPI_DEVICE *spi, SPI_PROPERTIES *properties) |
Functions | |
| uint32_t STDCALL | spi_device_start (SPI_DEVICE *spi, uint32_t mode, uint32_t clockrate, uint32_t clockphase, uint32_t clockpolarity) |
| Start the specified SPI device ready for writing and reading. | |
| uint32_t STDCALL | spi_device_stop (SPI_DEVICE *spi) |
| Stop the specified SPI device and terminate writing and reading. | |
| uint32_t STDCALL | spi_device_read (SPI_DEVICE *spi, uint16_t chipselect, void *dest, uint32_t size, uint32_t flags, uint32_t *count) |
| Read data from the specified SPI device Because SPI writes and then reads for each byte, dummy data will be written for each byte to be read. | |
| uint32_t STDCALL | spi_device_write (SPI_DEVICE *spi, uint16_t chipselect, void *source, uint32_t size, uint32_t flags, uint32_t *count) |
| Write data to the specified SPI device Because SPI writes and then reads for each byte, received data will be discarded for each byte written. | |
| uint32_t STDCALL | spi_device_write_read (SPI_DEVICE *spi, uint16_t chipselect, void *source, void *dest, uint32_t size, uint32_t flags, uint32_t *count) |
| Write data to and Read data from the specified SPI device in one operation Because SPI writes and then reads for each byte, both the source and dest buffers must be the same size. | |
| uint32_t STDCALL | spi_device_get_mode (SPI_DEVICE *spi) |
| Get the device mode of the specified SPI device. | |
| uint32_t STDCALL | spi_device_set_mode (SPI_DEVICE *spi, uint32_t mode) |
| Set the device mode for the specified SPI device. | |
| uint32_t STDCALL | spi_device_get_clock_rate (SPI_DEVICE *spi, uint16_t chipselect) |
| Get the clock rate of the specified SPI device. | |
| uint32_t STDCALL | spi_device_set_clock_rate (SPI_DEVICE *spi, uint16_t chipselect, uint32_t clockrate) |
| Set the clock rate for the specified SPI device. | |
| uint32_t STDCALL | spi_device_get_clock_phase (SPI_DEVICE *spi) |
| Get the clock phase of the specified SPI device. | |
| uint32_t STDCALL | spi_device_set_clock_phase (SPI_DEVICE *spi, uint32_t clockphase) |
| Set the clock phase for the specified SPI device. | |
| uint32_t STDCALL | spi_device_get_clock_polarity (SPI_DEVICE *spi) |
| Get the clock polarity of the specified SPI device. | |
| uint32_t STDCALL | spi_device_set_clock_polarity (SPI_DEVICE *spi, uint32_t clockpolarity) |
| Set the clock polarity for the specified SPI device. | |
| uint32_t STDCALL | spi_device_get_select_polarity (SPI_DEVICE *spi, uint16_t chipselect) |
| Get the chip select polarity of the specified SPI device. | |
| uint32_t STDCALL | spi_device_set_select_polarity (SPI_DEVICE *spi, uint16_t chipselect, uint32_t selectpolarity) |
| Set the chip select polarity for the specified SPI device. | |
| uint32_t STDCALL | spi_device_get_byte_delay (SPI_DEVICE *spi) |
| Get the delay between bytes written for the specified SPI device. | |
| uint32_t STDCALL | spi_device_set_byte_delay (SPI_DEVICE *spi, uint32_t delay) |
| Set the delay between bytes written for the specified SPI device. | |
| uint32_t STDCALL | spi_device_properties (SPI_DEVICE *spi, SPI_PROPERTIES *properties) |
| Get the properties for the specified SPI device. | |
| uint32_t STDCALL | spi_device_get_properties (SPI_DEVICE *spi, SPI_PROPERTIES *properties) |
| Get the properties for the specified SPI device. | |
| SPI_DEVICE *STDCALL | spi_device_create (void) |
| Create a new SPI entry. | |
| SPI_DEVICE *STDCALL | spi_device_create_ex (uint32_t size) |
| Create a new SPI entry. | |
| uint32_t STDCALL | spi_device_destroy (SPI_DEVICE *spi) |
| Destroy an existing SPI entry. | |
| uint32_t STDCALL | spi_device_register (SPI_DEVICE *spi) |
| Register a new SPI in the SPI table. | |
| uint32_t STDCALL | spi_device_deregister (SPI_DEVICE *spi) |
| Deregister an SPI from the SPI table. | |
| SPI_DEVICE *STDCALL | spi_device_find (uint32_t spiid) |
| Find an SPI device by ID in the SPI table. | |
| SPI_DEVICE *STDCALL | spi_device_find_by_name (const char *name) |
| Find an SPI device by name in the device table. | |
| SPI_DEVICE *STDCALL | spi_device_find_by_description (const char *description) |
| Find an SPI device by description in the device table. | |
| uint32_t STDCALL | spi_device_enumerate (spi_enumerate_cb callback, void *data) |
| Enumerate all SPI devices in the SPI table. | |
| uint32_t STDCALL | spi_device_notification (SPI_DEVICE *spi, spi_notification_cb callback, void *data, uint32_t notification, uint32_t flags) |
| Register a notification for SPI device changes. | |
| uint32_t STDCALL | spi_get_count (void) |
| Get the current SPI count. | |
| SPI_DEVICE *STDCALL | spi_device_get_default (void) |
| Get the current default SPI device. | |
| uint32_t STDCALL | spi_device_set_default (SPI_DEVICE *spi) |
| Set the current default SPI device. | |
| SPI_DEVICE *STDCALL | spi_device_check (SPI_DEVICE *spi) |
| Check if the supplied SPI is in the SPI table. | |
| uint32_t STDCALL | spi_type_to_string (uint32_t spitype, char *string, uint32_t len) |
| Convert an SPI type value to a string. | |
| uint32_t STDCALL | spi_state_to_string (uint32_t spistate, char *string, uint32_t len) |
| Convert an SPI state value to a string. | |
| uint32_t STDCALL | spi_chip_select_to_string (uint16_t chipselect, char *string, uint32_t len) |
| uint32_t STDCALL | spi_mode_to_string (uint32_t mode, char *string, uint32_t len) |
| uint32_t STDCALL | spi_clock_phase_to_string (uint32_t phase, char *string, uint32_t len) |
| uint32_t STDCALL | spi_clock_polarity_to_string (uint32_t polarity, char *string, uint32_t len) |
| uint32_t STDCALL | spi_select_polarity_to_string (uint32_t polarity, char *string, uint32_t len) |
| #define SPI_NAME_PREFIX "SPI" |
Name prefix for SPI Devices.
SPI specific constants
| #define SPISLAVE_NAME_PREFIX "SPISlave" |
Name prefix for SPI Slave Devices.
| #define SPI_TYPE_NONE 0 |
SPI Device Types
| #define SPI_TYPE_MASTER 1 |
| #define SPI_TYPE_SLAVE 2 |
| #define SPI_TYPE_MAX 2 |
| #define SPI_STATE_DISABLED 0 |
SPI Device States
| #define SPI_STATE_ENABLED 1 |
| #define SPI_STATE_MAX 1 |
| #define SPI_FLAG_NONE 0x00000000 |
SPI Device Flags
| #define SPI_FLAG_SLAVE 0x00000001 |
Device is a slave not a master.
| #define SPI_FLAG_4WIRE 0x00000002 |
Device supports 4 wire operation (CS/MISO/MOSI/SCLK).
| #define SPI_FLAG_3WIRE 0x00000004 |
Device supports 3 wire operation (CS/MIMO/SCLK).
| #define SPI_FLAG_LOSSI 0x00000008 |
Device supports LoSSI (Low Speed Serial) mode (CS/SCL/SDA).
| #define SPI_FLAG_CPOL 0x00000010 |
Device supports Clock Polarity setting.
| #define SPI_FLAG_CPHA 0x00000020 |
Device supports Clock Phase setting.
| #define SPI_FLAG_CSPOL 0x00000040 |
Device supports Chip Select Polarity setting.
| #define SPI_FLAG_NO_CS 0x00000080 |
Device supports Chip Select None (CS handled externally).
| #define SPI_FLAG_DMA 0x00000100 |
Device supports DMA transfers.
| #define SPI_TRANSFER_NONE 0x00000000 |
SPI Transfer Flags
| #define SPI_TRANSFER_DMA 0x00000001 |
Use DMA for transfer (Write/Read) (If supported) (Note: Buffers must be DMA compatible).
| #define SPI_TRANSFER_PIO 0x00000002 |
Use PIO (Polling) for transfer (Write/Read).
| #define SPI_TRANSFER_DELAY 0x00000004 |
Add a delay after each byte written (Write/Read) (Note: Only available with PIO transfer unless provided directly by hardware).
| typedef struct _SPI_PROPERTIES SPI_PROPERTIES |
SPI specific types SPI Properties
| typedef struct _SPI_CHIP_SELECT SPI_CHIP_SELECT |
SPI Chip Select
| typedef struct _SPI_DEVICE SPI_DEVICE |
SPI Device
| typedef uint32_t STDCALL(* spi_enumerate_cb) (SPI_DEVICE *spi, void *data) |
SPI Enumeration Callback
SPI Notification Callback
| typedef uint32_t STDCALL(* spi_device_start_proc) (SPI_DEVICE *spi, uint32_t mode, uint32_t clockrate, uint32_t clockphase, uint32_t clockpolarity) |
SPI Device Methods
| typedef uint32_t STDCALL(* spi_device_stop_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* spi_device_read_proc) (SPI_DEVICE *spi, uint16_t chipselect, void *dest, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* spi_device_write_proc) (SPI_DEVICE *spi, uint16_t chipselect, void *source, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* spi_device_write_read_proc) (SPI_DEVICE *spi, uint16_t chipselect, void *source, void *dest, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* spi_device_get_mode_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* spi_device_set_mode_proc) (SPI_DEVICE *spi, uint32_t mode) |
| typedef uint32_t STDCALL(* spi_device_get_clock_rate_proc) (SPI_DEVICE *spi, uint16_t chipselect) |
| typedef uint32_t STDCALL(* spi_device_set_clock_rate_proc) (SPI_DEVICE *spi, uint16_t chipselect, uint32_t clockrate) |
| typedef uint32_t STDCALL(* spi_device_get_clock_phase_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* spi_device_set_clock_phase_proc) (SPI_DEVICE *spi, uint32_t clockphase) |
| typedef uint32_t STDCALL(* spi_device_get_clock_polarity_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* spi_device_set_clock_polarity_proc) (SPI_DEVICE *spi, uint32_t clockpolarity) |
| typedef uint32_t STDCALL(* spi_device_get_select_polarity_proc) (SPI_DEVICE *spi, uint16_t chipselect) |
| typedef uint32_t STDCALL(* spi_device_set_select_polarity_proc) (SPI_DEVICE *spi, uint16_t chipselect, uint32_t selectpolarity) |
| typedef uint32_t STDCALL(* spi_device_get_byte_delay_proc) (SPI_DEVICE *spi) |
| typedef uint32_t STDCALL(* spi_device_set_byte_delay_proc) (SPI_DEVICE *spi, uint32_t delay) |
| typedef uint32_t STDCALL(* spi_device_get_properties_proc) (SPI_DEVICE *spi, SPI_PROPERTIES *properties) |
| uint32_t STDCALL spi_device_start | ( | SPI_DEVICE * | spi, |
| uint32_t | mode, | ||
| uint32_t | clockrate, | ||
| uint32_t | clockphase, | ||
| uint32_t | clockpolarity ) |
Start the specified SPI device ready for writing and reading.
SPI Functions
| SPI | The SPI device to start |
| Mode | The device mode to set (eg SPI_MODE_4WIRE) |
| ClockRate | The clock rate to set for the device |
| ClockPhase | The clock phase to set (eg SPI_CLOCK_PHASE_LOW) |
| ClockPolarity | The clock polarity to set (eg SPI_CLOCK_POLARITY_LOW) |
| uint32_t STDCALL spi_device_stop | ( | SPI_DEVICE * | spi | ) |
Stop the specified SPI device and terminate writing and reading.
| SPI | The SPI device to stop |
| uint32_t STDCALL spi_device_read | ( | SPI_DEVICE * | spi, |
| uint16_t | chipselect, | ||
| void * | dest, | ||
| uint32_t | size, | ||
| uint32_t | flags, | ||
| uint32_t * | count ) |
Read data from the specified SPI device Because SPI writes and then reads for each byte, dummy data will be written for each byte to be read.
| SPI | The SPI device to read from |
| ChipSelect | The chip select for the slave to read from (eg SPI_CS_0) |
| Dest | Pointer to a buffer to receive the data |
| Size | The size of the buffer |
| Flags | The flags for this transfer (eg SPI_TRANSFER_DMA) |
| Count | The number of bytes read on return |
| uint32_t STDCALL spi_device_write | ( | SPI_DEVICE * | spi, |
| uint16_t | chipselect, | ||
| void * | source, | ||
| uint32_t | size, | ||
| uint32_t | flags, | ||
| uint32_t * | count ) |
Write data to the specified SPI device Because SPI writes and then reads for each byte, received data will be discarded for each byte written.
| SPI | The SPI device to write to |
| ChipSelect | The chip select for the slave to write to (eg SPI_CS_0) |
| Source | Pointer to a buffer of data to transmit |
| Size | The size of the buffer |
| Flags | The flags for this transfer (eg SPI_TRANSFER_DMA) |
| Count | The number of bytes written on return |
| uint32_t STDCALL spi_device_write_read | ( | SPI_DEVICE * | spi, |
| uint16_t | chipselect, | ||
| void * | source, | ||
| void * | dest, | ||
| uint32_t | size, | ||
| uint32_t | flags, | ||
| uint32_t * | count ) |
Write data to and Read data from the specified SPI device in one operation Because SPI writes and then reads for each byte, both the source and dest buffers must be the same size.
| SPI | The SPI device to write to and read from |
| ChipSelect | The chip select for the slave to write to and read from (eg SPI_CS_0) |
| Source | Pointer to a buffer of data to transmit |
| Dest | Pointer to a buffer to receive the data |
| Size | The size of the buffer |
| Flags | The flags for this transfer (eg SPI_TRANSFER_DMA) |
| Count | The number of bytes written and read on return |
| uint32_t STDCALL spi_device_get_mode | ( | SPI_DEVICE * | spi | ) |
Get the device mode of the specified SPI device.
| SPI | The SPI device to get device mode from |
| uint32_t STDCALL spi_device_set_mode | ( | SPI_DEVICE * | spi, |
| uint32_t | mode ) |
Set the device mode for the specified SPI device.
| SPI | The SPI device to set device mode for |
| Mode | The device mode to set (eg SPI_MODE_4WIRE) |
| uint32_t STDCALL spi_device_get_clock_rate | ( | SPI_DEVICE * | spi, |
| uint16_t | chipselect ) |
Get the clock rate of the specified SPI device.
| SPI | The SPI device to get clock rate from |
| ChipSelect | The chip select number to get clock rate from (SPI_CS_NONE for default) |
| uint32_t STDCALL spi_device_set_clock_rate | ( | SPI_DEVICE * | spi, |
| uint16_t | chipselect, | ||
| uint32_t | clockrate ) |
Set the clock rate for the specified SPI device.
| SPI | The SPI device to set clock rate for |
| ChipSelect | The chip select number to set clock rate for (SPI_CS_NONE for default) |
| ClockRate | The clock rate to set in Hz |
| uint32_t STDCALL spi_device_get_clock_phase | ( | SPI_DEVICE * | spi | ) |
Get the clock phase of the specified SPI device.
| SPI | The SPI device to get clock phase from |
| uint32_t STDCALL spi_device_set_clock_phase | ( | SPI_DEVICE * | spi, |
| uint32_t | clockphase ) |
Set the clock phase for the specified SPI device.
| SPI | The SPI device to set clock phase for |
| ClockPhase | The clock phase to set (eg SPI_CLOCK_PHASE_LOW) |
| uint32_t STDCALL spi_device_get_clock_polarity | ( | SPI_DEVICE * | spi | ) |
Get the clock polarity of the specified SPI device.
| SPI | The SPI device to get clock polarity from |
| uint32_t STDCALL spi_device_set_clock_polarity | ( | SPI_DEVICE * | spi, |
| uint32_t | clockpolarity ) |
Set the clock polarity for the specified SPI device.
| SPI | The SPI device to set clock polarity for |
| ClockPolarity | The clock polarity to set (eg SPI_CLOCK_POLARITY_LOW) |
| uint32_t STDCALL spi_device_get_select_polarity | ( | SPI_DEVICE * | spi, |
| uint16_t | chipselect ) |
Get the chip select polarity of the specified SPI device.
| SPI | The SPI device to get chip select polarity from |
| ChipSelect | The chip select number to get polarity from (SPI_CS_NONE for default) |
| uint32_t STDCALL spi_device_set_select_polarity | ( | SPI_DEVICE * | spi, |
| uint16_t | chipselect, | ||
| uint32_t | selectpolarity ) |
Set the chip select polarity for the specified SPI device.
| SPI | The SPI device to set chip select polarity for |
| ChipSelect | The chip select number to set polarity for (SPI_CS_NONE for default) |
| SelectPolarity | The chip select polarity to set (eg SPI_CS_POLARITY_LOW) |
| uint32_t STDCALL spi_device_get_byte_delay | ( | SPI_DEVICE * | spi | ) |
Get the delay between bytes written for the specified SPI device.
| SPI | The SPI device to get the byte delay from |
| uint32_t STDCALL spi_device_set_byte_delay | ( | SPI_DEVICE * | spi, |
| uint32_t | delay ) |
Set the delay between bytes written for the specified SPI device.
| SPI | The SPI device to set byte delay for |
| Delay | The byte delay to set in microseconds |
| uint32_t STDCALL spi_device_properties | ( | SPI_DEVICE * | spi, |
| SPI_PROPERTIES * | properties ) |
Get the properties for the specified SPI device.
| SPI | The SPI device to get properties from |
| Properties | Pointer to a TSPIProperties structure to fill in |
| uint32_t STDCALL spi_device_get_properties | ( | SPI_DEVICE * | spi, |
| SPI_PROPERTIES * | properties ) |
Get the properties for the specified SPI device.
| SPI | The SPI device to get properties from |
| Properties | Pointer to a TSPIProperties structure to fill in |
| SPI_DEVICE *STDCALL spi_device_create | ( | void | ) |
Create a new SPI entry.
| SPI_DEVICE *STDCALL spi_device_create_ex | ( | uint32_t | size | ) |
Create a new SPI entry.
| Size | Size in bytes to allocate for new SPI (Including the SPI entry) |
| uint32_t STDCALL spi_device_destroy | ( | SPI_DEVICE * | spi | ) |
Destroy an existing SPI entry.
| SPI | The SPI device to destroy |
| uint32_t STDCALL spi_device_register | ( | SPI_DEVICE * | spi | ) |
Register a new SPI in the SPI table.
| SPI | The SPI device to register |
| uint32_t STDCALL spi_device_deregister | ( | SPI_DEVICE * | spi | ) |
Deregister an SPI from the SPI table.
| SPI | The SPI device to deregister |
| SPI_DEVICE *STDCALL spi_device_find | ( | uint32_t | spiid | ) |
Find an SPI device by ID in the SPI table.
| SPIId | The ID number of the SPI device to find |
| SPI_DEVICE *STDCALL spi_device_find_by_name | ( | const char * | name | ) |
Find an SPI device by name in the device table.
| Name | The name of the SPI device to find (eg SPI0) |
| SPI_DEVICE *STDCALL spi_device_find_by_description | ( | const char * | description | ) |
Find an SPI device by description in the device table.
| Description | The description of the SPI to find (eg BCM2837 SPI0 Master) |
| uint32_t STDCALL spi_device_enumerate | ( | spi_enumerate_cb | callback, |
| void * | data ) |
Enumerate all SPI devices in the SPI table.
| Callback | The callback function to call for each SPI device in the table |
| Data | A private data pointer to pass to callback for each SPI device in the table |
| uint32_t STDCALL spi_device_notification | ( | SPI_DEVICE * | spi, |
| spi_notification_cb | callback, | ||
| void * | data, | ||
| uint32_t | notification, | ||
| uint32_t | flags ) |
Register a notification for SPI device changes.
| Device | The SPI device to notify changes for (Optional, pass nil for all SPI devices) |
| Callback | The function to call when a notification event occurs |
| Data | A private data pointer to pass to callback when a notification event occurs |
| Notification | The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER) |
| Flags | The flags to control the notification (eg NOTIFIER_FLAG_WORKER) |
| uint32_t STDCALL spi_get_count | ( | void | ) |
Get the current SPI count.
SPI Helper Functions
| SPI_DEVICE *STDCALL spi_device_get_default | ( | void | ) |
Get the current default SPI device.
| uint32_t STDCALL spi_device_set_default | ( | SPI_DEVICE * | spi | ) |
Set the current default SPI device.
| SPI_DEVICE *STDCALL spi_device_check | ( | SPI_DEVICE * | spi | ) |
Check if the supplied SPI is in the SPI table.
| uint32_t STDCALL spi_type_to_string | ( | uint32_t | spitype, |
| char * | string, | ||
| uint32_t | len ) |
Convert an SPI type value to a string.
| uint32_t STDCALL spi_state_to_string | ( | uint32_t | spistate, |
| char * | string, | ||
| uint32_t | len ) |
Convert an SPI state value to a string.
| uint32_t STDCALL spi_chip_select_to_string | ( | uint16_t | chipselect, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL spi_mode_to_string | ( | uint32_t | mode, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL spi_clock_phase_to_string | ( | uint32_t | phase, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL spi_clock_polarity_to_string | ( | uint32_t | polarity, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL spi_select_polarity_to_string | ( | uint32_t | polarity, |
| char * | string, | ||
| uint32_t | len ) |