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

The VMXIO class provides access to VMX Analog/Digital IO functions, including VMX Channel and VMX Resource Management and functions. More...

#include <VMXIO.h>

Public Types

enum  EncoderDirection { EncoderForward, EncoderReverse }
 Enumeration of Encoder Directions.
 
enum  AnalogTriggerState { BelowThreshold, AboveThreshold, InWindow }
 Enumeration of Analog Trigger States.
 

Public Member Functions

uint8_t GetNumResourcesByType (VMXResourceType resource_type)
 Returns the number of VMX Resources of the specified VMXResourceType. More...
 
uint8_t GetNumChannelsByCapability (VMXChannelCapability channel_capability)
 Returns the number of VMX Channels of the specified VMXChannelCapability. More...
 
uint8_t GetNumChannelsByType (VMXChannelType channel_type, VMXChannelIndex &first_channel_index)
 Returns the number of VMX Channels of the specified VMXChannelType. More...
 
bool GetChannelCapabilities (VMXChannelIndex channel_index, VMXChannelType &channel_type, VMXChannelCapability &capability_bits)
 Returns the VMXChannelType and VMXChannelCapability for the specified VMXChannelIndex. More...
 
bool ChannelSupportsCapability (VMXChannelIndex channel_index, VMXChannelCapability capability)
 Indicates whether the specified VMXChannelIndex supports the specified VMXChannelCapability. More...
 
bool GetResourceHandle (VMXResourceType resource_type, VMXResourceIndex res_index, VMXResourceHandle &resource_handle, VMXErrorCode *errcode=0)
 Returns the VMXResourceHandle of the VMX Resource identified by the specified VMXResourceType and VMXResourceIndex. More...
 
bool GetResourcesCompatibleWithChannelAndCapability (VMXChannelIndex channel_index, VMXChannelCapability capability, std::list< VMXResourceHandle > &compatible_res_handles)
 Returns a list of VMXResourceHandles which are compatible with the specified VMXChannelIndex and VMXChannelCapability. More...
 
bool GetUnallocatedResourcesCompatibleWithChannelAndCapability (VMXChannelIndex channel_index, VMXChannelCapability capability, std::list< VMXResourceHandle > &unallocated_compatible_res_handles)
 Returns a list of unallocated VMXResourceHandles which are compatible with the specified VMXChannelIndex and VMXChannelCapability. More...
 
bool GetChannelsCompatibleWithResource (VMXResourceHandle resource_handle, VMXChannelIndex &first_channel_index, uint8_t &num_channels)
 Returns a list of VMXChannelIndexes which are compatible with the specified VMXResourceHandle. More...
 
bool IsResourceAllocated (VMXResourceHandle resource, bool &allocated, bool &is_shared, VMXErrorCode *errcode=0)
 Indicates whether the specified VMXResourceHandle is currently allocated, and whether it is a shared resource. More...
 
bool AllocateResource (VMXResourceHandle resource, VMXErrorCode *errcode=0)
 Attempts to allocate the specified VMXResourceHandle. More...
 
bool DeallocateResource (VMXResourceHandle resource, VMXErrorCode *errcode=0)
 Attempts to deallocate the specified VMXResourceHandle. More...
 
bool DeallocateAllResources (VMXErrorCode *last_errorcode=0)
 Attempts to deallocate all currently-allocated VMXResourceHandles. More...
 
bool RouteChannelToResource (VMXChannelIndex channel, VMXResourceHandle resource, VMXErrorCode *errcode=0)
 Attempts to route the specified VMXChannelIndex to the allocated VMXResourceHandle Note: If the resource requires multiple channels to be allocated to the resource, all channels are routed when the first channel is routed. More...
 
bool UnrouteChannelFromResource (VMXChannelIndex channel, VMXResourceHandle resource, VMXErrorCode *errcode=0)
 Attempts to unroute the specified VMXChannelIndex from the allocated VMXResourceHandle. More...
 
bool UnrouteAllChannelsFromResource (VMXResourceHandle resource, VMXErrorCode *errcode=0)
 Attempts to unroute all VMX Channels from the allocated VMXResourceHandle. More...
 
bool SetResourceConfig (VMXResourceHandle resource, const VMXResourceConfig *p_config, VMXErrorCode *errcode=0)
 Sets the configuration to the specified VMXResourceHandle. More...
 
bool GetResourceConfig (VMXResourceHandle resource, VMXResourceConfig *&p_config, VMXErrorCode *errcode=0)
 Gets the configuration of the specified VMXResourceHandle. More...
 
bool GetResourceDefaultConfig (VMXResourceHandle resource, VMXResourceConfig *&p_config, VMXErrorCode *errcode=0)
 Gets the default configuration of the specified VMXResourceHandle. More...
 
