SPI Functions - PalouseRobosub/SUBLIBinal GitHub Wiki

SPI Functions

This wiki page explains the different functions available within the SPI pheriphal library within SUBLIBinal. Please select the appropriate function from the list below to be redirected to documentation.

Note: The SPI pheripheral library is not currently finished.

Functions


initialize_SPI

Definition

SPI_Data* initialize_SPI(SPI_Config config);

Description
The SPI initialization function will accept a filled out SPI_Config structure and configure the SPI module for communication.

Parameters

  • config: This parameter should be a partially or completely filled out configuration structure. Not all parameters are necessary for correct functionality of SPI if only transmission or receiving is desired.

Return
This function will return a pointer to a SPI_Data structure created for internal use by the library. This structure should not be modified by the user and is intended to be used as a way to query the status of the SPI module. Manipulation of the contents of this structure can have unintended effects and may cause the SPI module to malfunction.

top


send_SPI

Definition

Error send_SPI(SPI_Channel channel, uint8 *data_ptr, uint data_size);

Description
The send_SPI function is used to send information via the SPI protocol utilizing the SPI module.

Parameters

  • channel: This parameter specifies with SPI channel should be used for communicating. This channel should be configured.
  • data_ptr: This parameter should be a pointer to the data that the user wishes to transmit
  • data_size: This parameter specifies the size of data in bytes that the user wishes to transmit.

Return
This function will return an associated error code if there is not room available in the transmission buffer. This error can occur if the buffer is too small or has become full. Otherwise, this function will not return an error.

top