VMX-pi C++ HAL Library for Raspberry Pi
VMX-pi Robotics Controller & Vision/Motion Processor
VMXChannel.h
Go to the documentation of this file.
1 /* ============================================
2 VMX-pi HAL source code is placed under the MIT license
3 Copyright (c) 2017 Kauai Labs
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 The above copyright notice and this permission notice shall be included in
11 all copies or substantial portions of the Software.
12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18 THE SOFTWARE.
19 ===============================================
20 */
21 
22 #ifndef VMXCHANNEL_H_
23 #define VMXCHANNEL_H_
24 
27 #include <stdint.h>
28 
29 /* Each VMXChannel has zero or more of the following Capabilities */
30 /* Some of these Capabilities are dynamic, and may be changed via
31  * jumper (e.g., VMX PWM/DigInput jumper). However, their state at the
32  * beginning of the application will not change during the lifetime of the
33  * application.
34  *
35  * When VMXChannel Capabilities refer to Shared Resources, there is no
36  * guarantee that at any instant a VMXChannel can be configured with this,
37  * as VMXChannels must be routed to resources w/sufficient availability
38  * in order for the VMXChannel capability to be active.
39  */
40 
42 typedef enum {
43  INVALID = 0,
47  FlexDIO = 1,
49  AnalogIn = 2,
54  HiCurrDIO = 3,
59  CommDIO = 4
61 
63 typedef enum {
64  NoCapabilities = 0x00000000,
66  DigitalInput = 0x00000001,
68  DigitalOutput = 0x00000002,
70  PWMGeneratorOutput = 0x00000004,
72  PWMGeneratorOutput2 = 0x00000008,
75  PWMCaptureInput = 0x00000010,
76  InputCaptureInput = PWMCaptureInput,
79  PWMCaptureInput2 = 0x00000020,
80  InputCaptureInput2 = PWMCaptureInput2,
82  EncoderAInput = 0x00000040,
84  EncoderBInput = 0x00000080,
86  AccumulatorInput = 0x00000100,
88  AnalogTriggerInput = 0x00000200,
90  InterruptInput = 0x00000400,
92  UART_TX = 0x00000800,
94  UART_RX = 0x00001000,
96  SPI_CLK = 0x00002000,
98  SPI_MISO = 0x00004000,
100  SPI_MOSI = 0x00008000,
102  SPI_CS = 0x00010000,
104  I2C_SDA = 0x00020000,
106  I2C_SCL = 0x00040000,
109  LEDArray_OneWire = 0x00080000,
111 
113 typedef uint8_t VMXChannelIndex;
114 
117 
120  VMXChannelIndex index;
121  VMXChannelCapability capabilities;
122 
123  VMXChannelInfo() {
125  capabilities = VMXChannelCapability::NoCapabilities;
126  }
128  index = i;
129  capabilities = c;
130  }
131  bool IsValid() {
132  return (index != INVALID_VMX_CHANNEL_INDEX);
133  }
134 };
135 
136 #endif /* VMXCHANNEL_H_ */
The VMX Channel can be routed to a one-wire LED array (e.g., WS2811) that is accessed via "one-wire" ...
Definition: VMXChannel.h:109
VMXChannel information structure.
Definition: VMXChannel.h:119
The VMX Channel can be routed to a DigitalIO resource in output mode.
Definition: VMXChannel.h:68
The VMX Channel can be routed to an Encoder resource&#39;s B (second) port.
Definition: VMXChannel.h:84
The VMX Channel can be routed to a I2C resource&#39;s SCL port.
Definition: VMXChannel.h:106
The VMX Channel can be routed to a SPI resource&#39;s MISO port.
Definition: VMXChannel.h:98
The VMX Channel can be routed to a PWM Generator resource&#39;s second port.
Definition: VMXChannel.h:72
The VMX Channel can be routed to a SPI resource&#39;s CLK port.
Definition: VMXChannel.h:96
The VMX Channel can be routed to a DigitalIO resource in input mode.
Definition: VMXChannel.h:66
The VMX Channel can be routed to an Encoder resource&#39;s A (first) port.
Definition: VMXChannel.h:82
The VMX Channel can be routed to a Input Capture resource&#39;s first port.
Definition: VMXChannel.h:75
The VMX Channel can be routed to a I2C resource&#39;s SDA port.
Definition: VMXChannel.h:104
uint8_t VMXChannelIndex
Type representing the 0-based index of a VMX Channel.
Definition: VMXChannel.h:113
AnalogIn Channels are dedicated as inputs to AnalogAccumulator and AnalogTrigger resources.
Definition: VMXChannel.h:49
The VMX Channel can be routed to a UART resource&#39;s TX port.
Definition: VMXChannel.h:92
The VMX Channel can be routed to an Analog Trigger resource.
Definition: VMXChannel.h:88
The VMX Channel can be routed to an Accumulator resource.
Definition: VMXChannel.h:86
The VMX Channel can be routed to a Input Capture&#39;s second port.
Definition: VMXChannel.h:79
HiCurrDIO Channels can all be configured as either input or output.
Definition: VMXChannel.h:54
The VMX Channel can be routed to a SPI resource&#39;s MOSI port.
Definition: VMXChannel.h:100
CommDIO Channels are fixed as either inputs or outputs; they can be used with the UART...
Definition: VMXChannel.h:59
The VMX Channel can be routed to a PWM Generator resource&#39;s first port.
Definition: VMXChannel.h:70
The VMX Channel can be routed to an Interrupt resource.
Definition: VMXChannel.h:90
VMXChannelCapability
Enumeration of VMX Channel Capabilities.
Definition: VMXChannel.h:63
VMXChannelType
Enumeration of VMX Channel types.
Definition: VMXChannel.h:42
const VMXChannelIndex INVALID_VMX_CHANNEL_INDEX
Constant representing an invalid VMXChannelIndex.
Definition: VMXChannel.h:116
The VMX Channel can be routed to a SPI resource&#39;s CS port.
Definition: VMXChannel.h:102
FlexDIO Channels can be configured as input or output, and can also be used with VMX-pi Encoder...
Definition: VMXChannel.h:47
The VMX Channel can be routed to a UART resource&#39;s RX port.
Definition: VMXChannel.h:94