bool IsResourceActive (VMXResourceHandle, bool &active, VMXErrorCode *errcode=0)
 Indicates whether the specified VMXResourceHandle is currently active. More...
 
bool ActivateResource (VMXResourceHandle resource, VMXErrorCode *errcode=0)
 Attempts to activate the specified VMXResourceHandle NOTE: VMX Resources can be activated after they have been sucessfully allocated, had VMX Channels routed to them, and (optionally) configured. More...
 
bool DeactivateResource (VMXResourceHandle resource, VMXErrorCode *errcode=0)
 Attempts to deactivate the specified VMXResourceHandle. More...
 
bool ActivateSinglechannelResource (VMXChannelIndex channel_index, VMXChannelCapability channel_capability, VMXResourceHandle &res_handle, const VMXResourceConfig *res_cfg=0, VMXErrorCode *errcode=0)
 Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the specified VMX Channel to it, then applying the specified configuration, and then finally performing resource activation. More...
 
bool ActivateMultichannelResource (uint8_t num_channels, VMXChannelIndex *p_channel_indexes, VMXChannelCapability *p_channel_capabilities, VMXResourceHandle &res_handle, const VMXResourceConfig *res_cfg=0, VMXErrorCode *errcode=0)
 Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the specified VMX Channels to it, then applying the specified configuration, and then finally performing resource activation. More...
 
bool DIO_Get (VMXResourceHandle dio_res_handle, bool &high, VMXErrorCode *errcode=0)
 Returns the current signal state from a VMX DigitalIO Resource. More...
 
bool DIO_Set (VMXResourceHandle dio_res_handle, bool high, VMXErrorCode *errcode=0)
 Sets the current signal state of a VMX DigitalIO Resource in Digital Output mode. More...
 
bool PWMGenerator_SetDutyCycle (VMXResourceHandle pwmgen_res_handle, VMXResourcePortIndex port_index, uint8_t duty_cycle, VMXErrorCode *errcode=0)
 Sets the VMX PWM Generator Resource's Duty Cycle to the specified value. More...
 
bool PWMCapture_GetCount (VMXResourceHandle pwmcap_res_handle, int32_t &count, VMXErrorCode *errcode=0)
 
bool Encoder_GetCount (VMXResourceHandle encoder_res_handle, int32_t &count, VMXErrorCode *errcode=0)
 Returns the current Encoder count value from a VMX Encoder Resource. More...
 
bool Encoder_GetDirection (VMXResourceHandle encoder_res_handle, EncoderDirection &direction, VMXErrorCode *errcode=0)
 Returns the current EncoderDirection value from a VMX Encoder Resource. More...
 
bool Encoder_Reset (VMXResourceHandle encoder_res_handle, VMXErrorCode *errcode=0)
 Sets the VMX Encoder Resource's count value to 0. More...
 
bool Accumulator_GetOversampleValue (VMXResourceHandle accum_res_handle, uint32_t &oversample_value, VMXErrorCode *errcode=0)
 Returns the current oversample value from a VMX Analog Accumulator Resource. More...
 
bool Accumulator_GetAverageValue (VMXResourceHandle accum_res_handle, uint32_t &average_value, VMXErrorCode *errcode=0)
 Returns the current averaged value from a VMX Analog Accumulator Resource. More...
 
bool Accumulator_GetInstantaneousValue (VMXResourceHandle accum_res_handle, uint32_t &average_value, VMXErrorCode *errcode=0)
 Returns the current instantaneous (non-averaged) value from a VMX Analog Accumulator Resource. More...
 
bool Accumulator_GetFullScaleVoltage (float &full_scale_voltage, VMXErrorCode *errcode=0)
 Returns the current VMX Analog Input full-scale voltage level. More...
 
bool Accumulator_GetAverageVoltage (VMXResourceHandle accum_res_handle, float &average_value, VMXErrorCode *errcode=0)
 Returns the current averaged value in voltage units from a VMX Analog Accumulator Resource. More...
 
bool AnalogTrigger_GetState (VMXResourceHandle antrig_res_handle, AnalogTriggerState &state, VMXErrorCode *errcode=0)
 Returns the current state from a VMX AnalogTrigger Resource. More...
 
bool UART_Write (VMXResourceHandle uart_res_handle, uint8_t *p_data, uint16_t size, VMXErrorCode *errcode=0)
 Writes the specified data to the specified VMX UART Resource. More...
 
bool UART_Read (VMXResourceHandle uart_res_handle, uint8_t *p_data, uint16_t max_size, uint16_t &actual_size_read, VMXErrorCode *errcode=0)
 Reads data from the specified VMX UART Resource. More...
 
