Skip to content

Commit c916224

Browse files
author
brentru
committed
set freq
1 parent 64ca443 commit c916224

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_esp32spi/PWMOut.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def deinit(self):
6565
self._pwm_pin = None
6666

6767
def _is_deinited(self):
68+
"""Checks if PWMOut object has been previously de-initalized"""
6869
if self._pwm_pin is None:
6970
raise ValueError("PWMOut Object has been deinitialized and can no longer "
7071
"be used. Create a new PWMOut object.")
@@ -85,7 +86,6 @@ def duty_cycle(self, duty_cycle):
8586
self._is_deinited()
8687
if not isinstance(duty_cycle, (int, float)):
8788
raise TypeError("Invalid duty_cycle, should be int or float.")
88-
8989
duty_cycle /= 65535.0
9090
if not 0.0 <= duty_cycle <= 1.0:
9191
raise ValueError("Invalid duty_cycle, should be between 0.0 and 1.0")
@@ -104,4 +104,5 @@ def frequency(self, freq):
104104
NOTE: Only writeable when constructed with variable_Frequency=True.
105105
"""
106106
self._is_deinited()
107+
self._freq = freq
107108
raise NotImplementedError("PWMOut Frequency not implemented in ESP32SPI")

0 commit comments

Comments
 (0)