phidget22 1.21.20241123__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- phidget22-1.21.20241123/PKG-INFO +38 -0
- phidget22-1.21.20241123/Phidget22/Async.py +48 -0
- phidget22-1.21.20241123/Phidget22/BridgeGain.py +39 -0
- phidget22-1.21.20241123/Phidget22/ChannelClass.py +143 -0
- phidget22-1.21.20241123/Phidget22/ChannelSubclass.py +59 -0
- phidget22-1.21.20241123/Phidget22/CodeInfo.py +125 -0
- phidget22-1.21.20241123/Phidget22/ControlMode.py +15 -0
- phidget22-1.21.20241123/Phidget22/DataAdapterEndianness.py +15 -0
- phidget22-1.21.20241123/Phidget22/DataAdapterHandshakeMode.py +19 -0
- phidget22-1.21.20241123/Phidget22/DataAdapterParity.py +19 -0
- phidget22-1.21.20241123/Phidget22/DataAdapterProtocol.py +27 -0
- phidget22-1.21.20241123/Phidget22/DataAdapterSPIChipSelect.py +23 -0
- phidget22-1.21.20241123/Phidget22/DataAdapterSPIMode.py +23 -0
- phidget22-1.21.20241123/Phidget22/DataAdapterStopBits.py +15 -0
- phidget22-1.21.20241123/Phidget22/DeviceClass.py +91 -0
- phidget22-1.21.20241123/Phidget22/DeviceID.py +479 -0
- phidget22-1.21.20241123/Phidget22/Devices/Accelerometer.py +276 -0
- phidget22-1.21.20241123/Phidget22/Devices/BLDCMotor.py +787 -0
- phidget22-1.21.20241123/Phidget22/Devices/CapacitiveTouch.py +315 -0
- phidget22-1.21.20241123/Phidget22/Devices/CurrentInput.py +252 -0
- phidget22-1.21.20241123/Phidget22/Devices/DCMotor.py +776 -0
- phidget22-1.21.20241123/Phidget22/Devices/Dictionary.py +196 -0
- phidget22-1.21.20241123/Phidget22/Devices/DigitalInput.py +111 -0
- phidget22-1.21.20241123/Phidget22/Devices/DigitalOutput.py +297 -0
- phidget22-1.21.20241123/Phidget22/Devices/DistanceSensor.py +295 -0
- phidget22-1.21.20241123/Phidget22/Devices/Encoder.py +274 -0
- phidget22-1.21.20241123/Phidget22/Devices/FrequencyCounter.py +372 -0
- phidget22-1.21.20241123/Phidget22/Devices/GPS.py +205 -0
- phidget22-1.21.20241123/Phidget22/Devices/Gyroscope.py +238 -0
- phidget22-1.21.20241123/Phidget22/Devices/Hub.py +125 -0
- phidget22-1.21.20241123/Phidget22/Devices/HumiditySensor.py +228 -0
- phidget22-1.21.20241123/Phidget22/Devices/IR.py +186 -0
- phidget22-1.21.20241123/Phidget22/Devices/LCD.py +643 -0
- phidget22-1.21.20241123/Phidget22/Devices/LightSensor.py +228 -0
- phidget22-1.21.20241123/Phidget22/Devices/Log.py +200 -0
- phidget22-1.21.20241123/Phidget22/Devices/Magnetometer.py +317 -0
- phidget22-1.21.20241123/Phidget22/Devices/Manager.py +115 -0
- phidget22-1.21.20241123/Phidget22/Devices/MotorPositionController.py +996 -0
- phidget22-1.21.20241123/Phidget22/Devices/MotorVelocityController.py +806 -0
- phidget22-1.21.20241123/Phidget22/Devices/PHSensor.py +275 -0
- phidget22-1.21.20241123/Phidget22/Devices/PowerGuard.py +161 -0
- phidget22-1.21.20241123/Phidget22/Devices/PressureSensor.py +228 -0
- phidget22-1.21.20241123/Phidget22/Devices/RCServo.py +645 -0
- phidget22-1.21.20241123/Phidget22/Devices/RFID.py +159 -0
- phidget22-1.21.20241123/Phidget22/Devices/ResistanceInput.py +252 -0
- phidget22-1.21.20241123/Phidget22/Devices/SoundSensor.py +289 -0
- phidget22-1.21.20241123/Phidget22/Devices/Spatial.py +420 -0
- phidget22-1.21.20241123/Phidget22/Devices/Stepper.py +587 -0
- phidget22-1.21.20241123/Phidget22/Devices/TemperatureSensor.py +300 -0
- phidget22-1.21.20241123/Phidget22/Devices/VoltageInput.py +380 -0
- phidget22-1.21.20241123/Phidget22/Devices/VoltageOutput.py +175 -0
- phidget22-1.21.20241123/Phidget22/Devices/VoltageRatioInput.py +379 -0
- phidget22-1.21.20241123/Phidget22/Devices/__init__.py +0 -0
- phidget22-1.21.20241123/Phidget22/DriveMode.py +15 -0
- phidget22-1.21.20241123/Phidget22/EncoderIOMode.py +27 -0
- phidget22-1.21.20241123/Phidget22/Encoding.py +31 -0
- phidget22-1.21.20241123/Phidget22/ErrorCode.py +215 -0
- phidget22-1.21.20241123/Phidget22/ErrorEventCode.py +107 -0
- phidget22-1.21.20241123/Phidget22/FanMode.py +19 -0
- phidget22-1.21.20241123/Phidget22/FilterType.py +15 -0
- phidget22-1.21.20241123/Phidget22/GPSDate.py +43 -0
- phidget22-1.21.20241123/Phidget22/GPSTime.py +51 -0
- phidget22-1.21.20241123/Phidget22/HubPortMode.py +27 -0
- phidget22-1.21.20241123/Phidget22/IOVoltage.py +27 -0
- phidget22-1.21.20241123/Phidget22/IRCodeEncoding.py +31 -0
- phidget22-1.21.20241123/Phidget22/IRCodeLength.py +19 -0
- phidget22-1.21.20241123/Phidget22/InputMode.py +23 -0
- phidget22-1.21.20241123/Phidget22/LCDFont.py +27 -0
- phidget22-1.21.20241123/Phidget22/LCDPixelState.py +19 -0
- phidget22-1.21.20241123/Phidget22/LCDScreenSize.py +59 -0
- phidget22-1.21.20241123/Phidget22/LEDForwardVoltage.py +39 -0
- phidget22-1.21.20241123/Phidget22/Length.py +19 -0
- phidget22-1.21.20241123/Phidget22/LogLevel.py +31 -0
- phidget22-1.21.20241123/Phidget22/MeshMode.py +15 -0
- phidget22-1.21.20241123/Phidget22/Net.py +171 -0
- phidget22-1.21.20241123/Phidget22/PacketErrorCode.py +39 -0
- phidget22-1.21.20241123/Phidget22/Phidget.py +780 -0
- phidget22-1.21.20241123/Phidget22/PhidgetException.py +40 -0
- phidget22-1.21.20241123/Phidget22/PhidgetServer.py +76 -0
- phidget22-1.21.20241123/Phidget22/PhidgetServerType.py +19 -0
- phidget22-1.21.20241123/Phidget22/PhidgetSupport.py +42 -0
- phidget22-1.21.20241123/Phidget22/PortMode.py +27 -0
- phidget22-1.21.20241123/Phidget22/PositionType.py +15 -0
- phidget22-1.21.20241123/Phidget22/PowerSupply.py +19 -0
- phidget22-1.21.20241123/Phidget22/RCServoVoltage.py +19 -0
- phidget22-1.21.20241123/Phidget22/RFIDChipset.py +15 -0
- phidget22-1.21.20241123/Phidget22/RFIDProtocol.py +27 -0
- phidget22-1.21.20241123/Phidget22/RTDType.py +23 -0
- phidget22-1.21.20241123/Phidget22/RTDWireSetup.py +19 -0
- phidget22-1.21.20241123/Phidget22/SPLRange.py +15 -0
- phidget22-1.21.20241123/Phidget22/SpatialAlgorithm.py +19 -0
- phidget22-1.21.20241123/Phidget22/SpatialEulerAngles.py +43 -0
- phidget22-1.21.20241123/Phidget22/SpatialPrecision.py +19 -0
- phidget22-1.21.20241123/Phidget22/SpatialQuaternion.py +51 -0
- phidget22-1.21.20241123/Phidget22/StepperControlMode.py +15 -0
- phidget22-1.21.20241123/Phidget22/ThermocoupleType.py +23 -0
- phidget22-1.21.20241123/Phidget22/Unit.py +79 -0
- phidget22-1.21.20241123/Phidget22/UnitInfo.py +44 -0
- phidget22-1.21.20241123/Phidget22/VoltageOutputRange.py +15 -0
- phidget22-1.21.20241123/Phidget22/VoltageRange.py +51 -0
- phidget22-1.21.20241123/Phidget22/VoltageRatioSensorType.py +203 -0
- phidget22-1.21.20241123/Phidget22/VoltageSensorType.py +167 -0
- phidget22-1.21.20241123/Phidget22/__init__.py +1 -0
- phidget22-1.21.20241123/README.md +23 -0
- phidget22-1.21.20241123/phidget22.egg-info/PKG-INFO +38 -0
- phidget22-1.21.20241123/phidget22.egg-info/SOURCES.txt +108 -0
- phidget22-1.21.20241123/phidget22.egg-info/dependency_links.txt +1 -0
- phidget22-1.21.20241123/phidget22.egg-info/top_level.txt +1 -0
- phidget22-1.21.20241123/setup.cfg +4 -0
- phidget22-1.21.20241123/setup.py +23 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: phidget22
|
|
3
|
+
Version: 1.21.20241123
|
|
4
|
+
Summary: Phidget22 Python wrapper library
|
|
5
|
+
Home-page: http://www.phidgets.com
|
|
6
|
+
Author: Phidgets Inc
|
|
7
|
+
Author-email: support@phidgets.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Description: # Phidget22
|
|
10
|
+
|
|
11
|
+
[](https://pypi.org/project/Phidget22/)
|
|
12
|
+
|
|
13
|
+
**Phidget22** is the official Python library for working with Phidgets in Python applications. It provides lightweight bindings to the native phidget22 library.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### pip Package
|
|
19
|
+
The library is available as a pip package and includes the phidget22 native library for **Windows**, **Linux**, and **macOS**. For other operating systems, the native library must be installed separately.
|
|
20
|
+
|
|
21
|
+
### macOS Notes
|
|
22
|
+
- **HID USB Phidgets** require the installation of macOS libraries or the Standalone Control Panel ([Download Here](https://www.phidgets.com/docs/OS_-_macOS)).
|
|
23
|
+
- HID USB Phidgets are listed as `'HID'` in the USB Stack field on their product page specifications tab at [www.phidgets.com](https://www.phidgets.com).
|
|
24
|
+
- **PHIDUSB, VINT Phidgets**: Newer USB Phidgets and VINT Phidgets do not require a separate install.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Resources
|
|
28
|
+
|
|
29
|
+
- [Python Language Page](https://www.phidgets.com/docs/Language_-_Python)
|
|
30
|
+
- [Python API Reference](https://www.phidgets.com/?view=api&lang=Python)
|
|
31
|
+
- [Python Code Samples](https://www.phidgets.com/?view=code_samples&lang=Python)
|
|
32
|
+
|
|
33
|
+
Platform: UNKNOWN
|
|
34
|
+
Classifier: Programming Language :: Python :: 2
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
from Phidget22.PhidgetSupport import PhidgetSupport
|
|
4
|
+
|
|
5
|
+
class AsyncSupport:
|
|
6
|
+
__callbacks = {}
|
|
7
|
+
__nativecallback = None
|
|
8
|
+
|
|
9
|
+
@staticmethod
|
|
10
|
+
def add(entry, phid):
|
|
11
|
+
t = (entry, phid);
|
|
12
|
+
AsyncSupport.__callbacks[id(t)] = t
|
|
13
|
+
return id(t)
|
|
14
|
+
|
|
15
|
+
@staticmethod
|
|
16
|
+
def __getAndRemove(id):
|
|
17
|
+
entry = AsyncSupport.__callbacks.get(id)
|
|
18
|
+
del AsyncSupport.__callbacks[id]
|
|
19
|
+
return entry
|
|
20
|
+
|
|
21
|
+
@staticmethod
|
|
22
|
+
def __async_callback(handle, ctx, res):
|
|
23
|
+
|
|
24
|
+
if ctx == None:
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
# look up callback
|
|
28
|
+
entry = AsyncSupport.__getAndRemove(ctx)
|
|
29
|
+
if entry == None:
|
|
30
|
+
return
|
|
31
|
+
|
|
32
|
+
details = ""
|
|
33
|
+
_code = ctypes.c_int(res)
|
|
34
|
+
_desc = ctypes.c_char_p()
|
|
35
|
+
result = PhidgetSupport.getDll().Phidget_getErrorDescription(_code, ctypes.byref(_desc))
|
|
36
|
+
if result == 0:
|
|
37
|
+
details = _desc.value.decode("utf-8")
|
|
38
|
+
|
|
39
|
+
entry[0](entry[1], res, details)
|
|
40
|
+
|
|
41
|
+
@staticmethod
|
|
42
|
+
def getCallback():
|
|
43
|
+
if AsyncSupport.__nativecallback is None:
|
|
44
|
+
if sys.platform == 'win32':
|
|
45
|
+
AsyncSupport.__nativecallback = ctypes.WINFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int)(AsyncSupport.__async_callback)
|
|
46
|
+
else:
|
|
47
|
+
AsyncSupport.__nativecallback = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int)(AsyncSupport.__async_callback)
|
|
48
|
+
return AsyncSupport.__nativecallback
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class BridgeGain:
|
|
4
|
+
# 1x Amplificaion
|
|
5
|
+
BRIDGE_GAIN_1 = 1
|
|
6
|
+
# 2x Amplification
|
|
7
|
+
BRIDGE_GAIN_2 = 2
|
|
8
|
+
# 4x Amplification
|
|
9
|
+
BRIDGE_GAIN_4 = 3
|
|
10
|
+
# 8x Amplification
|
|
11
|
+
BRIDGE_GAIN_8 = 4
|
|
12
|
+
# 16x Amplification
|
|
13
|
+
BRIDGE_GAIN_16 = 5
|
|
14
|
+
# 32x Amplification
|
|
15
|
+
BRIDGE_GAIN_32 = 6
|
|
16
|
+
# 64x Amplification
|
|
17
|
+
BRIDGE_GAIN_64 = 7
|
|
18
|
+
# 128x Amplification
|
|
19
|
+
BRIDGE_GAIN_128 = 8
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def getName(self, val):
|
|
23
|
+
if val == self.BRIDGE_GAIN_1:
|
|
24
|
+
return "BRIDGE_GAIN_1"
|
|
25
|
+
if val == self.BRIDGE_GAIN_2:
|
|
26
|
+
return "BRIDGE_GAIN_2"
|
|
27
|
+
if val == self.BRIDGE_GAIN_4:
|
|
28
|
+
return "BRIDGE_GAIN_4"
|
|
29
|
+
if val == self.BRIDGE_GAIN_8:
|
|
30
|
+
return "BRIDGE_GAIN_8"
|
|
31
|
+
if val == self.BRIDGE_GAIN_16:
|
|
32
|
+
return "BRIDGE_GAIN_16"
|
|
33
|
+
if val == self.BRIDGE_GAIN_32:
|
|
34
|
+
return "BRIDGE_GAIN_32"
|
|
35
|
+
if val == self.BRIDGE_GAIN_64:
|
|
36
|
+
return "BRIDGE_GAIN_64"
|
|
37
|
+
if val == self.BRIDGE_GAIN_128:
|
|
38
|
+
return "BRIDGE_GAIN_128"
|
|
39
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class ChannelClass:
|
|
4
|
+
# Accelerometer channel
|
|
5
|
+
PHIDCHCLASS_ACCELEROMETER = 1
|
|
6
|
+
# BLDC motor channel
|
|
7
|
+
PHIDCHCLASS_BLDCMOTOR = 35
|
|
8
|
+
# Capacitive Touch channel
|
|
9
|
+
PHIDCHCLASS_CAPACITIVETOUCH = 14
|
|
10
|
+
# Current input channel
|
|
11
|
+
PHIDCHCLASS_CURRENTINPUT = 2
|
|
12
|
+
# DC motor channel
|
|
13
|
+
PHIDCHCLASS_DCMOTOR = 4
|
|
14
|
+
# Dictionary
|
|
15
|
+
PHIDCHCLASS_DICTIONARY = 36
|
|
16
|
+
# Digital input channel
|
|
17
|
+
PHIDCHCLASS_DIGITALINPUT = 5
|
|
18
|
+
# Digital output channel
|
|
19
|
+
PHIDCHCLASS_DIGITALOUTPUT = 6
|
|
20
|
+
# Distance sensor channel
|
|
21
|
+
PHIDCHCLASS_DISTANCESENSOR = 7
|
|
22
|
+
# Encoder channel
|
|
23
|
+
PHIDCHCLASS_ENCODER = 8
|
|
24
|
+
# Frequency counter channel
|
|
25
|
+
PHIDCHCLASS_FREQUENCYCOUNTER = 9
|
|
26
|
+
# GPS channel
|
|
27
|
+
PHIDCHCLASS_GPS = 10
|
|
28
|
+
# Gyroscope channel
|
|
29
|
+
PHIDCHCLASS_GYROSCOPE = 12
|
|
30
|
+
# VINT Hub channel
|
|
31
|
+
PHIDCHCLASS_HUB = 13
|
|
32
|
+
# Humidity sensor channel
|
|
33
|
+
PHIDCHCLASS_HUMIDITYSENSOR = 15
|
|
34
|
+
# IR channel
|
|
35
|
+
PHIDCHCLASS_IR = 16
|
|
36
|
+
# LCD channel
|
|
37
|
+
PHIDCHCLASS_LCD = 11
|
|
38
|
+
# Light sensor channel
|
|
39
|
+
PHIDCHCLASS_LIGHTSENSOR = 17
|
|
40
|
+
# Magnetometer channel
|
|
41
|
+
PHIDCHCLASS_MAGNETOMETER = 18
|
|
42
|
+
# Motor position control channel.
|
|
43
|
+
PHIDCHCLASS_MOTORPOSITIONCONTROLLER = 34
|
|
44
|
+
# Motor velocity control channel.
|
|
45
|
+
PHIDCHCLASS_MOTORVELOCITYCONTROLLER = 39
|
|
46
|
+
# pH sensor channel
|
|
47
|
+
PHIDCHCLASS_PHSENSOR = 37
|
|
48
|
+
# Power guard channel
|
|
49
|
+
PHIDCHCLASS_POWERGUARD = 20
|
|
50
|
+
# Pressure sensor channel
|
|
51
|
+
PHIDCHCLASS_PRESSURESENSOR = 21
|
|
52
|
+
# RC Servo channel
|
|
53
|
+
PHIDCHCLASS_RCSERVO = 22
|
|
54
|
+
# Resistance input channel
|
|
55
|
+
PHIDCHCLASS_RESISTANCEINPUT = 23
|
|
56
|
+
# RFID channel
|
|
57
|
+
PHIDCHCLASS_RFID = 24
|
|
58
|
+
# Sound sensor channel
|
|
59
|
+
PHIDCHCLASS_SOUNDSENSOR = 25
|
|
60
|
+
# Spatial channel
|
|
61
|
+
PHIDCHCLASS_SPATIAL = 26
|
|
62
|
+
# Stepper channel
|
|
63
|
+
PHIDCHCLASS_STEPPER = 27
|
|
64
|
+
# Temperature sensor channel
|
|
65
|
+
PHIDCHCLASS_TEMPERATURESENSOR = 28
|
|
66
|
+
# Voltage input channel
|
|
67
|
+
PHIDCHCLASS_VOLTAGEINPUT = 29
|
|
68
|
+
# Voltage output channel
|
|
69
|
+
PHIDCHCLASS_VOLTAGEOUTPUT = 30
|
|
70
|
+
# Voltage ratio input channel
|
|
71
|
+
PHIDCHCLASS_VOLTAGERATIOINPUT = 31
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def getName(self, val):
|
|
75
|
+
if val == self.PHIDCHCLASS_ACCELEROMETER:
|
|
76
|
+
return "PHIDCHCLASS_ACCELEROMETER"
|
|
77
|
+
if val == self.PHIDCHCLASS_BLDCMOTOR:
|
|
78
|
+
return "PHIDCHCLASS_BLDCMOTOR"
|
|
79
|
+
if val == self.PHIDCHCLASS_CAPACITIVETOUCH:
|
|
80
|
+
return "PHIDCHCLASS_CAPACITIVETOUCH"
|
|
81
|
+
if val == self.PHIDCHCLASS_CURRENTINPUT:
|
|
82
|
+
return "PHIDCHCLASS_CURRENTINPUT"
|
|
83
|
+
if val == self.PHIDCHCLASS_DCMOTOR:
|
|
84
|
+
return "PHIDCHCLASS_DCMOTOR"
|
|
85
|
+
if val == self.PHIDCHCLASS_DICTIONARY:
|
|
86
|
+
return "PHIDCHCLASS_DICTIONARY"
|
|
87
|
+
if val == self.PHIDCHCLASS_DIGITALINPUT:
|
|
88
|
+
return "PHIDCHCLASS_DIGITALINPUT"
|
|
89
|
+
if val == self.PHIDCHCLASS_DIGITALOUTPUT:
|
|
90
|
+
return "PHIDCHCLASS_DIGITALOUTPUT"
|
|
91
|
+
if val == self.PHIDCHCLASS_DISTANCESENSOR:
|
|
92
|
+
return "PHIDCHCLASS_DISTANCESENSOR"
|
|
93
|
+
if val == self.PHIDCHCLASS_ENCODER:
|
|
94
|
+
return "PHIDCHCLASS_ENCODER"
|
|
95
|
+
if val == self.PHIDCHCLASS_FREQUENCYCOUNTER:
|
|
96
|
+
return "PHIDCHCLASS_FREQUENCYCOUNTER"
|
|
97
|
+
if val == self.PHIDCHCLASS_GPS:
|
|
98
|
+
return "PHIDCHCLASS_GPS"
|
|
99
|
+
if val == self.PHIDCHCLASS_GYROSCOPE:
|
|
100
|
+
return "PHIDCHCLASS_GYROSCOPE"
|
|
101
|
+
if val == self.PHIDCHCLASS_HUB:
|
|
102
|
+
return "PHIDCHCLASS_HUB"
|
|
103
|
+
if val == self.PHIDCHCLASS_HUMIDITYSENSOR:
|
|
104
|
+
return "PHIDCHCLASS_HUMIDITYSENSOR"
|
|
105
|
+
if val == self.PHIDCHCLASS_IR:
|
|
106
|
+
return "PHIDCHCLASS_IR"
|
|
107
|
+
if val == self.PHIDCHCLASS_LCD:
|
|
108
|
+
return "PHIDCHCLASS_LCD"
|
|
109
|
+
if val == self.PHIDCHCLASS_LIGHTSENSOR:
|
|
110
|
+
return "PHIDCHCLASS_LIGHTSENSOR"
|
|
111
|
+
if val == self.PHIDCHCLASS_MAGNETOMETER:
|
|
112
|
+
return "PHIDCHCLASS_MAGNETOMETER"
|
|
113
|
+
if val == self.PHIDCHCLASS_MOTORPOSITIONCONTROLLER:
|
|
114
|
+
return "PHIDCHCLASS_MOTORPOSITIONCONTROLLER"
|
|
115
|
+
if val == self.PHIDCHCLASS_MOTORVELOCITYCONTROLLER:
|
|
116
|
+
return "PHIDCHCLASS_MOTORVELOCITYCONTROLLER"
|
|
117
|
+
if val == self.PHIDCHCLASS_PHSENSOR:
|
|
118
|
+
return "PHIDCHCLASS_PHSENSOR"
|
|
119
|
+
if val == self.PHIDCHCLASS_POWERGUARD:
|
|
120
|
+
return "PHIDCHCLASS_POWERGUARD"
|
|
121
|
+
if val == self.PHIDCHCLASS_PRESSURESENSOR:
|
|
122
|
+
return "PHIDCHCLASS_PRESSURESENSOR"
|
|
123
|
+
if val == self.PHIDCHCLASS_RCSERVO:
|
|
124
|
+
return "PHIDCHCLASS_RCSERVO"
|
|
125
|
+
if val == self.PHIDCHCLASS_RESISTANCEINPUT:
|
|
126
|
+
return "PHIDCHCLASS_RESISTANCEINPUT"
|
|
127
|
+
if val == self.PHIDCHCLASS_RFID:
|
|
128
|
+
return "PHIDCHCLASS_RFID"
|
|
129
|
+
if val == self.PHIDCHCLASS_SOUNDSENSOR:
|
|
130
|
+
return "PHIDCHCLASS_SOUNDSENSOR"
|
|
131
|
+
if val == self.PHIDCHCLASS_SPATIAL:
|
|
132
|
+
return "PHIDCHCLASS_SPATIAL"
|
|
133
|
+
if val == self.PHIDCHCLASS_STEPPER:
|
|
134
|
+
return "PHIDCHCLASS_STEPPER"
|
|
135
|
+
if val == self.PHIDCHCLASS_TEMPERATURESENSOR:
|
|
136
|
+
return "PHIDCHCLASS_TEMPERATURESENSOR"
|
|
137
|
+
if val == self.PHIDCHCLASS_VOLTAGEINPUT:
|
|
138
|
+
return "PHIDCHCLASS_VOLTAGEINPUT"
|
|
139
|
+
if val == self.PHIDCHCLASS_VOLTAGEOUTPUT:
|
|
140
|
+
return "PHIDCHCLASS_VOLTAGEOUTPUT"
|
|
141
|
+
if val == self.PHIDCHCLASS_VOLTAGERATIOINPUT:
|
|
142
|
+
return "PHIDCHCLASS_VOLTAGERATIOINPUT"
|
|
143
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class ChannelSubclass:
|
|
4
|
+
# No subclass
|
|
5
|
+
PHIDCHSUBCLASS_NONE = 1
|
|
6
|
+
# Digital output duty cycle
|
|
7
|
+
PHIDCHSUBCLASS_DIGITALOUTPUT_DUTY_CYCLE = 16
|
|
8
|
+
# Digital output frequency
|
|
9
|
+
PHIDCHSUBCLASS_DIGITALOUTPUT_FREQUENCY = 18
|
|
10
|
+
# Digital output LED driver
|
|
11
|
+
PHIDCHSUBCLASS_DIGITALOUTPUT_LED_DRIVER = 17
|
|
12
|
+
# Encoder IO mode settable
|
|
13
|
+
PHIDCHSUBCLASS_ENCODER_MODE_SETTABLE = 96
|
|
14
|
+
# Graphic LCD
|
|
15
|
+
PHIDCHSUBCLASS_LCD_GRAPHIC = 80
|
|
16
|
+
# Text LCD
|
|
17
|
+
PHIDCHSUBCLASS_LCD_TEXT = 81
|
|
18
|
+
# Spatial AHRS/IMU
|
|
19
|
+
PHIDCHSUBCLASS_SPATIAL_AHRS = 112
|
|
20
|
+
# Temperature sensor RTD
|
|
21
|
+
PHIDCHSUBCLASS_TEMPERATURESENSOR_RTD = 32
|
|
22
|
+
# Temperature sensor thermocouple
|
|
23
|
+
PHIDCHSUBCLASS_TEMPERATURESENSOR_THERMOCOUPLE = 33
|
|
24
|
+
# Voltage sensor port
|
|
25
|
+
PHIDCHSUBCLASS_VOLTAGEINPUT_SENSOR_PORT = 48
|
|
26
|
+
# Voltage ratio bridge input
|
|
27
|
+
PHIDCHSUBCLASS_VOLTAGERATIOINPUT_BRIDGE = 65
|
|
28
|
+
# Voltage ratio sensor port
|
|
29
|
+
PHIDCHSUBCLASS_VOLTAGERATIOINPUT_SENSOR_PORT = 64
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def getName(self, val):
|
|
33
|
+
if val == self.PHIDCHSUBCLASS_NONE:
|
|
34
|
+
return "PHIDCHSUBCLASS_NONE"
|
|
35
|
+
if val == self.PHIDCHSUBCLASS_DIGITALOUTPUT_DUTY_CYCLE:
|
|
36
|
+
return "PHIDCHSUBCLASS_DIGITALOUTPUT_DUTY_CYCLE"
|
|
37
|
+
if val == self.PHIDCHSUBCLASS_DIGITALOUTPUT_FREQUENCY:
|
|
38
|
+
return "PHIDCHSUBCLASS_DIGITALOUTPUT_FREQUENCY"
|
|
39
|
+
if val == self.PHIDCHSUBCLASS_DIGITALOUTPUT_LED_DRIVER:
|
|
40
|
+
return "PHIDCHSUBCLASS_DIGITALOUTPUT_LED_DRIVER"
|
|
41
|
+
if val == self.PHIDCHSUBCLASS_ENCODER_MODE_SETTABLE:
|
|
42
|
+
return "PHIDCHSUBCLASS_ENCODER_MODE_SETTABLE"
|
|
43
|
+
if val == self.PHIDCHSUBCLASS_LCD_GRAPHIC:
|
|
44
|
+
return "PHIDCHSUBCLASS_LCD_GRAPHIC"
|
|
45
|
+
if val == self.PHIDCHSUBCLASS_LCD_TEXT:
|
|
46
|
+
return "PHIDCHSUBCLASS_LCD_TEXT"
|
|
47
|
+
if val == self.PHIDCHSUBCLASS_SPATIAL_AHRS:
|
|
48
|
+
return "PHIDCHSUBCLASS_SPATIAL_AHRS"
|
|
49
|
+
if val == self.PHIDCHSUBCLASS_TEMPERATURESENSOR_RTD:
|
|
50
|
+
return "PHIDCHSUBCLASS_TEMPERATURESENSOR_RTD"
|
|
51
|
+
if val == self.PHIDCHSUBCLASS_TEMPERATURESENSOR_THERMOCOUPLE:
|
|
52
|
+
return "PHIDCHSUBCLASS_TEMPERATURESENSOR_THERMOCOUPLE"
|
|
53
|
+
if val == self.PHIDCHSUBCLASS_VOLTAGEINPUT_SENSOR_PORT:
|
|
54
|
+
return "PHIDCHSUBCLASS_VOLTAGEINPUT_SENSOR_PORT"
|
|
55
|
+
if val == self.PHIDCHSUBCLASS_VOLTAGERATIOINPUT_BRIDGE:
|
|
56
|
+
return "PHIDCHSUBCLASS_VOLTAGERATIOINPUT_BRIDGE"
|
|
57
|
+
if val == self.PHIDCHSUBCLASS_VOLTAGERATIOINPUT_SENSOR_PORT:
|
|
58
|
+
return "PHIDCHSUBCLASS_VOLTAGERATIOINPUT_SENSOR_PORT"
|
|
59
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
|
|
4
|
+
from Phidget22.IRCodeEncoding import IRCodeEncoding
|
|
5
|
+
from Phidget22.IRCodeLength import IRCodeLength
|
|
6
|
+
|
|
7
|
+
class CodeInfo(ctypes.Structure):
|
|
8
|
+
_fields_ = [
|
|
9
|
+
("_bitCount", ctypes.c_uint32),
|
|
10
|
+
("_encoding", ctypes.c_int),
|
|
11
|
+
("_length", ctypes.c_int),
|
|
12
|
+
("_gap", ctypes.c_uint32),
|
|
13
|
+
("_trail", ctypes.c_uint32),
|
|
14
|
+
("_header", ctypes.c_uint32 * 2),
|
|
15
|
+
("_one", ctypes.c_uint32 * 2),
|
|
16
|
+
("_zero", ctypes.c_uint32 * 2),
|
|
17
|
+
("_repeat", ctypes.c_uint32 * 26),
|
|
18
|
+
("_minRepeat", ctypes.c_uint32),
|
|
19
|
+
("_dutyCycle", ctypes.c_double),
|
|
20
|
+
("_carrierFrequency", ctypes.c_uint32),
|
|
21
|
+
("_toggleMask", ctypes.c_char * 33),
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
def __init__(self):
|
|
25
|
+
self.bitCount = 0
|
|
26
|
+
self.encoding = 0
|
|
27
|
+
self.length = 0
|
|
28
|
+
self.gap = 0
|
|
29
|
+
self.trail = 0
|
|
30
|
+
self.header = [0] * 2
|
|
31
|
+
self.one = [0] * 2
|
|
32
|
+
self.zero = [0] * 2
|
|
33
|
+
self.repeat = [0] * 26
|
|
34
|
+
self.minRepeat = 0
|
|
35
|
+
self.dutyCycle = 0
|
|
36
|
+
self.carrierFrequency = 0
|
|
37
|
+
self.toggleMask = ""
|
|
38
|
+
|
|
39
|
+
def fromPython(self):
|
|
40
|
+
self._bitCount = self.bitCount
|
|
41
|
+
self._encoding = self.encoding
|
|
42
|
+
self._length = self.length
|
|
43
|
+
self._gap = self.gap
|
|
44
|
+
self._trail = self.trail
|
|
45
|
+
self._header = (ctypes.c_uint32 * 2)(*self.header)
|
|
46
|
+
self._one = (ctypes.c_uint32 * 2)(*self.one)
|
|
47
|
+
self._zero = (ctypes.c_uint32 * 2)(*self.zero)
|
|
48
|
+
self._repeat = (ctypes.c_uint32 * 26)(*self.repeat)
|
|
49
|
+
self._minRepeat = self.minRepeat
|
|
50
|
+
self._dutyCycle = self.dutyCycle
|
|
51
|
+
self._carrierFrequency = self.carrierFrequency
|
|
52
|
+
self._toggleMask = self.toggleMask.encode('utf-8')
|
|
53
|
+
return self
|
|
54
|
+
|
|
55
|
+
def toPython(self):
|
|
56
|
+
if self._bitCount == None:
|
|
57
|
+
self.bitCount = None
|
|
58
|
+
else:
|
|
59
|
+
self.bitCount = self._bitCount
|
|
60
|
+
if self._encoding == None:
|
|
61
|
+
self.encoding = None
|
|
62
|
+
else:
|
|
63
|
+
self.encoding = self._encoding
|
|
64
|
+
if self._length == None:
|
|
65
|
+
self.length = None
|
|
66
|
+
else:
|
|
67
|
+
self.length = self._length
|
|
68
|
+
if self._gap == None:
|
|
69
|
+
self.gap = None
|
|
70
|
+
else:
|
|
71
|
+
self.gap = self._gap
|
|
72
|
+
if self._trail == None:
|
|
73
|
+
self.trail = None
|
|
74
|
+
else:
|
|
75
|
+
self.trail = self._trail
|
|
76
|
+
if self._header == None:
|
|
77
|
+
self.header = None
|
|
78
|
+
else:
|
|
79
|
+
self.header = self._header
|
|
80
|
+
if self._one == None:
|
|
81
|
+
self.one = None
|
|
82
|
+
else:
|
|
83
|
+
self.one = self._one
|
|
84
|
+
if self._zero == None:
|
|
85
|
+
self.zero = None
|
|
86
|
+
else:
|
|
87
|
+
self.zero = self._zero
|
|
88
|
+
if self._repeat == None:
|
|
89
|
+
self.repeat = None
|
|
90
|
+
else:
|
|
91
|
+
self.repeat = self._repeat
|
|
92
|
+
if self._minRepeat == None:
|
|
93
|
+
self.minRepeat = None
|
|
94
|
+
else:
|
|
95
|
+
self.minRepeat = self._minRepeat
|
|
96
|
+
if self._dutyCycle == None:
|
|
97
|
+
self.dutyCycle = None
|
|
98
|
+
else:
|
|
99
|
+
self.dutyCycle = self._dutyCycle
|
|
100
|
+
if self._carrierFrequency == None:
|
|
101
|
+
self.carrierFrequency = None
|
|
102
|
+
else:
|
|
103
|
+
self.carrierFrequency = self._carrierFrequency
|
|
104
|
+
if self._toggleMask == None:
|
|
105
|
+
self.toggleMask = None
|
|
106
|
+
else:
|
|
107
|
+
self.toggleMask = self._toggleMask.decode('utf-8')
|
|
108
|
+
return self
|
|
109
|
+
|
|
110
|
+
def __str__(self):
|
|
111
|
+
return ("[CodeInfo] ("
|
|
112
|
+
"bitCount: " + str(self.bitCount) + ", "
|
|
113
|
+
"encoding: " + str(self.encoding) + ", "
|
|
114
|
+
"length: " + str(self.length) + ", "
|
|
115
|
+
"gap: " + str(self.gap) + ", "
|
|
116
|
+
"trail: " + str(self.trail) + ", "
|
|
117
|
+
"header: " + str(self.header) + ", "
|
|
118
|
+
"one: " + str(self.one) + ", "
|
|
119
|
+
"zero: " + str(self.zero) + ", "
|
|
120
|
+
"repeat: " + str(self.repeat) + ", "
|
|
121
|
+
"minRepeat: " + str(self.minRepeat) + ", "
|
|
122
|
+
"dutyCycle: " + str(self.dutyCycle) + ", "
|
|
123
|
+
"carrierFrequency: " + str(self.carrierFrequency) + ", "
|
|
124
|
+
"toggleMask: " + str(self.toggleMask) +
|
|
125
|
+
")")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class ControlMode:
|
|
4
|
+
# Control the motor by setting a target position.
|
|
5
|
+
CONTROL_MODE_STEP = 0
|
|
6
|
+
# Control the motor by selecting a target velocity (sign indicates direction). The motor will rotate continuously in the chosen direction.
|
|
7
|
+
CONTROL_MODE_RUN = 1
|
|
8
|
+
|
|
9
|
+
@classmethod
|
|
10
|
+
def getName(self, val):
|
|
11
|
+
if val == self.CONTROL_MODE_STEP:
|
|
12
|
+
return "CONTROL_MODE_STEP"
|
|
13
|
+
if val == self.CONTROL_MODE_RUN:
|
|
14
|
+
return "CONTROL_MODE_RUN"
|
|
15
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class DataAdapterEndianness:
|
|
4
|
+
# MSB First
|
|
5
|
+
ENDIANNESS_MSB_FIRST = 1
|
|
6
|
+
# LSB First
|
|
7
|
+
ENDIANNESS_LSB_FIRST = 2
|
|
8
|
+
|
|
9
|
+
@classmethod
|
|
10
|
+
def getName(self, val):
|
|
11
|
+
if val == self.ENDIANNESS_MSB_FIRST:
|
|
12
|
+
return "ENDIANNESS_MSB_FIRST"
|
|
13
|
+
if val == self.ENDIANNESS_LSB_FIRST:
|
|
14
|
+
return "ENDIANNESS_LSB_FIRST"
|
|
15
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class DataAdapterHandshakeMode:
|
|
4
|
+
# RTS is never set, and CTS is ignored.
|
|
5
|
+
HANDSHAKE_MODE_NONE = 1
|
|
6
|
+
# RTS Pin requests to transmit data. CTS input confirms we can send data.
|
|
7
|
+
HANDSHAKE_MODE_REQUEST_TO_SEND = 2
|
|
8
|
+
# RTS signals this device can receive data. CTS confirms we can send data.
|
|
9
|
+
HANDSHAKE_MODE_READY_TO_RECEIVE = 3
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def getName(self, val):
|
|
13
|
+
if val == self.HANDSHAKE_MODE_NONE:
|
|
14
|
+
return "HANDSHAKE_MODE_NONE"
|
|
15
|
+
if val == self.HANDSHAKE_MODE_REQUEST_TO_SEND:
|
|
16
|
+
return "HANDSHAKE_MODE_REQUEST_TO_SEND"
|
|
17
|
+
if val == self.HANDSHAKE_MODE_READY_TO_RECEIVE:
|
|
18
|
+
return "HANDSHAKE_MODE_READY_TO_RECEIVE"
|
|
19
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class DataAdapterParity:
|
|
4
|
+
# No Parity Bit
|
|
5
|
+
PARITY_MODE_NONE = 1
|
|
6
|
+
# Even Parity
|
|
7
|
+
PARITY_MODE_EVEN = 2
|
|
8
|
+
# Odd Parity
|
|
9
|
+
PARITY_MODE_ODD = 3
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def getName(self, val):
|
|
13
|
+
if val == self.PARITY_MODE_NONE:
|
|
14
|
+
return "PARITY_MODE_NONE"
|
|
15
|
+
if val == self.PARITY_MODE_EVEN:
|
|
16
|
+
return "PARITY_MODE_EVEN"
|
|
17
|
+
if val == self.PARITY_MODE_ODD:
|
|
18
|
+
return "PARITY_MODE_ODD"
|
|
19
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class DataAdapterProtocol:
|
|
4
|
+
# Basic half-duplex RS485. Always receiving until you send data.
|
|
5
|
+
PROTOCOL_RS485 = 1
|
|
6
|
+
# Uses full-duplex RS422 communication.
|
|
7
|
+
PROTOCOL_RS422 = 2
|
|
8
|
+
# Allows communication with DMX512-compatible devices, such as stage lighting
|
|
9
|
+
PROTOCOL_DMX512 = 3
|
|
10
|
+
# Allows communication with MODBUS RTU compatible devices
|
|
11
|
+
PROTOCOL_MODBUS_RTU = 4
|
|
12
|
+
# Allows communication with RS232 compatible devices
|
|
13
|
+
PROTOCOL_RS232 = 8
|
|
14
|
+
|
|
15
|
+
@classmethod
|
|
16
|
+
def getName(self, val):
|
|
17
|
+
if val == self.PROTOCOL_RS485:
|
|
18
|
+
return "PROTOCOL_RS485"
|
|
19
|
+
if val == self.PROTOCOL_RS422:
|
|
20
|
+
return "PROTOCOL_RS422"
|
|
21
|
+
if val == self.PROTOCOL_DMX512:
|
|
22
|
+
return "PROTOCOL_DMX512"
|
|
23
|
+
if val == self.PROTOCOL_MODBUS_RTU:
|
|
24
|
+
return "PROTOCOL_MODBUS_RTU"
|
|
25
|
+
if val == self.PROTOCOL_RS232:
|
|
26
|
+
return "PROTOCOL_RS232"
|
|
27
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class DataAdapterSPIChipSelect:
|
|
4
|
+
# CS normally HIGH, Automatically goes LOW during transmission
|
|
5
|
+
SPI_CHIP_SELECT_ACTIVE_LOW = 1
|
|
6
|
+
# CS normally LOW, Automatically goes HIGH during transmission
|
|
7
|
+
SPI_CHIP_SELECT_ACTIVE_HIGH = 2
|
|
8
|
+
# CS is held LOW as long as this is set
|
|
9
|
+
SPI_CHIP_SELECT_LOW = 3
|
|
10
|
+
# CS is held HIGH as long as this is set
|
|
11
|
+
SPI_CHIP_SELECT_HIGH = 4
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def getName(self, val):
|
|
15
|
+
if val == self.SPI_CHIP_SELECT_ACTIVE_LOW:
|
|
16
|
+
return "SPI_CHIP_SELECT_ACTIVE_LOW"
|
|
17
|
+
if val == self.SPI_CHIP_SELECT_ACTIVE_HIGH:
|
|
18
|
+
return "SPI_CHIP_SELECT_ACTIVE_HIGH"
|
|
19
|
+
if val == self.SPI_CHIP_SELECT_LOW:
|
|
20
|
+
return "SPI_CHIP_SELECT_LOW"
|
|
21
|
+
if val == self.SPI_CHIP_SELECT_HIGH:
|
|
22
|
+
return "SPI_CHIP_SELECT_HIGH"
|
|
23
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class DataAdapterSPIMode:
|
|
4
|
+
# CPOL = 0 CPHA = 0
|
|
5
|
+
SPI_MODE_0 = 1
|
|
6
|
+
# CPOL = 0 CPHA = 1
|
|
7
|
+
SPI_MODE_1 = 2
|
|
8
|
+
# CPOL = 1 CPHA = 0
|
|
9
|
+
SPI_MODE_2 = 3
|
|
10
|
+
# CPOL = 1 CPHA = 1
|
|
11
|
+
SPI_MODE_3 = 4
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def getName(self, val):
|
|
15
|
+
if val == self.SPI_MODE_0:
|
|
16
|
+
return "SPI_MODE_0"
|
|
17
|
+
if val == self.SPI_MODE_1:
|
|
18
|
+
return "SPI_MODE_1"
|
|
19
|
+
if val == self.SPI_MODE_2:
|
|
20
|
+
return "SPI_MODE_2"
|
|
21
|
+
if val == self.SPI_MODE_3:
|
|
22
|
+
return "SPI_MODE_3"
|
|
23
|
+
return "<invalid enumeration value>"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ctypes
|
|
3
|
+
class DataAdapterStopBits:
|
|
4
|
+
# One Stop Bit
|
|
5
|
+
STOP_BITS_ONE = 1
|
|
6
|
+
# Two Stop Bits
|
|
7
|
+
STOP_BITS_TWO = 2
|
|
8
|
+
|
|
9
|
+
@classmethod
|
|
10
|
+
def getName(self, val):
|
|
11
|
+
if val == self.STOP_BITS_ONE:
|
|
12
|
+
return "STOP_BITS_ONE"
|
|
13
|
+
if val == self.STOP_BITS_TWO:
|
|
14
|
+
return "STOP_BITS_TWO"
|
|
15
|
+
return "<invalid enumeration value>"
|