bool UART_GetBytesAvailable (VMXResourceHandle uart_es_handle, uint16_t &size, VMXErrorCode *errcode=0)
 Returns the number of data bytes which have been received from VMX UART Resource. More...
 
bool SPI_Write (VMXResourceHandle spi_res_handle, uint8_t *p_send_data, uint16_t size, VMXErrorCode *errcode=0)
 Writes the specified data to the specified VMX SPI Resource. More...
 
bool SPI_Read (VMXResourceHandle spi_res_handle, uint8_t *p_rcv_data, uint16_t size, VMXErrorCode *errcode=0)
 Reads data from the specified VMX SPI Resource. More...
 
bool SPI_Transaction (VMXResourceHandle spi_res_handle, uint8_t *p_send_data, uint8_t *p_rcv_data, uint16_t size, VMXErrorCode *errcode=0)
 Simultaneously Writes/Reads data to/from the specified VMX SPI Resource. More...
 
bool I2C_Write (VMXResourceHandle i2c_res_handle, uint8_t deviceAddress, uint8_t *dataToSend, int32_t sendSize, VMXErrorCode *errcode=0)
 Writes the specified data to the specified VMX I2C Resource. More...
 
bool I2C_Read (VMXResourceHandle i2c_res_handle, uint8_t deviceAddress, uint8_t *buffer, int32_t count, VMXErrorCode *errcode=0)
 Reads data from the specified VMX I2C Resource. More...
 
bool I2C_Transaction (VMXResourceHandle i2c_res_handle, uint8_t deviceAddress, uint8_t *dataToSend, uint16_t sendSize, uint8_t *dataReceived, uint16_t receiveSize, VMXErrorCode *errcode=0)
 Simultaneously Writes/Reads data to/from the specified VMX I2C Resource. More...
 

Public Attributes

const uint8_t MIN_PWM_GENERATOR_DUTY_CYCLE = 0
 Minimum PWM Generator Duty Cycle value.
 
const uint8_t MAX_PWM_GENERATOR_DUTY_CYCLE = 255
 Maximum PWM Generator Duty Cycle value.
 

Friends

class VMXPi
 

Detailed Description

The VMXIO class provides access to VMX Analog/Digital IO functions, including VMX Channel and VMX Resource Management and functions.

Member Function Documentation

◆ Accumulator_GetAverageValue()

bool VMXIO::Accumulator_GetAverageValue ( VMXResourceHandle  accum_res_handle,
uint32_t &  average_value,
VMXErrorCode *  errcode = 0 
)

Returns the current averaged value from a VMX Analog Accumulator Resource.

NOTE: The number of samples averaged to calculate the average value is specified by the number of average bits See AccumulatorConfig for more information on modifying these bits

Parameters
accum_res_handleHandle to the activated VMX Accumulator Resource
[out]average_valueCurrent Accumulator average value
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid Accumulator average value was returned. If false, the error code will be returned via the errcode parameter.

◆ Accumulator_GetAverageVoltage()

bool VMXIO::Accumulator_GetAverageVoltage ( VMXResourceHandle  accum_res_handle,
float &  average_voltage,
VMXErrorCode *  errcode = 0 
)

Returns the current averaged value in voltage units from a VMX Analog Accumulator Resource.

NOTE: The number of samples averaged to calculate the average value is specified by the number of average bits See AccumulatorConfig for more information on modifying these bits

Parameters
accum_res_handleHandle to the activated VMX Accumulator Resource
[out]average_voltageCurrent Accumulator average value, in voltage units
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid Accumulator average voltage was returned. If false, the error code will be returned via the errcode parameter.

◆ Accumulator_GetFullScaleVoltage()

bool VMXIO::Accumulator_GetFullScaleVoltage ( float &  full_scale_voltage,
VMXErrorCode *  errcode = 0 
)

Returns the current VMX Analog Input full-scale voltage level.

Parameters
[out]full_scale_voltageCurrent VMX Analog Input full-scale voltage level
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid full-scale voltage value was returned. If false, the error code will be returned via the errcode parameter.

◆ Accumulator_GetInstantaneousValue()

bool VMXIO::Accumulator_GetInstantaneousValue ( VMXResourceHandle  accum_res_handle,
uint32_t &  instantaneous_value,
VMXErrorCode *  errcode = 0 
)

Returns the current instantaneous (non-averaged) value from a VMX Analog Accumulator Resource.

NOTE: This method bypasses the Accmulator's averaging calculation

Parameters
accum_res_handleHandle to the activated VMX Accumulator Resource
[out]instantaneous_valueCurrent Accumulator average value
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid Accumulator instantaneous value was returned. If false, the error code will be returned via the errcode parameter.

