22 #ifndef VMXRESOURCECONFIG_H_ 23 #define VMXRESOURCECONFIG_H_ 26 #include "VMXHandlers.h" 36 this->res_type = res_type;
62 VMXIO_InterruptHandler p_handler;
67 edge = InterruptEdge::RISING;
76 InterruptConfig(InterruptEdge edge, VMXIO_InterruptHandler p_handler,
void *p_param) :
79 this->p_handler = p_handler;
80 this->p_param = p_param;
84 VMXIO_InterruptHandler
GetHandler() {
return p_handler; }
91 void SetHandler(VMXIO_InterruptHandler p_handler) { this->p_handler = p_handler; }
93 void SetParam(
void *p_param) { this->p_param = p_param; }
95 void SetEdge(InterruptEdge edge) { this->edge = edge; }
123 OutputMode outputmode;
129 outputmode = OutputMode::PUSHPULL;
130 inputmode = InputMode::PULLUP;
138 this->inputmode = inputmode;
139 this->outputmode = OutputMode::PUSHPULL;
147 this->inputmode = InputMode::NONE;
148 this->outputmode = outputmode;
165 void SetInputMode(InputMode inputmode) { this->inputmode = inputmode; }
167 void SetOutputMode(OutputMode outputmode) { this->outputmode = outputmode; }
186 uint32_t frequency_hz;
196 this->frequency_hz = frequency_hz;
205 void SetFrequencyHz(uint32_t frequency_hz) { this->frequency_hz = frequency_hz; }
226 CaptureEdge edge_type;
230 edge_type = CaptureEdge::RISING;
236 this->edge_type = edge_type;
264 EncoderEdge edge_count;
268 edge_count = EncoderEdge::x4;
300 uint8_t num_average_bits;
301 uint8_t num_oversample_bits;
305 num_oversample_bits = 3;
306 num_average_bits = 3;
314 this->num_oversample_bits = num_oversample_bits;
315 this->num_average_bits = num_average_bits;
358 uint16_t threshold_high;
359 uint16_t threshold_low;
360 AnalogTriggerMode mode;
364 threshold_high = 992;
365 threshold_low = 2482;
366 mode = AnalogTriggerMode::STATE;
375 this->threshold_high = threshold_high;
376 this->threshold_low = threshold_low;
392 void SetMode(AnalogTriggerMode mode) { this->mode = mode; }
411 uint32_t baudrate_bps;
415 baudrate_bps = 57600;
421 this->baudrate_bps = baudrate_bps;
428 void SetBaudrate(uint32_t baudrate_bps) { this->baudrate_bps = baudrate_bps; }
447 uint32_t bitrate_bps;
454 bitrate_bps = 1000000;
456 cs_active_low =
true;
463 bitrate_bps = bitrate;
465 cs_active_low =
true;
475 SPIConfig(uint32_t bitrate, uint8_t mode,
bool cs_active_low,
bool msbfirst) :
478 this->bitrate_bps = bitrate;
480 this->cs_active_low = cs_active_low;
481 this->msbfirst = msbfirst;
496 void SetBitrate(uint32_t bitrate) { this->bitrate_bps = bitrate; }
500 void SetMode(uint8_t mode) { this->mode = mode % 4; }
EncoderEdge
Specifies whether the encoder counter is invoked on every edge, every other edge, or every fourth edg...
Definition: VMXResourceConfig.h:263
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:430
VMX Resource providing Quadrature Encoder of a VMX Channel pair in input mode.
Definition: VMXResource.h:42
Analog Trigger Events are level-triggered (occurring as long as the signal is high) ...
Definition: VMXResourceConfig.h:351
AccumulatorConfig()
AccumulatorConfig default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:304
void * GetParam()
Retrieves the interrupt handler parameter.
Definition: VMXResourceConfig.h:86
DIOConfig()
DIOConfig default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:127
void SetCaptureEdge(CaptureEdge edge)
Sets the configured PWM CaptureEdge.
Definition: VMXResourceConfig.h:243
CaptureEdge
Specifies which PWM input signal edge starts the PWM duty cycle timer.
Definition: VMXResourceConfig.h:225
Contains the configuration data for a VMXResource whose VMXResourceType is I2C.
Definition: VMXResourceConfig.h:522
VMX Resource providing Digital Input and Digital Output Control on a VMX Digital Channel.
Definition: VMXResource.h:36
Contains the configuration data for a VMXResource whose VMXResourceType is DigitalIO.
Definition: VMXResourceConfig.h:114
DIOConfig(OutputMode outputmode)
DIOConfig constructor; initializes values with the provided parameters *.
Definition: VMXResourceConfig.h:144
Base structure representing VMXResourceType-specific configuration data that must be set to a valid d...
Definition: VMXResourceConfig.h:33
VMXIO_InterruptHandler GetHandler()
Retrieves the interrupt handler.
Definition: VMXResourceConfig.h:84
InterruptConfig(InterruptEdge edge, VMXIO_InterruptHandler p_handler, void *p_param)
InterruptConfig constructor; initializes values with the provided input parameters *...
Definition: VMXResourceConfig.h:76
void SetHandler(VMXIO_InterruptHandler p_handler)
Sets the interrupt handler.
Definition: VMXResourceConfig.h:91
uint8_t GetNumOversampleBits()
Returns the configured number of oversample bits.
Definition: VMXResourceConfig.h:324
UARTConfig()
UARTConfig default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:414
InterruptConfig()
InterruptConfig default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:66
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:531
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:245
AnalogTriggerMode GetMode()
Returns the configured AnalogTriggerMode.
Definition: VMXResourceConfig.h:385
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:288
uint16_t GetThresholdLow()
Returns the low threshold, which is a 12-bit value (0-4095) representing the highest-possible voltage...
Definition: VMXResourceConfig.h:383
void SetOutputMode(OutputMode outputmode)
Specifies the output mode.
Definition: VMXResourceConfig.h:167
EncoderEdge GetEncoderEdge()
Returns the configured EncoderEdge.
Definition: VMXResourceConfig.h:278
void SetInputMode(InputMode inputmode)
Specifies the input mode.
Definition: VMXResourceConfig.h:165
EncoderConfig()
EncoderConfig default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:267
SPIConfig(uint32_t bitrate, uint8_t mode, bool cs_active_low, bool msbfirst)
SPIConfig constructor; initializes values with the provided input parameters *.
Definition: VMXResourceConfig.h:475
void SetEdge(InterruptEdge edge)
Sets the signal edge which generates the interrupt.
Definition: VMXResourceConfig.h:95
void SetMode(AnalogTriggerMode mode)
Sets the configured AnalogTriggerMode.
Definition: VMXResourceConfig.h:392
PWMCaptureConfig()
PWMCaptureConfig default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:229
VMX Resource providing I2C communication via a VMX Channel pair.
Definition: VMXResource.h:54
UARTConfig(uint32_t baudrate_bps)
UARTConfig constructor; initializes values with the provided input parameters.
Definition: VMXResourceConfig.h:420
InputMode
Specifies the default signal state of a floating DigitalIO in input mode.
Definition: VMXResourceConfig.h:118
VMX Resource providing Interrupt generation from a VMX Analog Input Channel.
Definition: VMXResource.h:46
Contains the configuration data for a VMXResource whose VMXResourceType is PWMCaptureConfig.
Definition: VMXResourceConfig.h:223
Analog Trigger Events occur when a low-to-high transition is detected.
Definition: VMXResourceConfig.h:353
VMX Resource providing SPI communication via a four VMX Channel set.
Definition: VMXResource.h:52
InterruptEdge
Specifies which signal edge will generate an interrupt.
Definition: VMXResourceConfig.h:59
AnalogTriggerMode
Specifies what conditions cause an AnalogTrigger event.
Definition: VMXResourceConfig.h:349
EncoderConfig(EncoderEdge edge)
EncoderConfig constructor; initializes values with the provided input parameters *.
Definition: VMXResourceConfig.h:273
void SetMSBFirst(bool msbfirst)
Sets the SPI bit transmit order to most-significant bit first if true; least-significant bit order is...
Definition: VMXResourceConfig.h:504
void SetBaudrate(uint32_t baudrate_bps)
Sets the configured UART baudrate.
Definition: VMXResourceConfig.h:428
bool GetInput()
returns true if the DigitalIO should be configured in inputmode; returns false if the DigitalIO shoul...
Definition: VMXResourceConfig.h:153
void SetCSActiveLow(bool cs_active_low)
Sets the SPI CS Active low if true, Active high if false.
Definition: VMXResourceConfig.h:502
InterruptEdge GetEdge()
Retrieves the signal edge which generates an interrupt.
Definition: VMXResourceConfig.h:88
AnalogTriggerConfig()
Default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:363
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:331
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:169
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:394
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:526
void SetBitrate(uint32_t bitrate)
Sets the configured SPI bitrate.
Definition: VMXResourceConfig.h:496
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:336
VMXResourceType
Enumerates the various types of VMXResources.
Definition: VMXResource.h:33
uint16_t GetThresholdHigh()
Returns the high threshold, which is a 12-bit value (0-4095) representing the lowest-possible voltage...
Definition: VMXResourceConfig.h:381
virtual bool Copy(const VMXResourceConfig *p_config)=0
Copies the contents of the source VMXResourceConfig object into this object.
void SetNumOversampleBits(uint8_t num_oversample_bits)
Sets the configured number of oversample bits.
Definition: VMXResourceConfig.h:329
PWMGeneratorConfig(uint32_t frequency_hz)
PWMGeneratorConfig constructor; initializes values with the provided input parameters *...
Definition: VMXResourceConfig.h:195
OutputMode
Specifies the electrical behavior of a DigitalIO in output mode.
Definition: VMXResourceConfig.h:116
bool GetMSBFirst()
Returns true if the most-significant bit is transmitted first; false if the least-significant bit is ...
Definition: VMXResourceConfig.h:493
uint8_t GetMode()
Returns the configure SPI mode.
Definition: VMXResourceConfig.h:487
Contains the configuration data for a VMXResource whose VMXResourceType is SPI.
Definition: VMXResourceConfig.h:446
void SetMode(uint8_t mode)
Sets the configured SPI mode, which must be a value from 0-3.
Definition: VMXResourceConfig.h:500
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:102
void SetInput(bool input)
Specifies whether this DIOConfig represents an input or output mode configuration.
Definition: VMXResourceConfig.h:163
SPIConfig()
SPIConfig default constructor; sets all values to defaults (1Mhz SPI Click, Mode 3, CS Active Low, MSBFirst.
Definition: VMXResourceConfig.h:453
VMX Resource providing PWM Generation Control of a VMX Digital Channel in output mode.
Definition: VMXResource.h:38
VMXResourceType GetResourceType() const
VMXResourceType which this configuration applies to.
Definition: VMXResourceConfig.h:39
AnalogTriggerConfig(uint16_t threshold_high, uint16_t threshold_low, AnalogTriggerMode mode)
AccumulatorConfig constructor; initializes values with the provided input parameters.
Definition: VMXResourceConfig.h:373
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:511
bool GetCSActiveLow()
Returns true if the SPI CS is active low; false if the SPI CS is active high.
Definition: VMXResourceConfig.h:489
uint32_t GetBaudrate()
Returns the configured UART baudrate.
Definition: VMXResourceConfig.h:425
VMX Resource providing UART communication via a VMX Channel pair.
Definition: VMXResource.h:50
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:207
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:399
void SetEncoderEdge(EncoderEdge edge)
Sets the configured EncoderEdge.
Definition: VMXResourceConfig.h:281
I2CConfig()
Default constructor.
Definition: VMXResourceConfig.h:524
virtual VMXResourceConfig * GetCopy() const =0
Instantiates a copy of the configuration data.
uint32_t GetBitrate()
Returns the configured SPI bitrate.
Definition: VMXResourceConfig.h:485
Contains the configuration data for a VMXResource whose VMXResourceType is PWMGenerator.
Definition: VMXResourceConfig.h:185
Contains the configuration data for a VMXResource whose VMXResourceType is UART.
Definition: VMXResourceConfig.h:410
PWMCaptureConfig(CaptureEdge edge_type)
PWMCaptureConfig constructor; initializes values with the provided input parameters *...
Definition: VMXResourceConfig.h:235
AccumulatorConfig(uint8_t num_oversample_bits, uint8_t num_average_bits)
AccumulatorConfig constructor; initializes values with the provided input parameters *...
Definition: VMXResourceConfig.h:312
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:283
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:435
InputMode GetInputMode()
Returns input mode; only valid if this DIOConfig represents a DigitalIO in input mode.
Definition: VMXResourceConfig.h:157
void SetThresholdLow(uint16_t threshold_low)
Sets the configured low threshold.
Definition: VMXResourceConfig.h:390
Contains the configuration data for a VMXResource whose VMXResourceType is Interrupt.
Definition: VMXResourceConfig.h:56
VMX Resource providing PWM Capture of a VMX FlexIO Digital Channel in input mode. ...
Definition: VMXResource.h:40
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:97
virtual VMXResourceConfig * GetCopy() const
Instantiates a copy of the configuration data.
Definition: VMXResourceConfig.h:506
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:174
void SetNumAverageBits(uint8_t num_average_bits)
Sets the configured number of average bits.
Definition: VMXResourceConfig.h:327
PWMGeneratorConfig()
PWMGeneratorConfig default constructor; sets all values to defaults.
Definition: VMXResourceConfig.h:189
uint32_t GetFrequencyHz()
Returns the PWM Generators's frequency in Hz.
Definition: VMXResourceConfig.h:202
DIOConfig(InputMode inputmode)
DIOConfig constructor; initializes values with the provided parameters *.
Definition: VMXResourceConfig.h:135
void SetThresholdHigh(uint16_t threshold_high)
Sets the configured high threshold.
Definition: VMXResourceConfig.h:388
void SetParam(void *p_param)
Sets the interrupt handler parameter.
Definition: VMXResourceConfig.h:93
VMX Resource providing Interrupt generation from a VMX Digital Channel in input mode.
Definition: VMXResource.h:48
SPIConfig(uint32_t bitrate)
SPIConfig constructor; initializes bitrate, sets remaining value to defaults.
Definition: VMXResourceConfig.h:462
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:250
uint8_t GetNumAverageBits()
Returns the configured number of average bits.
Definition: VMXResourceConfig.h:321
Contains the configuration data for a VMXResource whose VMXResourceType is Accumulator.
Definition: VMXResourceConfig.h:299
virtual bool Copy(const VMXResourceConfig *p_config)
Copies the contents of the source VMXResourceConfig object into this object.
Definition: VMXResourceConfig.h:212
Contains the configuration data for a VMXResource whose VMXResourceType is Encoder.
Definition: VMXResourceConfig.h:261
Contains the configuration data for a VMXResource whose VMXResourceType is AnalogTrigger.
Definition: VMXResourceConfig.h:347
VMX Resource providing Oversampling/Averaging of a VMX Analog Input Channel.
Definition: VMXResource.h:44
CaptureEdge GetCaptureEdge()
Returns the configured PWM CaptureEdge.
Definition: VMXResourceConfig.h:240
OutputMode GetOutputMode()
Returns output mode; only valid if this DIOConfig represents a DigitalIO in output mode...
Definition: VMXResourceConfig.h:155
void SetFrequencyHz(uint32_t frequency_hz)
Sets the PWM Generator's frequency in Hz.
Definition: VMXResourceConfig.h:205