VMX-pi C++ HAL Library for Raspberry Pi
VMX-pi Robotics Controller & Vision/Motion Processor
|
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... | |
VMXChannelIndex | GetSoleChannelIndex (VMXChannelCapability capability) |
Returns the VMXChannelIndex for the single channel which implements the specified capability. More... | |
bool | GetResourceHandle (VMXResourceType resource_type, VMXResourceIndex res_index, VMXResourceHandle &resource_handle, VMXErrorCode *errcode) |
Returns the VMXResourceHandle of the VMX Resource identified by the specified VMXResourceType and VMXResourceIndex. 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 | GetResourceHandleWithAvailablePortForChannel (VMXResourceType resource_type, VMXChannelIndex channel_index, VMXChannelCapability capability, VMXResourceHandle &resource_handle, bool &allocated, VMXErrorCode *errcode) |
bool | GetResourceFromRoutedChannel (VMXChannelIndex channel_index, VMXResourceHandle &handle_out, VMXErrorCode *errcode) |
Retrieves the VMXResourceHandle (if any) to which the specified VMXChannelIndex is routed. More... | |
bool | IsResourceAllocated (VMXResourceHandle resource, bool &allocated, bool &is_shared, VMXErrorCode *errcode) |
Indicates whether the specified VMXResourceHandle is currently allocated, and whether it is a shared resource. More... | |
bool | AllocateResource (VMXResourceHandle resource, VMXErrorCode *errcode) |
Attempts to allocate the specified VMXResourceHandle. More... | |
bool | DeallocateResource (VMXResourceHandle resource, VMXErrorCode *errcode) |
Attempts to deallocate the specified VMXResourceHandle. More... | |
bool | DeallocateAllResources (VMXErrorCode *last_errorcode) |
Attempts to deallocate all currently-allocated VMXResourceHandles. More... | |
bool | RouteChannelToResource (VMXChannelIndex channel, VMXResourceHandle resource, VMXErrorCode *errcode) |
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) |
Attempts to unroute the specified VMXChannelIndex from the allocated VMXResourceHandle. More... | |
bool | UnrouteAllChannelsFromResource (VMXResourceHandle resource, VMXErrorCode *errcode) |
Attempts to unroute all VMX Channels from the allocated VMXResourceHandle. More... | |
bool | GetNumChannelsRoutedToResource (VMXResourceHandle resource, uint8_t &num_routed_channels, VMXErrorCode *errcode) |
bool | SetResourceConfig (VMXResourceHandle resource, const VMXResourceConfig *p_config, VMXErrorCode *errcode) |
Sets the configuration to the specified VMXResourceHandle. More... | |
bool | GetResourceConfig (VMXResourceHandle resource, VMXResourceConfig *&p_config, VMXErrorCode *errcode) |
Gets the configuration of the specified VMXResourceHandle. More... | |
bool | IsResourceActive (VMXResourceHandle, bool &active, VMXErrorCode *errcode) |
Indicates whether the specified VMXResourceHandle is currently active. More... | |
bool | ActivateResource (VMXResourceHandle resource, VMXErrorCode *errcode) |
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) |
Attempts to deactivate the specified VMXResourceHandle. More... | |
bool | ActivateSinglechannelResource (const VMXChannelInfo &channel_info, const VMXResourceConfig *res_cfg, VMXResourceHandle &res_handle, VMXErrorCode *errcode) |
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 | ActivateDualchannelResource (const VMXChannelInfo &ch1, const VMXChannelInfo &ch2, const VMXResourceConfig *res_cfg, VMXResourceHandle &res_handle, VMXErrorCode *errcode) |
Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the two specified VMX Channels to it, then applying the specified configuration, and then finally performing resource activation. More... | |
bool | ActivateQuadchannelResource (const VMXChannelInfo &ch1, const VMXChannelInfo &ch2, const VMXChannelInfo &ch3, const VMXChannelInfo &ch4, const VMXResourceConfig *res_cfg, VMXResourceHandle &res_handle, VMXErrorCode *errcode) |
Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the four specified VMX Channels to it, then applying the specified configuration, and then finally performing resource activation. More... | |
bool | ActivateMultichannelResource (uint8_t num_channels, const VMXChannelInfo *p_channel_infos, const VMXResourceConfig *res_cfg, VMXResourceHandle &res_handle, VMXErrorCode *errcode) |
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) |
Returns the current signal state from a VMX DigitalIO Resource. More... | |
bool | DIO_Set (VMXResourceHandle dio_res_handle, bool high, VMXErrorCode *errcode) |
Sets the current signal state of a VMX DigitalIO Resource in Digital Output mode. More... | |
bool | DIO_Pulse (VMXResourceHandle dio_res_handle, bool high, uint32_t num_microseconds, VMXErrorCode *errcode) |
Begins a timed pulse (with the specified level) on a VMX DigitalIO Resource in Digital Output mode. More... | |
bool | DIO_IsPulsing (VMXResourceHandle dio_res_handle, bool &is_pulsing, VMXErrorCode *errcode) |
Indicates whether a previously-requested pulse is underway (not completed) on a VMX DigitalIO Resource in Digital Output mode. More... | |
bool | DIO_GetNumPulsing (uint8_t &num_pulsing) |
Indicates whether pulsing is underway (not completed) on any DigitalIO Resource in Digital Output mode. More... | |
bool | PWMGenerator_SetDutyCycle (VMXResourceHandle pwmgen_res_handle, VMXResourcePortIndex port_index, uint16_t duty_cycle, VMXErrorCode *errcode) |
Sets the VMX PWM Generator Resource's Duty Cycle to the specified value. More... | |
bool | PWMGenerator_GetDutyCycle (VMXResourceHandle pwmgen_res_handle, VMXResourcePortIndex port_index, uint16_t *duty_cycle, VMXErrorCode *errcode) |
Gets the VMX PWM Generator Resource's current Duty Cycle value. More... | |
bool | InputCapture_GetChannelCounts (VMXResourceHandle pwmcap_res_handle, uint32_t &chan1_counts, uint32_t &chan2_counts, VMXErrorCode *errcode) |
Returns the current Capture count values from a VMX Input Capture Resource. More... | |
bool | InputCapture_InputStatus (VMXResourceHandle inputcap_res_handle, bool &forward_direction, bool &active, VMXErrorCode *errcode) |
Retrieves the status of the InputCapture Resource, including the "forward direction" and "active" states. More... | |
bool | InputCapture_Reset (VMXResourceHandle inputcap_res_handle, VMXErrorCode *errcode) |
Sets the VMX InputCapture Resource's count value to 0. More... | |
bool | InputCapture_GetCount (VMXResourceHandle inputcap_res_handle, int32_t &count, VMXErrorCode *errcode) |
bool | PWMCapture_GetCount (VMXResourceHandle inputcap_res_handle, uint32_t &frequency_us, uint32_t &duty_cycle_us, VMXErrorCode *errcode) |
Returns the current Capture count values from a VMX Input Capture Resource that has been configured for PWMCapture mode (see PWMCaptureConfig class). More... | |
bool | Encoder_GetCount (VMXResourceHandle encoder_res_handle, int32_t &count, VMXErrorCode *errcode) |
Returns the current Encoder count value from a VMX Encoder Resource. More... | |
bool | Encoder_GetDirection (VMXResourceHandle encoder_res_handle, EncoderDirection &direction, VMXErrorCode *errcode) |
Returns the current EncoderDirection value from a VMX Encoder Resource. More... | |
bool | Encoder_Reset (VMXResourceHandle encoder_res_handle, VMXErrorCode *errcode) |
Sets the VMX Encoder Resource's count value to 0. More... | |
bool | Encoder_GetLastPulsePeriodMicroseconds (VMXResourceHandle encoder_res_handle, uint16_t &encoder_curr_avg_pulse_period_microseconds, VMXErrorCode *errcode) |
Returns the average period (in microseconds) of the most recent encoder pulses captured by a VMX Encoder Resource. More... | |
bool | Encoder_SetResetSource (VMXResourceHandle encoder_res_handle, VMXResourceHandle interrupt_res_handle, bool clear_on_level, bool clear_level_high, VMXErrorCode *errcode) |
bool | Encoder_ClearResetSource (VMXResourceHandle encoder_res_handle, VMXErrorCode *errcode) |
bool | Accumulator_GetOversampleValue (VMXResourceHandle accum_res_handle, uint32_t &oversample_value, VMXErrorCode *errcode) |
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) |
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) |
Returns the current instantaneous (non-averaged) value from a VMX Analog Accumulator Resource. More... | |
bool | Accumulator_GetFullScaleVoltage (float &full_scale_voltage, VMXErrorCode *errcode) |
Returns the current VMX Analog Input full-scale voltage level. More... | |
bool | Accumulator_GetAverageVoltage (VMXResourceHandle accum_res_handle, float &average_value, VMXErrorCode *errcode) |
Returns the current averaged value in voltage units from a VMX Analog Accumulator Resource. More... | |
bool | Accumulator_Counter_Reset (VMXResourceHandle accum_res_handle, VMXErrorCode *errcode) |
bool | Accumulator_Counter_GetValueAndCount (VMXResourceHandle accum_res_handle, int64_t &value, uint32_t &count, VMXErrorCode *errcode) |
bool | AnalogTrigger_GetState (VMXResourceHandle antrig_res_handle, AnalogTriggerState &state, VMXErrorCode *errcode) |
Returns the current state from a VMX AnalogTrigger Resource. More... | |
bool | Interrupt_GetLastRisingEdgeTimestampMicroseconds (VMXResourceHandle int_res_handle, uint64_t &last_timestamp, VMXErrorCode *errcode) |
bool | Interrupt_GetLastFallingEdgeTimestampMicroseconds (VMXResourceHandle int_res_handle, uint64_t &last_timestamp, VMXErrorCode *errcode) |
bool | Interrupt_SetEnabled (VMXResourceHandle int_res_handle, bool enabled, VMXErrorCode *errcode) |
bool | Interrupt_GetEnabled (VMXResourceHandle int_res_handle, bool &enabled, VMXErrorCode *errcode) |
bool | UART_Write (VMXResourceHandle uart_res_handle, uint8_t *p_send_data, uint16_t size, VMXErrorCode *errcode) |
Writes the specified data to the specified VMX UART Resource. More... | |
bool | UART_Read (VMXResourceHandle uart_res_handle, uint8_t *p_rcv_data, uint16_t max_size, uint16_t &actual_size_read, VMXErrorCode *errcode) |
Reads data from the specified VMX UART Resource. More... | |
bool | UART_GetBytesAvailable (VMXResourceHandle uart_res_handle, uint16_t &size, VMXErrorCode *errcode) |
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) |
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) |
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) |
Simultaneously Writes/Reads data to/from the specified VMX SPI Resource. More... | |
bool | I2C_Write (VMXResourceHandle i2c_res_handle, uint8_t deviceAddress, uint8_t register_address, uint8_t *p_send_data, int32_t sendSize, VMXErrorCode *errcode) |
Writes the specified data to the specified VMX I2C Resource. More... | |
bool | I2C_Read (VMXResourceHandle i2c_res_handle, uint8_t deviceAddress, uint8_t register_address, uint8_t *p_rcv_data, int32_t count, VMXErrorCode *errcode) |
Reads data from the specified VMX I2C Resource. More... | |
bool | I2C_Transaction (VMXResourceHandle i2c_res_handle, uint8_t deviceAddress, uint8_t *p_send_data, uint16_t sendSize, uint8_t *p_rcv_data, uint16_t receiveSize, VMXErrorCode *errcode) |
Writes and/or Reads data to/from the specified VMX I2C Resource. More... | |
bool | AutoTransmit_Allocate (AutoTransmitEngineHandle &engine_handle_out, VMXErrorCode *errcode) |
Creates the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_Deallocate (AutoTransmitEngineHandle engine_handle, VMXErrorCode *errcode) |
Deallocates the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_StartPeriodic (AutoTransmitEngineHandle engine_handle, VMXResourceHandle spi_res_handle, uint32_t repeat_every_ms, VMXErrorCode *errcode) |
Begins a periodic SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_StartTrigger (AutoTransmitEngineHandle engine_handle, VMXResourceHandle spi_res_handle, VMXChannelIndex input_trigger_channel, InterruptConfig::InterruptEdge edge_type, VMXErrorCode *errcode) |
Defines the "start" trigger condition which will initiate a SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_Stop (AutoTransmitEngineHandle engine_handle, VMXErrorCode *errcode) |
Stops any currently-active periodic SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_SetData (AutoTransmitEngineHandle engine_handle, uint8_t *dataToSend, int32_t request_size, int32_t reply_size, VMXErrorCode *errcode) |
Registers the Data which will be next sent as part of the currently-active periodic SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_Immediate (AutoTransmitEngineHandle engine_handle, VMXErrorCode *errcode) |
Forces the AutoTransmit engine to immediately start a Transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_GetData (AutoTransmitEngineHandle engine_handle, uint8_t *p_rcv_data, int32_t numToRead, uint32_t timeout_ms, int32_t &num_bytes_remaining, VMXErrorCode *errcode) |
Retrieves data most recently received by the AutoTransmit engine during, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission. More... | |
bool | AutoTransmit_GetNumDropped (AutoTransmitEngineHandle engine_handle, int &num_dropped, VMXErrorCode *errcode) |
Returns the number of bytes dropped by the AutoTransmit transfer engine due to the receive buffer being full. More... | |
bool | GetWatchdogEnabled (bool &enabled, VMXErrorCode *errcode) |
Returns whether the IO Watchdog is currently enabled. More... | |
bool | SetWatchdogEnabled (bool enabled, VMXErrorCode *errcode) |
Changes the IO Watchdog enabled state. More... | |
bool | GetWatchdogExpired (bool &expired, VMXErrorCode *errcode) |
Returns whether the IO Watchdog is expired. More... | |
bool | GetWatchdogManagedOutputs (bool &flexdio, bool &hicurrdio, bool &commdio, VMXErrorCode *errcode) |
Returns which output groups are managed by the IO Watchdog. More... | |
bool | SetWatchdogManagedOutputs (bool flexdio, bool hicurrdio, bool commdio, VMXErrorCode *errcode) |
Configures which output groups are managed by the IO Watchdog. More... | |
bool | GetWatchdogTimeoutPeriodMS (uint16_t &timeout_period_ms, VMXErrorCode *errcode) |
Returns the IO Watchdog timeout period. More... | |
bool | SetWatchdogTimeoutPeriodMS (uint16_t timeout_period_ms, VMXErrorCode *errcode) |
Configures the IO Watchdog timeout period. More... | |
bool | FeedWatchdog (VMXErrorCode *errcode) |
"Feeds" the IO Watchdog. More... | |
bool | ExpireWatchdogNow (VMXErrorCode *errcode) |
Forces the IO Watchdog to immediately disable all managed outputs. More... | |
bool | LEDArrayBuffer_Create (int n_pixels, LEDArrayBufferHandle &buffer_handle_out, VMXErrorCode *errcode) |
Creates a new LEDArrayBuffer, which can be later transmitted via a LEDArray resource. More... | |
bool | LEDArrayBuffer_Delete (LEDArrayBufferHandle buffer_handle, VMXErrorCode *errorcode) |
Deallocates a previously-created LEDArrayBuffer. More... | |
bool | LEDArrayBuffer_SetRGBValue (LEDArrayBufferHandle buffer_handle, int index, int r, int g, int b, VMXErrorCode *errocode) |
Modifies the RGB value for a particular "pixel" index within the LEDArrayBuffer. More... | |
bool | LEDArrayBuffer_GetLength (LEDArrayBufferHandle buffer_handle, int &length_out, VMXErrorCode *errcode) |
Returns the length (in "pixels") of the LEDArrayBuffer. More... | |
bool | LEDArrayBuffer_GetRBGValue (LEDArrayBufferHandle buffer_handle, int index, int &r, int &g, int &b, VMXErrorCode *errcode) |
Returns the current RGB value for a particular "pixel" index within the LEDArrayBuffer. More... | |
bool | LEDArray_SetBuffer (VMXResourceHandle led_array_resource_handle, LEDArrayBufferHandle buffer_handle, VMXErrorCode *errcode) |
Registers the specified LEDArrayBuffer with the specified LEDArray. More... | |
bool | LEDArray_Render (VMXResourceHandle led_array_resource_handle, VMXErrorCode *errcode) |
Immediately begins transmitting all RGBValues in the LEDArrayBuffer currently registered with the specified LEDArray. More... | |
bool | LEDArray_Configure (VMXResourceHandle led_array_resource_handle, LEDArray_OneWireConfig &config, VMXErrorCode *errcode) |
Updates the LEDArray Configuration with the parameters specified in the LEDArray_OneWireConfig object. More... | |
Friends | |
class | VMXPi |
class | VMXZero |
The VMXIO class provides access to VMX Analog/Digital IO functions, including VMX Channel and VMX Resource Management and functions.
bool VMXIO::Accumulator_GetAverageValue | ( | VMXResourceHandle | accum_res_handle, |
uint32_t & | average_value, | ||
VMXErrorCode * | errcode | ||
) |
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
accum_res_handle | Handle to the activated VMX Accumulator Resource | |
[out] | average_value | Current Accumulator average value |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Accumulator_GetAverageVoltage | ( | VMXResourceHandle | accum_res_handle, |
float & | average_voltage, | ||
VMXErrorCode * | errcode | ||
) |
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
accum_res_handle | Handle to the activated VMX Accumulator Resource | |
[out] | average_voltage | Current Accumulator average value, in voltage units |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Accumulator_GetFullScaleVoltage | ( | float & | full_scale_voltage, |
VMXErrorCode * | errcode | ||
) |
Returns the current VMX Analog Input full-scale voltage level.
[out] | full_scale_voltage | Current VMX Analog Input full-scale voltage level |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Accumulator_GetInstantaneousValue | ( | VMXResourceHandle | accum_res_handle, |
uint32_t & | instantaneous_value, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current instantaneous (non-averaged) value from a VMX Analog Accumulator Resource.
NOTE: This method bypasses the Accmulator's averaging calculation
accum_res_handle | Handle to the activated VMX Accumulator Resource | |
[out] | instantaneous_value | Current Accumulator average value |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Accumulator_GetOversampleValue | ( | VMXResourceHandle | accum_res_handle, |
uint32_t & | oversample_value, | ||
VMXErrorCode * | errcode | ||
) |
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
accum_res_handle | Handle to the activated VMX Accumulator Resource | |
[out] | oversample_value | Current Accumulator oversample value |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::ActivateDualchannelResource | ( | const VMXChannelInfo & | ch1, |
const VMXChannelInfo & | ch2, | ||
const VMXResourceConfig * | res_cfg, | ||
VMXResourceHandle & | res_handle, | ||
VMXErrorCode * | errcode | ||
) |
Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the two specified VMX Channels to it, then applying the specified configuration, and then finally performing resource activation.
NOTE: This method should be used for dual-channel VMX Resources.
ch1 | The VMXChannelInfo describing the first channel and associated capabilities to route to the VMX Resource | |
ch2 | The VMXChannelInfo describing the second channel and associated capabilities to route to the VMX Resource | |
res_cfg | Pointer to the VMXResourceConfig object used to configure the VMX Resource | |
[out] | res_handle | The requested VMXResourceHandle |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::ActivateMultichannelResource | ( | uint8_t | num_channels, |
const VMXChannelInfo * | p_channel_infos, | ||
const VMXResourceConfig * | res_cfg, | ||
VMXResourceHandle & | res_handle, | ||
VMXErrorCode * | errcode | ||
) |
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.
num_channels | The number of VMXChannelIndexes in the array pointed to by the p_channel_indexes parameter | |
channel_info | The VMXChannelInfo objects describing the channel and associated capabilities to route to the VMX Resource | |
res_cfg | Pointer to the VMXResourceConfig object used to configure the VMX Resource | |
[out] | res_handle | The requested VMXResourceHandle |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::ActivateQuadchannelResource | ( | const VMXChannelInfo & | ch1, |
const VMXChannelInfo & | ch2, | ||
const VMXChannelInfo & | ch3, | ||
const VMXChannelInfo & | ch4, | ||
const VMXResourceConfig * | res_cfg, | ||
VMXResourceHandle & | res_handle, | ||
VMXErrorCode * | errcode | ||
) |
Attempts to activate the specified VMXResourceHandle, by first allocating the resource, then routing the four specified VMX Channels to it, then applying the specified configuration, and then finally performing resource activation.
NOTE: This method should be used for dual-channel VMX Resources.
ch1 | The VMXChannelInfo describing the first channel and associated capabilities to route to the VMX Resource | |
ch2 | The VMXChannelInfo describing the second channel and associated capabilities to route to the VMX Resource | |
ch3 | The VMXChannelInfo describing the third channel and associated capabilities to route to the VMX Resource | |
ch4 | The VMXChannelInfo describing the fourth channel and associated capabilities to route to the VMX Resource | |
res_cfg | Pointer to the VMXResourceConfig object used to configure the VMX Resource | |
[out] | res_handle | The requested VMXResourceHandle |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::ActivateResource | ( | VMXResourceHandle | resource, |
VMXErrorCode * | errcode | ||
) |
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.
resource | The requested VMXResourceHandle | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
Virtual Counter Configuration
bool VMXIO::ActivateSinglechannelResource | ( | const VMXChannelInfo & | channel_info, |
const VMXResourceConfig * | res_cfg, | ||
VMXResourceHandle & | res_handle, | ||
VMXErrorCode * | errcode | ||
) |
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.
channel_info | The VMXChannelInfo describing the channel and associated capabilities to route to the VMX Resource | |
res_cfg | Pointer to the VMXResourceConfig object used to configure the VMX Resource | |
[out] | res_handle | The requested VMXResourceHandle |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AllocateResource | ( | VMXResourceHandle | resource, |
VMXErrorCode * | errcode | ||
) |
Attempts to allocate the specified VMXResourceHandle.
resource | The requested VMXResourceHandle | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AnalogTrigger_GetState | ( | VMXResourceHandle | antrig_res_handle, |
AnalogTriggerState & | state, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current state from a VMX AnalogTrigger Resource.
antrig_res_handle | Handle to the activated VMX Analog Trigger Resource | |
[out] | state | The current AnalogTriggerState of the VMX Analog Trigger Resource |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_Allocate | ( | AutoTransmitEngineHandle & | engine_handle_out, |
VMXErrorCode * | errcode | ||
) |
Creates the AutoTransmit engine, which manages automatic SPI Data Transmission.
NOTE: Only one AutoTransmit Engine instance may be allocated.
[out] | engine_handle_out | Handle to the activate AutoTransmit Engine. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_Deallocate | ( | AutoTransmitEngineHandle | engine_handle, |
VMXErrorCode * | errcode | ||
) |
Deallocates the AutoTransmit engine, which manages automatic SPI Data Transmission.
engine_handle | Handle to the active AutoTransmit Engine. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_GetData | ( | AutoTransmitEngineHandle | engine_handle, |
uint8_t * | p_rcv_data, | ||
int32_t | numToRead, | ||
uint32_t | timeout_ms, | ||
int32_t & | num_bytes_remaining, | ||
VMXErrorCode * | errcode | ||
) |
Retrieves data most recently received by the AutoTransmit engine during, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission.
This function blocks until either numToRead bytes have been read, or a timeout expires. This function may be invoked with a numToRead parameter value of 0, in order to retrieve how many bytes are available without actually copying any data.
engine_handle | Handle to the active AutoTransmit Engine. | |
p_rcv_data | Pointer to the beginning of the buffer to copy the most recently-received data into. | |
numToRead | Maxinum Number of bytes to transfer into the provided buffer. | |
timeout_ms | The maximum number of milliseconds to wait for data to be available. | |
num_bytes_remaining | The number of bytes remaining that can be returned after this function completes. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_GetNumDropped | ( | AutoTransmitEngineHandle | engine_handle, |
int & | num_dropped, | ||
VMXErrorCode * | errcode | ||
) |
Returns the number of bytes dropped by the AutoTransmit transfer engine due to the receive buffer being full.
engine_handle | Handle to the active AutoTransmit Engine. | |
[out] | num_dropped | The number of bytes dropped by the AutoTransmit transfer engine because the receive buffer was full. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_Immediate | ( | AutoTransmitEngineHandle | engine_handle, |
VMXErrorCode * | errcode | ||
) |
Forces the AutoTransmit engine to immediately start a Transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission.
engine_handle | Handle to the active AutoTransmit Engine. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_SetData | ( | AutoTransmitEngineHandle | engine_handle, |
uint8_t * | dataToSend, | ||
int32_t | request_size, | ||
int32_t | reply_size, | ||
VMXErrorCode * | errcode | ||
) |
Registers the Data which will be next sent as part of the currently-active periodic SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission.
engine_handle | Handle to the active AutoTransmit Engine. | |
dataToSend | address of the beginning of the data to be transmitted | |
request_size | The size of the data to be transmitted | |
reply_size | The size of data to be received during the transfer; this value may be 0. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_StartPeriodic | ( | AutoTransmitEngineHandle | engine_handle, |
VMXResourceHandle | spi_res_handle, | ||
uint32_t | repeat_every_ms, | ||
VMXErrorCode * | errcode | ||
) |
Begins a periodic SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission.
engine_handle | Handle to the active AutoTransmit Engine. | |
spi_res_handle | Handle to the SPI Resource with which the periodic SPI transfer will occur | |
repeat_every_ms | The duration (in milliseconds) between each periodic SPI transfer | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_StartTrigger | ( | AutoTransmitEngineHandle | engine_handle, |
VMXResourceHandle | spi_res_handle, | ||
VMXChannelIndex | input_trigger_channel, | ||
InterruptConfig::InterruptEdge | edge_type, | ||
VMXErrorCode * | errcode | ||
) |
Defines the "start" trigger condition which will initiate a SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission.
engine_handle | Handle to the active AutoTransmit Engine. | |
spi_res_handle | Handle to the SPI Resource with which the periodic SPI transfer will occur | |
input_trigger_channel | VMXChannelIndex of the trigger source | |
edge_type | The InterruptEdge type which will trigger the transfer | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::AutoTransmit_Stop | ( | AutoTransmitEngineHandle | engine_handle, |
VMXErrorCode * | errcode | ||
) |
Stops any currently-active periodic SPI transfer, managed by the AutoTransmit engine, which manages automatic SPI Data Transmission.
engine_handle | Handle to the active AutoTransmit Engine. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::ChannelSupportsCapability | ( | VMXChannelIndex | channel_index, |
VMXChannelCapability | capability | ||
) |
Indicates whether the specified VMXChannelIndex supports the specified VMXChannelCapability.
channel_index | The requested VMXChannelIndex |
capability | The returned VMXChannelCapability |
bool VMXIO::DeactivateResource | ( | VMXResourceHandle | resource, |
VMXErrorCode * | errcode | ||
) |
Attempts to deactivate the specified VMXResourceHandle.
This will disable any output activity or input electrical activity - but leave channels routed if any.
resource | The requested VMXResourceHandle | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::DeallocateAllResources | ( | VMXErrorCode * | errcode | ) |
Attempts to deallocate all currently-allocated VMXResourceHandles.
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::DeallocateResource | ( | VMXResourceHandle | resource, |
VMXErrorCode * | errcode | ||
) |
Attempts to deallocate the specified VMXResourceHandle.
resource | The requested VMXResourceHandle | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::DIO_Get | ( | VMXResourceHandle | dio_res_handle, |
bool & | high, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current signal state from a VMX DigitalIO Resource.
dio_res_handle | Handle to the activated VMX DigitalIO Resource | |
[out] | high | true if the signal state is HIGH, false if it is LOW |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::DIO_GetNumPulsing | ( | uint8_t & | num_pulsing | ) |
Indicates whether pulsing is underway (not completed) on any DigitalIO Resource in Digital Output mode.
num_pulsing | The number of DigitalIO channels on which pulsing is underway | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::DIO_IsPulsing | ( | VMXResourceHandle | dio_res_handle, |
bool & | is_pulsing, | ||
VMXErrorCode * | errcode | ||
) |
Indicates whether a previously-requested pulse is underway (not completed) on a VMX DigitalIO Resource in Digital Output mode.
dio_res_handle | Handle to the activated VMX DigitalIO Resource | |
is_pulsing | set to true to pulse is active, false otherwise | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::DIO_Pulse | ( | VMXResourceHandle | dio_res_handle, |
bool | high, | ||
uint32_t | num_microseconds, | ||
VMXErrorCode * | errcode | ||
) |
Begins a timed pulse (with the specified level) on a VMX DigitalIO Resource in Digital Output mode.
Note: Pulse periods <= 100 microseconds are highly accurate, and will block for HighCurrDIO/CommDIOs. Pulse periods > 100 microseconds exibit lower timing accuracy, and may take up to 1 millisecond to terminate, however this call will not block.
dio_res_handle | Handle to the activated VMX DigitalIO Resource | |
high | true to pulse HIGH, false to pulse low | |
num_microseconds | The duration of the pulse. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::DIO_Set | ( | VMXResourceHandle | dio_res_handle, |
bool | high, | ||
VMXErrorCode * | errcode | ||
) |
Sets the current signal state of a VMX DigitalIO Resource in Digital Output mode.
dio_res_handle | Handle to the activated VMX DigitalIO Resource | |
high | true to set the signal state HIGH, false to set it to LOW | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Encoder_GetCount | ( | VMXResourceHandle | encoder_res_handle, |
int32_t & | count, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current Encoder count value from a VMX Encoder Resource.
encoder_res_handle | Handle to the activated VMX Encoder Resource | |
[out] | count | Current encoder count value, which may be negative or positive. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Encoder_GetDirection | ( | VMXResourceHandle | encoder_res_handle, |
EncoderDirection & | direction, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current EncoderDirection value from a VMX Encoder Resource.
encoder_res_handle | Handle to the activated VMX Encoder Resource | |
[out] | direction | Current encoder direction |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Encoder_GetLastPulsePeriodMicroseconds | ( | VMXResourceHandle | encoder_res_handle, |
uint16_t & | encoder_curr_avg_pulse_period_microseconds, | ||
VMXErrorCode * | errcode | ||
) |
Returns the average period (in microseconds) of the most recent encoder pulses captured by a VMX Encoder Resource.
The period over which averaging occurs is approximately the last 50 microseconds.
For all encoding types (x4, x2, x1), this represents the active "high" period of the "A source" signal.
encoder_res_handle | Handle to the activated VMX Encoder Resource | |
[out] | encoder_curr_avg_pulse_period_microseconds | Current avg pulse period (microseconds) |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::Encoder_Reset | ( | VMXResourceHandle | encoder_res_handle, |
VMXErrorCode * | errcode | ||
) |
Sets the VMX Encoder Resource's count value to 0.
encoder_res_handle | Handle to the activated VMX Encoder Resource | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::ExpireWatchdogNow | ( | VMXErrorCode * | errcode | ) |
Forces the IO Watchdog to immediately disable all managed outputs.
Any active PWM Generators are set to output one final period with a low signal before the managed outputs are disabled, to ensure that a truncated pulse is not generated. In this case, a delay of up to the longest PWM frequency is inserted before all managed outputs are disabled, causing the current thread to be blocked for that period of time.
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::FeedWatchdog | ( | VMXErrorCode * | errcode | ) |
"Feeds" the IO Watchdog.
All outputs managed by the IO Watchdog will be automatically disabled if "FeedWatchdog()" is not regularly invoked once every IO Watchdog Timeout Period.
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::GetChannelCapabilities | ( | VMXChannelIndex | channel_index, |
VMXChannelType & | channel_type, | ||
VMXChannelCapability & | capability_bits | ||
) |
Returns the VMXChannelType and VMXChannelCapability for the specified VMXChannelIndex.
channel_index | The requested VMXChannelIndex | |
[out] | channel_type | The returned VMXChannelType |
[out] | capability_bits | The return VMXChannelCapability. Note that multiple capability bits may be set. |
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.
resource_handle | The requested VMXResourceHandle. | |
[out] | first_channel_index | The first VMXChannelIndex compatible with the specified VMXResourceHandle |
[out] | num_channels | The number of VMXChannels compatible with the specified VMXResourceHandle |
uint8_t VMXIO::GetNumChannelsByCapability | ( | VMXChannelCapability | channel_capability | ) |
Returns the number of VMX Channels of the specified VMXChannelCapability.
channel_capability | The requested VMXChannelCapability. |
uint8_t VMXIO::GetNumChannelsByType | ( | VMXChannelType | channel_type, |
VMXChannelIndex & | first_channel_index | ||
) |
Returns the number of VMX Channels of the specified VMXChannelType.
channel_type | The requested VMXChannelType. |
first_channel_index | The first VMXChannelIndex of the requested type. |
uint8_t VMXIO::GetNumResourcesByType | ( | VMXResourceType | resource_type | ) |
Returns the number of VMX Resources of the specified VMXResourceType.
resource_type | The requested VMXResourceType. |
bool VMXIO::GetResourceConfig | ( | VMXResourceHandle | resource, |
VMXResourceConfig *& | p_config, | ||
VMXErrorCode * | errcode | ||
) |
Gets the configuration of the specified VMXResourceHandle.
resource | The VMXResourceHandle to acquire configuration from | |
p_config | Pointer to the VMXResourceConfig object which will contain the retrieved configuration | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::GetResourceFromRoutedChannel | ( | VMXChannelIndex | channel_index, |
VMXResourceHandle & | res_handle_out, | ||
VMXErrorCode * | errcode | ||
) |
Retrieves the VMXResourceHandle (if any) to which the specified VMXChannelIndex is routed.
channel_index | The index of the VMXChannel to query | |
[out] | res_handle_out | The VMXResourceHandle VMXResourceHandle of the resource to which the queried channel_index is routed. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::GetResourceHandle | ( | VMXResourceType | resource_type, |
VMXResourceIndex | res_index, | ||
VMXResourceHandle & | resource_handle, | ||
VMXErrorCode * | errcode | ||
) |
Returns the VMXResourceHandle of the VMX Resource identified by the specified VMXResourceType and VMXResourceIndex.
resource_type | The requested VMXResourceType. | |
res_index | The requested VMXResourceIndex. | |
[out] | resource_handle | The returned VMXResourceHandle, if successful |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
VMXChannelIndex VMXIO::GetSoleChannelIndex | ( | VMXChannelCapability | capability | ) |
Returns the VMXChannelIndex for the single channel which implements the specified capability.
If no channels implement this capability, or if more than one channel implements this capability, VMX_INVALID_CHANNEL_INDEX is returned.
bool VMXIO::GetWatchdogEnabled | ( | bool & | enabled, |
VMXErrorCode * | errcode | ||
) |
Returns whether the IO Watchdog is currently enabled.
[out] | enabled | returns True if the IO Watchdog is enabled, false otherwise. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::GetWatchdogExpired | ( | bool & | expired, |
VMXErrorCode * | errcode | ||
) |
Returns whether the IO Watchdog is expired.
[out] | expired | returns True if the IO Watchdog is expired, false otherwise. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::GetWatchdogManagedOutputs | ( | bool & | flexdio, |
bool & | hicurrdio, | ||
bool & | commdio, | ||
VMXErrorCode * | errcode | ||
) |
Returns which output groups are managed by the IO Watchdog.
[out] | flexdio | returns True the FlexDIO output is managed by the IO Watchdog. |
[out] | hicurrdio | returns True the HighCurrentDIO output is managed by the IO Watchdog. |
[out] | commdio | returns True the CommDIO output is managed by the IO Watchdog. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::GetWatchdogTimeoutPeriodMS | ( | uint16_t & | timeout_period_ms, |
VMXErrorCode * | errcode | ||
) |
Returns the IO Watchdog timeout period.
All outputs managed by the IO Watchdog will be automatically disabled if "FeedWatchdog()" is not regularly invoked at this frequency.
[out] | timeout_period_ms | The current IO Watchdog timeout period, in milliseconds. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::I2C_Read | ( | VMXResourceHandle | i2c_res_handle, |
uint8_t | deviceAddress, | ||
uint8_t | register_address, | ||
uint8_t * | buffer, | ||
int32_t | count, | ||
VMXErrorCode * | errcode | ||
) |
Reads data from the specified VMX I2C Resource.
NOTE: This is a blocking call.
i2c_res_handle | Handle to the activated VMX I2C Resource | |
deviceAddress | 7-bit I2C address of the I2C device | |
buffer | Pointer to the buffer into which received data is placed | |
count | Number of bytes to receive | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
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 | ||
) |
Writes and/or Reads data to/from the specified VMX I2C Resource.
If both writing and reading are requested, the write occurs first before the read. NOTE: This is a blocking call.
i2c_res_handle | Handle to the activated VMX I2c Resource | |
deviceAddress | 7-bit I2C address of the I2C device | |
dataToSend | Pointer to the buffer of data to be sent to the SPI resource This parameter value should be NULL if writing should not occur. | |
sendSize | Number of bytes to send. The dataToSend parameter must point to a buffer whose length is at least this value. This value should be 0 if writing should not occur. | |
dataReceived | Pointer to the buffer into which receive data read from the SPI resource. This parameter value should be NULL if reading should not occur. | |
receiveSize | Number of bytes to receive. The dataReceived parameter must point to a buffer whose length is at least this value. This parameter value should be 0 if reading should not occur. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::I2C_Write | ( | VMXResourceHandle | i2c_res_handle, |
uint8_t | deviceAddress, | ||
uint8_t | register_address, | ||
uint8_t * | dataToSend, | ||
int32_t | sendSize, | ||
VMXErrorCode * | errcode | ||
) |
Writes the specified data to the specified VMX I2C Resource.
NOTE: This is a blocking call.
i2c_res_handle | Handle to the activated VMX I2C Resource | |
deviceAddress | 7-bit I2C address of the I2C device | |
dataToSend | Pointer to the buffer of data to be sent | |
sendSize | Number of bytes to send | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::InputCapture_GetChannelCounts | ( | VMXResourceHandle | inputcap_res_handle, |
uint32_t & | chan1_counts, | ||
uint32_t & | chan2_counts, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current Capture count values from a VMX Input Capture Resource.
inputcap_res_handle | Handle to the activated VMX Input Capture Resource | |
[out] | chan1_counts | Current Input Capture Channel 1 counts (unitless) |
[out] | chan2_counts | Current Input Capture Channel 2 counts (unitless) |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::InputCapture_InputStatus | ( | VMXResourceHandle | inputcap_res_handle, |
bool & | forward_direction, | ||
bool & | active, | ||
VMXErrorCode * | errcode | ||
) |
Retrieves the status of the InputCapture Resource, including the "forward direction" and "active" states.
inputcp_res_handle | Handle to the activated VMX InputCapture Resource | |
[out] | forward_direction | True if the InputCapture Resource is rotating in a forward direction, false if in a reverse direction. |
[out] | active | True if the InputCapture Resource has recently detected activity (e.g., change in count due to rotation) |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::InputCapture_Reset | ( | VMXResourceHandle | inputcap_res_handle, |
VMXErrorCode * | errcode | ||
) |
Sets the VMX InputCapture Resource's count value to 0.
inputcp_res_handle | Handle to the activated VMX InputCapture Resource | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::IsResourceActive | ( | VMXResourceHandle | resource, |
bool & | active, | ||
VMXErrorCode * | errcode | ||
) |
Indicates whether the specified VMXResourceHandle is currently active.
resource | The requested VMXResourceHandle | |
[out] | active | true if the VMX Resource is currently active |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::IsResourceAllocated | ( | VMXResourceHandle | resource, |
bool & | allocated, | ||
bool & | is_shared, | ||
VMXErrorCode * | errcode | ||
) |
Indicates whether the specified VMXResourceHandle is currently allocated, and whether it is a shared resource.
resource | The requested VMXResourceHandle | |
[out] | allocated | true if the VMX Resource is currently allocated |
[out] | is_shared | true if the VMX Resource is currently allocated in "shared" mode |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArray_Configure | ( | VMXResourceHandle | led_array_resource_handle, |
LEDArray_OneWireConfig & | config, | ||
VMXErrorCode * | errcode | ||
) |
Updates the LEDArray Configuration with the parameters specified in the LEDArray_OneWireConfig object.
NOTE: All configuration changes must be made before the first invocation of LEDArray_Render(). Once rendering has started, configuration changes are no longer allowed.
led_array_resource_handle | VMXResourceHandle of the currently allocated LEDArray Driver Resource. | |
config | The LEDArray_OneWireConfig object containing the parameters with which to configure the LEDArray. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArray_Render | ( | VMXResourceHandle | led_array_resource_handle, |
VMXErrorCode * | errcode | ||
) |
Immediately begins transmitting all RGBValues in the LEDArrayBuffer currently registered with the specified LEDArray.
led_array_resource_handle | VMXResourceHandle of the currently allocated LEDArray Driver Resource. During the rendering, the caller will block. The LEDArrayBuffer may be accessed (e.g., via LEDArrayBuffer_SetRGBValue) during the rendering, however there is no guarantee if whether any modifications made during this period will be transmitted during the current call to LEDArray_Render(). | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArray_SetBuffer | ( | VMXResourceHandle | led_array_resource_handle, |
LEDArrayBufferHandle | buffer_handle, | ||
VMXErrorCode * | errcode | ||
) |
Registers the specified LEDArrayBuffer with the specified LEDArray.
Once registered, the underlying LEDArray hardware will be updated using the RGB Values contained within the LEDArrayBuffer.
index | The index of the pixel to access within the LEDArray. This index must be less than the size of the LEDArrayBuffer. | |
[out] | red | The intensity value of the Red component of the RGB triplet for the specified pixel. |
[out] | green | The intensity value of the Green component of the RGB triplet for the specified pixel. |
[out] | blue | The intensity value of the Blue component of the RGB triplet for the specified pixel. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArrayBuffer_Create | ( | int | n_pixels, |
LEDArrayBufferHandle & | buffer_handle_out, | ||
VMXErrorCode * | errcode | ||
) |
Creates a new LEDArrayBuffer, which can be later transmitted via a LEDArray resource.
Each LEDArrayBuffer contains a number of RGB Values, which can be accessed via various LEDArrayBuffer functions.
n_pixels | The number of "pixels" (RGB values) to be contained within the newly-created buffer. | |
[out] | buffer_handle_out | An opaque handle to the newly-created LEDArrayBuffer. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArrayBuffer_Delete | ( | LEDArrayBufferHandle | buffer_handle, |
VMXErrorCode * | errorcode | ||
) |
Deallocates a previously-created LEDArrayBuffer.
All memory associated with the LEDArrayBuffer will be deallocated. contains a number of RGB Values, which can be accessed via various LEDArrayBuffer functions. If this buffer had been previously associated with an LEDArray (via LEDArray_SetBuffer()), it will be automatically disasociated from the LEDArray at this time.
n_pixels | The number of "pixels" (RGB values) to be contained within the newly-created buffer. | |
[out] | buffer_handle_out | An opaque handle to the newly-created LEDArrayBuffer. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArrayBuffer_GetLength | ( | LEDArrayBufferHandle | buffer_handle, |
int & | length_out, | ||
VMXErrorCode * | errcode | ||
) |
Returns the length (in "pixels") of the LEDArrayBuffer.
[out] | length_out | The number of RGB Values (one for each "pixel") represented by the LEDArrayBuffer. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArrayBuffer_GetRBGValue | ( | LEDArrayBufferHandle | buffer_handle, |
int | index, | ||
int & | red, | ||
int & | green, | ||
int & | blue, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current RGB value for a particular "pixel" index within the LEDArrayBuffer.
index | The index of the pixel to access within the LEDArray. This index must be less than the size of the LEDArrayBuffer. | |
[out] | red | The intensity value of the Red component of the RGB triplet for the specified pixel. |
[out] | green | The intensity value of the Green component of the RGB triplet for the specified pixel. |
[out] | blue | The intensity value of the Blue component of the RGB triplet for the specified pixel. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::LEDArrayBuffer_SetRGBValue | ( | LEDArrayBufferHandle | buffer_handle, |
int | index, | ||
int | red, | ||
int | green, | ||
int | blue, | ||
VMXErrorCode * | errcode | ||
) |
Modifies the RGB value for a particular "pixel" index within the LEDArrayBuffer.
index | The index of the pixel to modify within the LEDArray. This index must be less than the size of the LEDArrayBuffer. | |
red | The intensity value of the Red component of the RGB triplet for the specified pixel. | |
green | The intensity value of the Green component of the RGB triplet for the specified pixel. | |
blue | The intensity value of the Blue component of the RGB triplet for the specified pixel. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::PWMCapture_GetCount | ( | VMXResourceHandle | inputcap_res_handle, |
uint32_t & | frequency_us, | ||
uint32_t & | duty_cycle_us, | ||
VMXErrorCode * | errcode | ||
) |
Returns the current Capture count values from a VMX Input Capture Resource that has been configured for PWMCapture mode (see PWMCaptureConfig class).
inputcap_res_handle | Handle to the activated VMX Input Capture Resource | |
[out] | frequency_us | Current Input Capture frequency period, in microseconds |
[out] | duty_cycle_us | Current Input Capture duty cycle period, in microseconds |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::PWMGenerator_GetDutyCycle | ( | VMXResourceHandle | pwmgen_res_handle, |
VMXResourcePortIndex | port_index, | ||
uint16_t * | p_duty_cycle, | ||
VMXErrorCode * | errcode | ||
) |
Gets the VMX PWM Generator Resource's current Duty Cycle value.
pwmgen_res_handle | Handle to the activated VMX PWM Generator Resource | |
port_index | VMXResourcePortIndex of the port on the VMX PWM Generator Resource to modify | |
duty_cycle | Pointer to the PWM Generator Resource's Duty Cycle value, which will be returned from this function. This will be a value from 0 to MaxDutyCycleValue (which was previously configured via PWMGeneratorConfig). | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null. To convert this duty cycle value to the amount of "active" time (the PWM Pulse Length) multiply the duty cycle times 1 second / PWM Frequency (Hz) / (max_duty_cycle + 1). E.g., at 200Hz PWM Frequency a duty_cycle of 10 with a max duty cycle of 255 = 10 * 1/200/(255+1) = .000195 seconds = 195 microseconds. |
bool VMXIO::PWMGenerator_SetDutyCycle | ( | VMXResourceHandle | pwmgen_res_handle, |
VMXResourcePortIndex | port_index, | ||
uint16_t | duty_cycle, | ||
VMXErrorCode * | errcode | ||
) |
Sets the VMX PWM Generator Resource's Duty Cycle to the specified value.
pwmgen_res_handle | Handle to the activated VMX PWM Generator Resource | |
port_index | VMXResourcePortIndex of the port on the VMX PWM Generator Resource to modify | |
duty_cycle | The VMX PWM Generator Resource's Duty Cycle value, which must be in the range 0-MaxDutyCycleValue (which was previously configured via PWMGeneratorConfig). To convert this duty cycle value to the amount of "active" time (the PWM Pulse Length) multiply the duty cycle times 1 second / PWM Frequency (Hz) / (max_duty_cycle + 1). E.g., at 200Hz PWM Frequency a duty_cycle of 10 with a max duty cycle of 255 = 10 * 1/200/(255+1) = .000195 seconds = 195 microseconds. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::RouteChannelToResource | ( | VMXChannelIndex | channel_index, |
VMXResourceHandle | resource, | ||
VMXErrorCode * | errcode | ||
) |
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.
channel_index | The VMXChannelIndex to route to the resource | |
resource | The VMXResourceHandle to which the VMXChannel should be routed | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::SetResourceConfig | ( | VMXResourceHandle | resource, |
const VMXResourceConfig * | p_config, | ||
VMXErrorCode * | errcode | ||
) |
Sets the configuration to the specified VMXResourceHandle.
NOTE: VMX Resources can only be configured after they are allocated and before they are activated.
resource | The VMXResourceHandle to be configured | |
p_config | Pointer to the VMXResourceConfig object used to configure the VMX Resource | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::SetWatchdogEnabled | ( | bool | enabled, |
VMXErrorCode * | errcode | ||
) |
Changes the IO Watchdog enabled state.
[out] | enabled | returns True if the IO Watchdog should be enabled, false if it should be disabled. |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::SetWatchdogManagedOutputs | ( | bool | flexdio, |
bool | hicurrdio, | ||
bool | commdio, | ||
VMXErrorCode * | errcode | ||
) |
Configures which output groups are managed by the IO Watchdog.
flexdio | If True, the FlexDIO output is managed by the IO Watchdog. | |
hicurrdio | If True, the HighCurrentDIO output is managed by the IO Watchdog. | |
commdio | If True, the CommDIO output is managed by the IO Watchdog. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::SetWatchdogTimeoutPeriodMS | ( | uint16_t | timeout_period_ms, |
VMXErrorCode * | errcode | ||
) |
Configures the IO Watchdog timeout period.
All outputs managed by the IO Watchdog will be automatically disabled if "FeedWatchdog()" is not regularly invoked at this frequency.
timeout_period_ms | The IO Watchdog timeout period, in milliseconds. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::SPI_Read | ( | VMXResourceHandle | spi_res_handle, |
uint8_t * | p_rcv_data, | ||
uint16_t | size, | ||
VMXErrorCode * | errcode | ||
) |
Reads data from the specified VMX SPI Resource.
spi_res_handle | Handle to the activated VMX SPI Resource | |
p_rcv_data | Pointer to the buffer into which to receive data, which must be at least the size specified via the max_size parameter | |
size | The 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] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::SPI_Transaction | ( | VMXResourceHandle | spi_res_handle, |
uint8_t * | p_send_data, | ||
uint8_t * | p_rcv_data, | ||
uint16_t | size, | ||
VMXErrorCode * | errcode | ||
) |
Simultaneously Writes/Reads data to/from the specified VMX SPI Resource.
NOTE: This is a blocking call.
spi_res_handle | Handle to the activated VMX SPI Resource | |
p_send_data | Pointer to the buffer of data to be sent to the SPI resource | |
p_rcv_data | Pointer to the buffer into which receive data read from the SPI resource | |
size | Number of bytes to send/receive | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::SPI_Write | ( | VMXResourceHandle | spi_res_handle, |
uint8_t * | p_send_data, | ||
uint16_t | size, | ||
VMXErrorCode * | errcode | ||
) |
Writes the specified data to the specified VMX SPI Resource.
NOTE: This is a blocking call.
spi_res_handle | Handle to the activated VMX SPI Resource | |
p_send_data | Pointer to the buffer of data to be sent | |
size | Number of bytes to send | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::UART_GetBytesAvailable | ( | VMXResourceHandle | reshandle, |
uint16_t & | size, | ||
VMXErrorCode * | errcode | ||
) |
Returns the number of data bytes which have been received from VMX UART Resource.
reshandle | Handle to the activated VMX UART Resource | |
size | The number of received data bytes, which can be read via the VMXIO::UART_Read() method. | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::UART_Read | ( | VMXResourceHandle | reshandle, |
uint8_t * | p_data, | ||
uint16_t | max_size, | ||
uint16_t & | actual_num_bytes_read, | ||
VMXErrorCode * | errcode | ||
) |
Reads data from the specified VMX UART Resource.
reshandle | Handle to the activated VMX UART Resource | |
p_data | Pointer to the buffer into which to receive data, which must be at least the size specified via the max_size parameter | |
max_size | The 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_read | The actual number of bytes read into the buffer pointed to by p_data |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::UART_Write | ( | VMXResourceHandle | reshandle, |
uint8_t * | p_data, | ||
uint16_t | size, | ||
VMXErrorCode * | errcode | ||
) |
Writes the specified data to the specified VMX UART Resource.
NOTE: This is a blocking call.
reshandle | Handle to the activated VMX UART Resource | |
p_data | Pointer to the buffer of data to be sent | |
size | Number of bytes to send | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::UnrouteAllChannelsFromResource | ( | VMXResourceHandle | resource, |
VMXErrorCode * | errcode | ||
) |
Attempts to unroute all VMX Channels from the allocated VMXResourceHandle.
resource | The VMXResourceHandle to which the VMXChannel should be unrouted | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |
bool VMXIO::UnrouteChannelFromResource | ( | VMXChannelIndex | channel_index, |
VMXResourceHandle | resource, | ||
VMXErrorCode * | errcode | ||
) |
Attempts to unroute the specified VMXChannelIndex from the allocated VMXResourceHandle.
channel_index | The VMXChannelIndex to unroute from the resource | |
resource | The VMXResourceHandle to which the VMXChannel should be unrouted | |
[out] | errcode | Pointer to the VMXErrorCode to be returned in case of error; may be null |