◆ Accumulator_GetOversampleValue()

bool VMXIO::Accumulator_GetOversampleValue ( VMXResourceHandle  accum_res_handle,
uint32_t &  oversample_value,
VMXErrorCode *  errcode = 0 
)

Returns the current oversample value from a VMX Analog Accumulator Resource.

NOTE: The resolution of Accumulator values is dependent upon the current number of bits 0 bits: 12-bit resolution, 1 bit: 13-bit resolution, etc. See AccumulatorConfig for more information on modifying these bits

Parameters
accum_res_handleHandle to the activated VMX Accumulator Resource
[out]oversample_valueCurrent Accumulator oversample value
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid Accumulator Oversample value was returned. If false, the error code will be returned via the errcode parameter.

◆ ActivateMultichannelResource()

bool VMXIO::ActivateMultichannelResource ( uint8_t  num_channels,
VMXChannelIndex p_channel_indexes,
VMXChannelCapability p_channel_capabilities,
VMXResourceHandle res_handle,
const VMXResourceConfig res_cfg = 0,
VMXErrorCode *  errcode = 0 
)

Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the specified VMX Channels to it, then applying the specified configuration, and then finally performing resource activation.

NOTE: This method should be used for multiple-channel VMX Resources.

Parameters
num_channelsThe number of VMXChannelIndexes in the array pointed to by the p_channel_indexes parameter
p_channel_indexesPointer to an array of VMXChannelIndexes to route to the VMX Resource
p_channel_capabilitiesThe VMXChannelCapability of the specified VMX Channel which matches the capability of the requested VMX Resource
res_handleThe requested VMXResourceHandle
res_cfgPointer to the VMXResourceConfig object used to configure the VMX Resource
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX resource was successfully activated. If false, the error code will be returned via the errcode parameter.

◆ ActivateResource()

bool VMXIO::ActivateResource ( VMXResourceHandle  resource,
VMXErrorCode *  errcode = 0 
)

Attempts to activate the specified VMXResourceHandle NOTE: VMX Resources can be activated after they have been sucessfully allocated, had VMX Channels routed to them, and (optionally) configured.

Parameters
resourceThe requested VMXResourceHandle
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX resource was successfully activate. If false, the error code will be returned via the errcode parameter.

◆ ActivateSinglechannelResource()

bool VMXIO::ActivateSinglechannelResource ( VMXChannelIndex  channel_index,
VMXChannelCapability  channel_capability,
VMXResourceHandle res_handle,
const VMXResourceConfig res_cfg = 0,
VMXErrorCode *  errcode = 0 
)

Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the specified VMX Channel to it, then applying the specified configuration, and then finally performing resource activation.

NOTE: This method should be used for single-channel VMX Resources.

Parameters
channel_indexThe VMXChannelIndex to route to the VMX Resource
channel_capabilityThe VMXChannelCapability of the specified VMX Channel which matches the capability of the requested VMX Resource
res_handleThe requested VMXResourceHandle
res_cfgPointer to the VMXResourceConfig object used to configure the VMX Resource
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX resource was successfully activated. If false, the error code will be returned via the errcode parameter.

◆ AllocateResource()

bool VMXIO::AllocateResource ( VMXResourceHandle  resource,
VMXErrorCode *  errcode = 0 
)

Attempts to allocate the specified VMXResourceHandle.

Parameters
resourceThe requested VMXResourceHandle
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX resource was successfully allocated. If false, the error code will be returned via the errcode parameter.

◆ AnalogTrigger_GetState()

bool VMXIO::AnalogTrigger_GetState ( VMXResourceHandle  antrig_res_handle,
AnalogTriggerState state,
VMXErrorCode *  errcode = 0 
)

Returns the current state from a VMX AnalogTrigger Resource.

Parameters
antrig_res_handleHandle to the activated VMX Analog Trigger Resource
[out]stateThe current AnalogTriggerState of the VMX Analog Trigger Resource
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid Analog Trigger state was returned. If false, the error code will be returned via the errcode parameter.

◆ ChannelSupportsCapability()

bool VMXIO::ChannelSupportsCapability ( VMXChannelIndex  channel_index,
VMXChannelCapability  capability 
)

Indicates whether the specified VMXChannelIndex supports the specified VMXChannelCapability.

Parameters
channel_indexThe requested VMXChannelIndex
capabilityThe returned VMXChannelCapability
Returns
Returns true if the specified VMXChannelIndex has the specified capabilities

◆ DeactivateResource()

bool VMXIO::DeactivateResource ( VMXResourceHandle  resource,
VMXErrorCode *  errcode = 0 
)

Attempts to deactivate the specified VMXResourceHandle.

This will disable any output activity or input electrical activity - but leave channels routed if any.

