VMX-pi C++ HAL Library for Raspberry Pi
VMX-pi Robotics Controller & Vision/Motion Processor
Public Member Functions | Public Attributes | List of all members
SPIConfig Struct Reference

Contains the configuration data for a VMXResource whose VMXResourceType is SPI. More...

#include <VMXResourceConfig.h>

Inheritance diagram for SPIConfig:
VMXResourceConfig

Public Member Functions

 SPIConfig ()
 SPIConfig default constructor; sets all values to defaults (1Mhz SPI Click, Mode 3, CS Active Low, MSBFirst.
 
 SPIConfig (uint32_t bitrate)
 SPIConfig constructor; initializes bitrate, sets remaining value to defaults. More...
 
 SPIConfig (uint32_t bitrate, uint8_t mode, bool cs_active_low, bool msbfirst)
 SPIConfig constructor; initializes values with the provided input parameters *. More...
 
uint32_t GetBitrate ()
 Returns the configured SPI bitrate.
 
uint8_t GetMode ()
 Returns the configure SPI mode.
 
bool GetCSActiveLow ()
 Returns true if the SPI CS is active low; false if the SPI CS is active high.
 
bool GetMSBFirst ()
 Returns true if the most-significant bit is transmitted first; false if the least-significant bit is transmitted first.
 
void SetBitrate (uint32_t bitrate)
 Sets the configured SPI bitrate.
 
void SetMode (uint8_t mode)
 Sets the configured SPI mode, which must be a value from 0-3. More...
 
void SetCSActiveLow (bool cs_active_low)
 Sets the SPI CS Active low if true, Active high if false.
 
void SetMSBFirst (bool msbfirst)
 Sets the SPI bit transmit order to most-significant bit first if true; least-significant bit order is used if false.
 
virtual VMXResourceConfigGetCopy () const
 Instantiates a copy of the configuration data. More...
 
virtual bool Copy (const VMXResourceConfig *p_config)
 Copies the contents of the source VMXResourceConfig object into this object. More...
 
- Public Member Functions inherited from VMXResourceConfig
 VMXResourceConfig (VMXResourceType res_type)
 
VMXResourceType GetResourceType () const
 VMXResourceType which this configuration applies to.
 

Public Attributes

uint32_t bitrate_bps
 
uint8_t mode
 
bool cs_active_low
 
bool msbfirst
 
- Public Attributes inherited from VMXResourceConfig
VMXResourceType res_type
 

Detailed Description

Contains the configuration data for a VMXResource whose VMXResourceType is SPI.

Constructor & Destructor Documentation

◆ SPIConfig() [1/2]

SPIConfig::SPIConfig ( uint32_t  bitrate)
inline

SPIConfig constructor; initializes bitrate, sets remaining value to defaults.

Parameters
bitrateThe SPI Clock Bitrate

◆ SPIConfig() [2/2]

SPIConfig::SPIConfig ( uint32_t  bitrate,
uint8_t  mode,
bool  cs_active_low,
bool  msbfirst 
)
inline

SPIConfig constructor; initializes values with the provided input parameters *.

Parameters
bitrateThe SPI Clock bitrate
modeThe SPI Mode (0-3)
cs_active_lowtrue if the SPI CS signal is active low; false if SPI CS signal is active high
msbvirsttrue if the most significant Bit is transmitted first, false if the least-significant bit is transmitted first

Member Function Documentation

◆ Copy()

virtual bool SPIConfig::Copy ( const VMXResourceConfig p_config)
inlinevirtual

Copies the contents of the source VMXResourceConfig object into this object.

NOTE: The source object's VMXResourceType must match this object's VMXResourceType.

Parameters
[in]p_configThe source VMXResourceConfig object from which to copy configuration data into this object.

Implements VMXResourceConfig.

◆ GetCopy()

virtual VMXResourceConfig* SPIConfig::GetCopy ( ) const
inlinevirtual

Instantiates a copy of the configuration data.

NOTE: The caller is responsible to delete the object returned from this method.

Implements VMXResourceConfig.

◆ SetMode()

void SPIConfig::SetMode ( uint8_t  mode)
inline

Sets the configured SPI mode, which must be a value from 0-3.

Invalid mode input values are coerced to a value from 0-3.


The documentation for this struct was generated from the following file: