]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
Fix type period_ms
authorRay Thomson <thomoray@gmail.com>
Sat, 6 Mar 2021 10:15:00 +0000 (21:15 +1100)
committerRay Thomson <thomoray@gmail.com>
Sat, 6 Mar 2021 10:15:00 +0000 (21:15 +1100)
src/adafruit_blinka/microcontroller/rockchip/PWMOut.py

index f2509f48a2b00bb86447c66fa989cd0a4d64270b..abff5d1ba5393a6bb65776975fbd746fe068e865 100644 (file)
@@ -178,8 +178,8 @@ class PWMOut:
         return self.period_us / 1000
 
     def _set_period_ms(self, period_ms):
-        if not isinstance(period_ms, int):
-            raise TypeError("Invalid period type, should be int.")
+        if not isinstance(period_ms, (int, float)):
+            raise TypeError("Invalid period type, should be int or float.")
         self.period_us = int(period_ms * 1000)
 
     period_ms = property(_get_period_ms, _set_period_ms)
@@ -189,7 +189,7 @@ class PWMOut:
         PWMError: if an I/O or OS error occurs.
         TypeError: if value type is not int.
         
-    :type: int
+    :type: int, float
     """
 
     def _get_period_us(self):