Parameters
resourceThe requested VMXResourceHandle
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX resource was successfully deactivated. If false, the error code will be returned via the errcode parameter.

◆ DeallocateAllResources()

bool VMXIO::DeallocateAllResources ( VMXErrorCode *  errcode = 0)

Attempts to deallocate all currently-allocated VMXResourceHandles.

Parameters
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if all VMX resources were successfully deallocated. If false, the error code will be returned via the errcode parameter.

◆ DeallocateResource()

bool VMXIO::DeallocateResource ( VMXResourceHandle  resource,
VMXErrorCode *  errcode = 0 
)

Attempts to deallocate the specified VMXResourceHandle.

Parameters
resourceThe requested VMXResourceHandle
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX resource was successfully deallocated. If false, the error code will be returned via the errcode parameter.

◆ DIO_Get()

bool VMXIO::DIO_Get ( VMXResourceHandle  dio_res_handle,
bool &  high,
VMXErrorCode *  errcode = 0 
)

Returns the current signal state from a VMX DigitalIO Resource.

Parameters
dio_res_handleHandle to the activated VMX DigitalIO Resource
[out]hightrue if the signal state is HIGH, false if it is LOW
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid DigitalIO signal state was returned. If false, the error code will be returned via the errcode parameter.

◆ DIO_Set()

bool VMXIO::DIO_Set ( VMXResourceHandle  dio_res_handle,
bool  high,
VMXErrorCode *  errcode = 0 
)

Sets the current signal state of a VMX DigitalIO Resource in Digital Output mode.

Parameters
dio_res_handleHandle to the activated VMX DigitalIO Resource
hightrue to set the signal state HIGH, false to set it to LOW
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the DigitalIO signal state was modified. If false, the error code will be returned via the errcode parameter.

◆ Encoder_GetCount()

bool VMXIO::Encoder_GetCount ( VMXResourceHandle  encoder_res_handle,
int32_t &  count,
VMXErrorCode *  errcode = 0 
)

Returns the current Encoder count value from a VMX Encoder Resource.

Parameters
encoder_res_handleHandle to the activated VMX Encoder Resource
[out]countCurrent encoder count value, which may be negative or positive.
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid Encoder count value was returned. If false, the error code will be returned via the errcode parameter.

◆ Encoder_GetDirection()

bool VMXIO::Encoder_GetDirection ( VMXResourceHandle  encoder_res_handle,
EncoderDirection direction,
VMXErrorCode *  errcode = 0 
)

Returns the current EncoderDirection value from a VMX Encoder Resource.

Parameters
encoder_res_handleHandle to the activated VMX Encoder Resource
[out]directionCurrent encoder direction
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a valid Encoder direction was returned. If false, the error code will be returned via the errcode parameter.

◆ Encoder_Reset()

bool VMXIO::Encoder_Reset ( VMXResourceHandle  encoder_res_handle,
VMXErrorCode *  errcode = 0 
)

Sets the VMX Encoder Resource's count value to 0.

Parameters
encoder_res_handleHandle to the activated VMX Encoder Resource
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the Encoder count was reset to 0. If false, the error code will be returned via the errcode parameter.

◆ GetChannelCapabilities()

bool VMXIO::GetChannelCapabilities ( VMXChannelIndex  channel_index,
VMXChannelType channel_type,
VMXChannelCapability capability_bits 
)

Returns the VMXChannelType and VMXChannelCapability for the specified VMXChannelIndex.

Parameters
channel_indexThe requested VMXChannelIndex
[out]channel_typeThe returned VMXChannelType
[out]capability_bitsThe return VMXChannelCapability. Note that multiple capability bits may be set.
Returns
Returns true if a VMXChannelIndex matching the specified parameters was found.

◆ GetChannelsCompatibleWithResource()

bool VMXIO::GetChannelsCompatibleWithResource ( VMXResourceHandle  resource_handle,
VMXChannelIndex first_channel_index,
uint8_t &  num_channels 
)

Returns a list of VMXChannelIndexes which are compatible with the specified VMXResourceHandle.

Parameters
resource_handleThe requested VMXResourceHandle.
[out]first_channel_indexThe first VMXChannelIndex compatible with the specified VMXResourceHandle
[out]num_channelsThe number of VMXChannels compatible with the specified VMXResourceHandle
Returns
Returns true if any matching VMX Channels were identified based on the input parameters. If false, the error code will be returned via the errcode parameter.

◆ GetNumChannelsByCapability()

uint8_t VMXIO::GetNumChannelsByCapability ( VMXChannelCapability  channel_capability)

Returns the number of VMX Channels of the specified VMXChannelCapability.

Parameters
channel_capabilityThe requested VMXChannelCapability.
Returns
The number of VNX Resources with the specified capability.

