From 65f0e2c96ab97a8723a10d3a08c773682371cbc2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 31 Jul 2018 13:34:43 -0400 Subject: [PATCH] raise explanatory exception when trying to set channel frequency --- adafruit_pca9685.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/adafruit_pca9685.py b/adafruit_pca9685.py index 2d40501..12b5e75 100755 --- a/adafruit_pca9685.py +++ b/adafruit_pca9685.py @@ -65,9 +65,15 @@ def __init__(self, pca, index): @property def frequency(self): - """The overall PWM frequency in herz.""" + """The overall PWM frequency in Hertz (read-only). + A PWMChannel's frequency cannot be set individually. + All channels share a common frequency, set by PCA9685.frequency.""" return self._pca.frequency + @frequency.setter + def frequency(self, _): + raise NotImplementedError("frequency cannot be set on individual channels") + @property def duty_cycle(self): """16 bit value that dictates how much of one cycle is high (1) versus low (0). 0xffff will @@ -114,7 +120,7 @@ class PCA9685: :param ~busio.I2C i2c_bus: The I2C bus which the PCA9685 is connected to. :param int address: The I2C address of the PCA9685. - :param int reference_clock_speed: The frequency of the internal reference clock in Herz. + :param int reference_clock_speed: The frequency of the internal reference clock in Hertz. """ # Registers: mode1_reg = UnaryStruct(0x00, '