BDPotentiometer 0.0.3__tar.gz → 0.0.4__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.
- {BDPotentiometer-0.0.3/src/BDPotentiometer.egg-info → BDPotentiometer-0.0.4}/PKG-INFO +1 -1
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/__init__.py +1 -1
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/digital_wiper.py +13 -1
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/mcp4xxx.py +3 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4/src/BDPotentiometer.egg-info}/PKG-INFO +1 -1
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/LICENSE +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/README.md +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/pyproject.toml +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/setup.cfg +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/__gpiozero_helpers.py +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/__helpers.py +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/digital_potentiometer.py +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/__init__.py +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/mcp4xx1.py +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/mcp4xx2.py +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/potentiometer.py +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/SOURCES.txt +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/dependency_links.txt +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/requires.txt +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/top_level.txt +0 -0
- {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/tests/test_version.py +0 -0
|
@@ -96,7 +96,7 @@ class DigitalWiper:
|
|
|
96
96
|
self.__max_value = new_value
|
|
97
97
|
self.value = self.__value
|
|
98
98
|
|
|
99
|
-
def
|
|
99
|
+
def _check_value(self, value: int) -> int:
|
|
100
100
|
"""
|
|
101
101
|
Set given wiper position to `value`.
|
|
102
102
|
|
|
@@ -108,6 +108,16 @@ class DigitalWiper:
|
|
|
108
108
|
return self.max_value - value
|
|
109
109
|
return value
|
|
110
110
|
|
|
111
|
+
def _set_value(self, value: int) -> int:
|
|
112
|
+
"""
|
|
113
|
+
Set given wiper position to `value`.
|
|
114
|
+
|
|
115
|
+
:param value: Requested value as int.
|
|
116
|
+
:return: Value actually set as int.
|
|
117
|
+
"""
|
|
118
|
+
value = self._check_value(value)
|
|
119
|
+
return value
|
|
120
|
+
|
|
111
121
|
def _read_value(self) -> int:
|
|
112
122
|
"""
|
|
113
123
|
Read value of wiper position.
|
|
@@ -254,6 +264,7 @@ class SpiDigitalWiper(DigitalWiper):
|
|
|
254
264
|
potentiometer: Potentiometer,
|
|
255
265
|
spi: Union[SPI, None] = None,
|
|
256
266
|
max_value: int = 128,
|
|
267
|
+
invert: bool = False,
|
|
257
268
|
parameters_locked: bool = False,
|
|
258
269
|
):
|
|
259
270
|
self.__spi = None
|
|
@@ -262,6 +273,7 @@ class SpiDigitalWiper(DigitalWiper):
|
|
|
262
273
|
super().__init__(
|
|
263
274
|
potentiometer=potentiometer,
|
|
264
275
|
max_value=max_value,
|
|
276
|
+
invert=invert,
|
|
265
277
|
parameters_locked=parameters_locked,
|
|
266
278
|
)
|
|
267
279
|
|
|
@@ -118,17 +118,20 @@ class MCP4xxxWiper(SpiDigitalWiper):
|
|
|
118
118
|
potentiometer: MCP4xxxPotentiometer,
|
|
119
119
|
spi: Union[SPI, None] = None,
|
|
120
120
|
max_value: int = 128,
|
|
121
|
+
invert: bool = False,
|
|
121
122
|
):
|
|
122
123
|
max_value = _coerce_max_value(max_value)
|
|
123
124
|
super().__init__(
|
|
124
125
|
potentiometer=potentiometer,
|
|
125
126
|
spi=spi,
|
|
126
127
|
max_value=max_value,
|
|
128
|
+
invert=invert,
|
|
127
129
|
parameters_locked=True,
|
|
128
130
|
)
|
|
129
131
|
|
|
130
132
|
def _set_value(self, value: int) -> int:
|
|
131
133
|
if isinstance(self.spi, SPI):
|
|
134
|
+
value = self._check_value(value)
|
|
132
135
|
data = self.spi.transfer([_W_CMD | _CH[self.channel], value])
|
|
133
136
|
_check_write_response(data)
|
|
134
137
|
return value
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/digital_potentiometer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|