◆ GetNumChannelsByType()

uint8_t VMXIO::GetNumChannelsByType ( VMXChannelType  channel_type,
VMXChannelIndex first_channel_index 
)

Returns the number of VMX Channels of the specified VMXChannelType.

Parameters
channel_typeThe requested VMXChannelType.
first_channel_indexThe first VMXChannelIndex of the requested type.
Returns
The number of VNX Resources with the specified capability.

◆ GetNumResourcesByType()

uint8_t VMXIO::GetNumResourcesByType ( VMXResourceType  resource_type)

Returns the number of VMX Resources of the specified VMXResourceType.

Parameters
resource_typeThe requested VMXResourceType.
Returns
The number of VMX Resources of the specified type.

◆ GetResourceConfig()

bool VMXIO::GetResourceConfig ( VMXResourceHandle  resource,
VMXResourceConfig *&  p_config,
VMXErrorCode *  errcode = 0 
)

Gets the configuration of the specified VMXResourceHandle.

Parameters
resourceThe VMXResourceHandle to acquire configuration from
p_configPointer to the VMXResourceConfig object which will contain the retrieved configuration
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the configuration data was retrieved from the VMX Resource. If false, the error code will be returned via the errcode parameter.

◆ GetResourceDefaultConfig()

bool VMXIO::GetResourceDefaultConfig ( VMXResourceHandle  resource,
VMXResourceConfig *&  p_config,
VMXErrorCode *  errcode = 0 
)

Gets the default configuration of the specified VMXResourceHandle.

Parameters
resourceThe VMXResourceHandle to acquire default configuration from
p_configPointer to the VMXResourceConfig object which will contain the retrieved default configuration
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the default configuration data was retrieved from the VMX Resource. If false, the error code will be returned via the errcode parameter.

◆ GetResourceHandle()

bool VMXIO::GetResourceHandle ( VMXResourceType  resource_type,
VMXResourceIndex  res_index,
VMXResourceHandle resource_handle,
VMXErrorCode *  errcode = 0 
)

Returns the VMXResourceHandle of the VMX Resource identified by the specified VMXResourceType and VMXResourceIndex.

Parameters
resource_typeThe requested VMXResourceType.
res_indexThe requested VMXResourceIndex.
[out]resource_handleThe returned VMXResourceHandle, if successful
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if a matching VMXResource was identifed based on the input parameters. If false, the error code will be returned via the errcode parameter.

◆ GetResourcesCompatibleWithChannelAndCapability()

bool VMXIO::GetResourcesCompatibleWithChannelAndCapability ( VMXChannelIndex  channel_index,
VMXChannelCapability  capability,
std::list< VMXResourceHandle > &  compatible_res_handles 
)

Returns a list of VMXResourceHandles which are compatible with the specified VMXChannelIndex and VMXChannelCapability.

Parameters
channel_indexThe requested VMXResourceType.
capabilityThe requested VMXResourceIndex.
[out]compatible_res_handlesThe returned VMXResourceHandles, if successful
Returns
Returns true if any matching VMXResources were identified based on the input parameters.

◆ GetUnallocatedResourcesCompatibleWithChannelAndCapability()

bool VMXIO::GetUnallocatedResourcesCompatibleWithChannelAndCapability ( VMXChannelIndex  channel_index,
VMXChannelCapability  capability,
std::list< VMXResourceHandle > &  unallocated_compatible_res_handles 
)

Returns a list of unallocated VMXResourceHandles which are compatible with the specified VMXChannelIndex and VMXChannelCapability.

Parameters
channel_indexThe requested VMXResourceType.
capabilityThe requested VMXResourceIndex.
[out]unallocated_compatible_res_handlesThe returned VMXResourceHandles, if successful
Returns
Returns true if any matching VMXResources were identified based on the input parameters. If false, the error code will be returned via the errcode parameter.

◆ I2C_Read()

bool VMXIO::I2C_Read ( VMXResourceHandle  i2c_res_handle,
uint8_t  deviceAddress,
uint8_t *  buffer,
int32_t  count,
VMXErrorCode *  errcode = 0 
)

Reads data from the specified VMX I2C Resource.

NOTE: This is a blocking call.

Parameters
i2c_res_handleHandle to the activated VMX I2C Resource
deviceAddress7-bit I2C address of the I2C device
bufferPointer to the buffer into which received data is placed
countNumber of bytes to receive
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the data was received via the I2C interface. If false, the error code will be returned via the errcode parameter.

◆ I2C_Transaction()

