VMX-pi C++ HAL Library for Raspberry Pi
VMX-pi Robotics Controller & Vision/Motion Processor
VMXResource.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 VMXRESOURCE_H_
23 #define VMXRESOURCE_H_
24 
27 #include <stdint.h>
28 
29 #include "VMXChannel.h"
30 #include "VMXErrors.h"
31 
33 typedef enum {
34  Undefined,
55  SPI,
57  I2C,
60  MaxVMXResourceType = LEDArrayDriver_OneWire,
62 
64 typedef uint8_t VMXResourceIndex;
66 typedef uint16_t VMXResourceHandle;
68 typedef uint8_t VMXResourcePortIndex;
69 
72 
74 #define INVALID_VMX_RESOURCE_HANDLE(vmx_res_handle) (((uint8_t)vmx_res_handle)==INVALID_VMX_RESOURCE_INDEX)
75 
76 #define CREATE_VMX_RESOURCE_HANDLE(res_type,res_index) ((((uint16_t)res_type)<<8) | (uint8_t)res_index)
77 
78 #define EXTRACT_VMX_RESOURCE_TYPE(res_handle) (VMXResourceType)(res_handle >> 8)
79 
80 #define EXTRACT_VMX_RESOURCE_INDEX(res_handle) (uint8_t)(res_handle & 0x00FF)
81 
82 #endif /* VMXRESOURCE_H_ */
VMX Resource providing Quadrature Encoder of a VMX Channel pair in input mode.
Definition: VMXResource.h:45
uint16_t VMXResourceHandle
Handle to a particular VMX Resource.
Definition: VMXResource.h:66
const VMXResourceIndex INVALID_VMX_RESOURCE_INDEX
Value indicating a VMXResourceIndex is invalid.
Definition: VMXResource.h:71
VMX Resource providing Digital Input and Digital Output Control on a VMX Digital Channel.
Definition: VMXResource.h:36
VMX Resource providing I2C communication via a VMX Channel pair.
Definition: VMXResource.h:57
VMX Resource providing Interrupt generation from a VMX Analog Input Channel.
Definition: VMXResource.h:49
VMX Resource providing SPI communication via a four VMX Channel set.
Definition: VMXResource.h:55
uint8_t VMXResourceIndex
Zero-based index of a particular VMX Resource, relative to a specific VMXResourceType.
Definition: VMXResource.h:64
VMX Resource providing Timer Input Capture of a VMX FlexIO Digital Channel in input mode...
Definition: VMXResource.h:40
VMXResourceType
Enumerates the various types of VMXResources.
Definition: VMXResource.h:33
VMX Resource providing PWM Generation Control of a VMX Digital Channel in output mode.
Definition: VMXResource.h:38
VMX Resource providing One-wire LEDArray management via a VMX Channel.
Definition: VMXResource.h:59
VMX Resource providing UART communication via a VMX Channel pair.
Definition: VMXResource.h:53
VMX Resource providing PWM Capture of a VMX FlexIO Digital Channel in input mode. ...
Definition: VMXResource.h:43
uint8_t VMXResourcePortIndex
Zero-based index of a particular VMX Resource Port of a VMX Resource.
Definition: VMXResource.h:68
VMX Resource providing Interrupt generation from a VMX Digital Channel in input mode.
Definition: VMXResource.h:51
VMX Resource providing Oversampling/Averaging/Accumulation of a VMX Analog Input Channel.
Definition: VMXResource.h:47