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.
Files changed (21) hide show
  1. {BDPotentiometer-0.0.3/src/BDPotentiometer.egg-info → BDPotentiometer-0.0.4}/PKG-INFO +1 -1
  2. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/__init__.py +1 -1
  3. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/digital_wiper.py +13 -1
  4. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/mcp4xxx.py +3 -0
  5. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4/src/BDPotentiometer.egg-info}/PKG-INFO +1 -1
  6. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/LICENSE +0 -0
  7. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/README.md +0 -0
  8. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/pyproject.toml +0 -0
  9. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/setup.cfg +0 -0
  10. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/__gpiozero_helpers.py +0 -0
  11. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/__helpers.py +0 -0
  12. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/digital_potentiometer.py +0 -0
  13. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/__init__.py +0 -0
  14. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/mcp4xx1.py +0 -0
  15. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/mcp4xxx/mcp4xx2.py +0 -0
  16. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer/potentiometer.py +0 -0
  17. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/SOURCES.txt +0 -0
  18. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/dependency_links.txt +0 -0
  19. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/requires.txt +0 -0
  20. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/src/BDPotentiometer.egg-info/top_level.txt +0 -0
  21. {BDPotentiometer-0.0.3 → BDPotentiometer-0.0.4}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: BDPotentiometer
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: BD Digital Potentiometer
5
5
  Author-email: Anton Bondarenko <bond.anton@gmail.com>
6
6
  License: MIT License
@@ -2,7 +2,7 @@
2
2
 
3
3
  # pylint: disable=invalid-name
4
4
 
5
- __version__ = "0.0.3"
5
+ __version__ = "0.0.4"
6
6
 
7
7
  from .potentiometer import Potentiometer
8
8
  from .digital_wiper import DigitalWiper, SpiDigitalWiper
@@ -96,7 +96,7 @@ class DigitalWiper:
96
96
  self.__max_value = new_value
97
97
  self.value = self.__value
98
98
 
99
- def _set_value(self, value: int) -> int:
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: BDPotentiometer
3
- Version: 0.0.3
3
+ Version: 0.0.4
4
4
  Summary: BD Digital Potentiometer
5
5
  Author-email: Anton Bondarenko <bond.anton@gmail.com>
6
6
  License: MIT License
File without changes