bool VMXIO::I2C_Transaction ( VMXResourceHandle  i2c_res_handle,
uint8_t  deviceAddress,
uint8_t *  dataToSend,
uint16_t  sendSize,
uint8_t *  dataReceived,
uint16_t  receiveSize,
VMXErrorCode *  errcode = 0 
)

Simultaneously Writes/Reads data to/from the specified VMX I2C Resource.

NOTE: This is a blocking call.

Parameters
i2c_res_handleHandle to the activated VMX I2c Resource
deviceAddress7-bit I2C address of the I2C device
dataToSendPointer to the buffer of data to be sent to the SPI resource
sendSizeNumber of bytes to send. The dataToSend parameter must point to a buffer whose length is at least this value.
dataReceivedPointer to the buffer into which receive data read from the SPI resource
receiveSizeNumber of bytes to receive. The dataReceived parameter must point to a buffer whose length is at least this value.
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the data was transmitted/received via the I2C interface. If false, the error code will be returned via the errcode parameter.

◆ I2C_Write()

bool VMXIO::I2C_Write ( VMXResourceHandle  i2c_res_handle,
uint8_t  deviceAddress,
uint8_t *  dataToSend,
int32_t  sendSize,
VMXErrorCode *  errcode = 0 
)

Writes the specified data to the specified VMX I2C Resource.

NOTE: This is a blocking call.

Parameters
i2c_res_handleHandle to the activated VMX I2C Resource
deviceAddress7-bit I2C address of the I2C device
dataToSendPointer to the buffer of data to be sent
sendSizeNumber of bytes to send
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the data was transmitted via the I2C interface. If false, the error code will be returned via the errcode parameter.

◆ IsResourceActive()

bool VMXIO::IsResourceActive ( VMXResourceHandle  resource,
bool &  active,
VMXErrorCode *  errcode = 0 
)

Indicates whether the specified VMXResourceHandle is currently active.

Parameters
resourceThe requested VMXResourceHandle
[out]activetrue if the VMX Resource is currently active
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if resource activation information was successfully returned. If false, the error code will be returned via the errcode parameter.

◆ IsResourceAllocated()

bool VMXIO::IsResourceAllocated ( VMXResourceHandle  resource,
bool &  allocated,
bool &  is_shared,
VMXErrorCode *  errcode = 0 
)

Indicates whether the specified VMXResourceHandle is currently allocated, and whether it is a shared resource.

Parameters
resourceThe requested VMXResourceHandle
[out]allocatedtrue if the VMX Resource is currently allocated
[out]is_sharedtrue if the VMX Resource is currently allocated in "shared" mode
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if resource allocation information was successfully returned. If false, the error code will be returned via the errcode parameter.

◆ PWMGenerator_SetDutyCycle()

bool VMXIO::PWMGenerator_SetDutyCycle ( VMXResourceHandle  pwmgen_res_handle,
VMXResourcePortIndex  port_index,
uint8_t  duty_cycle,
VMXErrorCode *  errcode = 0 
)

Sets the VMX PWM Generator Resource's Duty Cycle to the specified value.

Parameters
pwmgen_res_handleHandle to the activated VMX PWM Generator Resource
port_indexVMXResourcePortIndex of the port on the VMX PWM Generator Resource to modify
duty_cycleThe VMX PWM Generator Resource's Duty Cycle value, which must be in the range 0-255.
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the Encoder count was reset to 0. If false, the error code will be returned via the errcode parameter.

◆ RouteChannelToResource()

bool VMXIO::RouteChannelToResource ( VMXChannelIndex  channel_index,
VMXResourceHandle  resource,
VMXErrorCode *  errcode = 0 
)

Attempts to route the specified VMXChannelIndex to the allocated VMXResourceHandle Note: If the resource requires multiple channels to be allocated to the resource, all channels are routed when the first channel is routed.

Parameters
channel_indexThe VMXChannelIndex to route to the resource
resourceThe VMXResourceHandle to which the VMXChannel should be routed
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX Channel was routed to the VMX resource. If false, the error code will be returned via the errcode parameter.

◆ SetResourceConfig()

bool VMXIO::SetResourceConfig ( VMXResourceHandle  resource,
const VMXResourceConfig p_config,
VMXErrorCode *  errcode = 0 
)

Sets the configuration to the specified VMXResourceHandle.

NOTE: VMX Resources can only be configured after they are allocated and before they are activated.

Parameters
resourceThe VMXResourceHandle to be configured
p_configPointer to the VMXResourceConfig object used to configure the VMX Resource
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if all VMX Channels were unrouted from the VMX resource. If false, the error code will be returned via the errcode parameter.

◆ SPI_Read()

bool VMXIO::SPI_Read ( VMXResourceHandle  spi_res_handle,
uint8_t *  p_rcv_data,
uint16_t  size,
VMXErrorCode *  errcode = 0 
)

Reads data from the specified VMX SPI Resource.

Parameters
spi_res_handleHandle to the activated VMX SPI Resource
p_rcv_dataPointer to the buffer into which to receive data, which must be at least the size specified via the max_size parameter
sizeThe number of bytes to receive. The buffer pointed to by p_data must be large enough to hold at least this number of bytes
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the SPI data was received. If false, the error code will be returned via the errcode parameter.

◆ SPI_Transaction()

bool VMXIO::SPI_Transaction ( VMXResourceHandle  spi_res_handle,
uint8_t *  p_send_data,
uint8_t *  p_rcv_data,
uint16_t  size,
VMXErrorCode *  errcode = 0 
)

Simultaneously Writes/Reads data to/from the specified VMX SPI Resource.

NOTE: This is a blocking call.

Parameters
spi_res_handleHandle to the activated VMX SPI Resource
p_send_dataPointer to the buffer of data to be sent to the SPI resource
p_rcv_dataPointer to the buffer into which receive data read from the SPI resource
sizeNumber of bytes to send/receive
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the data was transmitted/received via the SPI interface. If false, the error code will be returned via the errcode parameter.

◆ SPI_Write()

bool VMXIO::SPI_Write ( VMXResourceHandle  spi_res_handle,
uint8_t *  p_send_data,
uint16_t  size,
VMXErrorCode *  errcode = 0 
)

Writes the specified data to the specified VMX SPI Resource.

NOTE: This is a blocking call.

Parameters
spi_res_handleHandle to the activated VMX SPI Resource
p_send_dataPointer to the buffer of data to be sent
sizeNumber of bytes to send
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the data was transmitted via the SPI interface. If false, the error code will be returned via the errcode parameter.

◆ UART_GetBytesAvailable()

bool VMXIO::UART_GetBytesAvailable ( VMXResourceHandle  reshandle,
uint16_t &  size,
VMXErrorCode *  errcode = 0 
)

Returns the number of data bytes which have been received from VMX UART Resource.

Parameters
reshandleHandle to the activated VMX UART Resource
sizeThe number of received data bytes, which can be read via the VMXIO::UART_Read() method.
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the number of availble UART data bytes was returned. If false, the error code will be returned via the errcode parameter.

◆ UART_Read()

bool VMXIO::UART_Read ( VMXResourceHandle  reshandle,
uint8_t *  p_data,
uint16_t  max_size,
uint16_t &  actual_num_bytes_read,
VMXErrorCode *  errcode = 0 
)

Reads data from the specified VMX UART Resource.

Parameters
reshandleHandle to the activated VMX UART Resource
p_dataPointer to the buffer into which to receive data, which must be at least the size specified via the max_size parameter
max_sizeThe maximum number of bytes to receive. The buffer pointed to by p_data must be large enough to hold at least this number of bytes
[out]actual_num_bytes_readThe actual number of bytes read into the buffer pointed to by p_data
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the UART data was returned. If false, the error code will be returned via the errcode parameter.

◆ UART_Write()

bool VMXIO::UART_Write ( VMXResourceHandle  reshandle,
uint8_t *  p_data,
uint16_t  size,
VMXErrorCode *  errcode = 0 
)

Writes the specified data to the specified VMX UART Resource.

NOTE: This is a blocking call.

Parameters
reshandleHandle to the activated VMX UART Resource
p_dataPointer to the buffer of data to be sent
sizeNumber of bytes to send
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the data was transmitted via the UART. If false, the error code will be returned via the errcode parameter.

◆ UnrouteAllChannelsFromResource()

bool VMXIO::UnrouteAllChannelsFromResource ( VMXResourceHandle  resource,
VMXErrorCode *  errcode = 0 
)

Attempts to unroute all VMX Channels from the allocated VMXResourceHandle.

Parameters
resourceThe VMXResourceHandle to which the VMXChannel should be unrouted
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if all VMX Channels were unrouted from the VMX resource. If false, the error code will be returned via the errcode parameter.

◆ UnrouteChannelFromResource()

bool VMXIO::UnrouteChannelFromResource ( VMXChannelIndex  channel_index,
VMXResourceHandle  resource,
VMXErrorCode *  errcode = 0 
)

Attempts to unroute the specified VMXChannelIndex from the allocated VMXResourceHandle.

Parameters
channel_indexThe VMXChannelIndex to unroute from the resource
resourceThe VMXResourceHandle to which the VMXChannel should be unrouted
[out]errcodePointer to the VMXErrorCode to be returned in case of error; may be null
Returns
Returns true if the VMX Channel was unrouted from the VMX resource. If false, the error code will be returned via the errcode parameter.

The documentation for this class was generated from the following files: