adafruit-circuitpython-si5351 1.4.6__py3-none-any.whl → 1.4.8__py3-none-any.whl
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.
- {adafruit_circuitpython_si5351-1.4.6.dist-info → adafruit_circuitpython_si5351-1.4.8.dist-info}/METADATA +6 -5
- adafruit_circuitpython_si5351-1.4.8.dist-info/RECORD +6 -0
- {adafruit_circuitpython_si5351-1.4.6.dist-info → adafruit_circuitpython_si5351-1.4.8.dist-info}/WHEEL +1 -1
- adafruit_si5351.py +13 -33
- adafruit_circuitpython_si5351-1.4.6.dist-info/RECORD +0 -6
- {adafruit_circuitpython_si5351-1.4.6.dist-info → adafruit_circuitpython_si5351-1.4.8.dist-info/licenses}/LICENSE +0 -0
- {adafruit_circuitpython_si5351-1.4.6.dist-info → adafruit_circuitpython_si5351-1.4.8.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: adafruit-circuitpython-si5351
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.8
|
4
4
|
Summary: CircuitPython library for SI5351 clock generator module.
|
5
5
|
Author-email: Adafruit Industries <circuitpython@adafruit.com>
|
6
6
|
License: MIT
|
@@ -17,6 +17,7 @@ License-File: LICENSE
|
|
17
17
|
Requires-Dist: Adafruit-Blinka
|
18
18
|
Requires-Dist: adafruit-circuitpython-busdevice
|
19
19
|
Provides-Extra: optional
|
20
|
+
Dynamic: license-file
|
20
21
|
|
21
22
|
Introduction
|
22
23
|
============
|
@@ -33,9 +34,9 @@ Introduction
|
|
33
34
|
:target: https://github.com/adafruit/Adafruit_CircuitPython_SI5351/actions/
|
34
35
|
:alt: Build Status
|
35
36
|
|
36
|
-
.. image:: https://img.shields.io/badge/
|
37
|
-
:target: https://github.com/
|
38
|
-
:alt: Code Style:
|
37
|
+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
|
38
|
+
:target: https://github.com/astral-sh/ruff
|
39
|
+
:alt: Code Style: Ruff
|
39
40
|
|
40
41
|
SI5351 clock generator module.
|
41
42
|
|
@@ -0,0 +1,6 @@
|
|
1
|
+
adafruit_si5351.py,sha256=o8UoNYyqeNnI7OJ85uxggwoBlrkaLAx5zuxckviwhcA,20805
|
2
|
+
adafruit_circuitpython_si5351-1.4.8.dist-info/licenses/LICENSE,sha256=JKh8vHklhmbG1yo3Kb8RoUpvAbiWo-1mN044FsMIsI4,1102
|
3
|
+
adafruit_circuitpython_si5351-1.4.8.dist-info/METADATA,sha256=VshgvQhbIU2Z10uj_sPi6feTeMG1q8f0Px1FJbMaubo,3485
|
4
|
+
adafruit_circuitpython_si5351-1.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
5
|
+
adafruit_circuitpython_si5351-1.4.8.dist-info/top_level.txt,sha256=Nz5hRW4kRVOegzoCsdAX1mZCp0tR45819r42dSZu-EY,16
|
6
|
+
adafruit_circuitpython_si5351-1.4.8.dist-info/RECORD,,
|
adafruit_si5351.py
CHANGED
@@ -12,19 +12,20 @@ library at: https://github.com/adafruit/Adafruit_Si5351_Library/
|
|
12
12
|
|
13
13
|
* Author(s): Tony DiCola
|
14
14
|
"""
|
15
|
-
import math
|
16
15
|
|
17
|
-
|
16
|
+
import math
|
18
17
|
|
19
18
|
from adafruit_bus_device import i2c_device
|
19
|
+
from micropython import const
|
20
20
|
|
21
21
|
try:
|
22
|
-
import typing
|
22
|
+
import typing
|
23
|
+
|
23
24
|
from busio import I2C
|
24
25
|
except ImportError:
|
25
26
|
pass
|
26
27
|
|
27
|
-
__version__ = "1.4.
|
28
|
+
__version__ = "1.4.8"
|
28
29
|
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_SI5351.git"
|
29
30
|
|
30
31
|
|
@@ -122,16 +123,13 @@ R_DIV_128 = 7
|
|
122
123
|
# Disable invalid name because p1, p2, p3 variables are false positives.
|
123
124
|
# These are legitimate register names and adding more characters obfuscates
|
124
125
|
# the intention of the code.
|
125
|
-
# pylint: disable=invalid-name
|
126
126
|
|
127
127
|
# Disable protected access warning because inner classes by design need and use
|
128
128
|
# access to protected members.
|
129
|
-
# pylint: disable=protected-access
|
130
129
|
|
131
130
|
# Another silly pylint check to disable, it has no context of the complexity
|
132
131
|
# of R divider values and explicit unrolling of them into multiple if cases
|
133
132
|
# and return statements. Disable.
|
134
|
-
# pylint: disable=too-many-return-statements
|
135
133
|
|
136
134
|
|
137
135
|
class SI5351:
|
@@ -196,9 +194,7 @@ class SI5351:
|
|
196
194
|
# https://github.com/adafruit/circuitpython/issues/572
|
197
195
|
self._frequency = fvco
|
198
196
|
|
199
|
-
def configure_fractional(
|
200
|
-
self, multiplier: int, numerator: int, denominator: int
|
201
|
-
) -> None:
|
197
|
+
def configure_fractional(self, multiplier: int, numerator: int, denominator: int) -> None:
|
202
198
|
"""Configure the PLL with a fractional multiplier specified by
|
203
199
|
multiplier and numerator/denominator. This is less accurate and
|
204
200
|
susceptible to jitter but allows a larger range of PLL frequencies.
|
@@ -206,22 +202,15 @@ class SI5351:
|
|
206
202
|
if multiplier >= 91 or multiplier <= 14:
|
207
203
|
raise ValueError("Multiplier must be in range 14 to 91.")
|
208
204
|
if denominator > 0xFFFFF or denominator <= 0: # Prevent divide by zero.
|
209
|
-
raise ValueError(
|
210
|
-
"Denominator must be greater than 0 and less than 0xFFFFF."
|
211
|
-
)
|
205
|
+
raise ValueError("Denominator must be greater than 0 and less than 0xFFFFF.")
|
212
206
|
if numerator >= 0xFFFFF or numerator < 0:
|
213
207
|
raise ValueError("Numerator must be in range 0 to 0xFFFFF.")
|
214
208
|
multiplier = int(multiplier)
|
215
209
|
numerator = int(numerator)
|
216
210
|
denominator = int(denominator)
|
217
211
|
# Compute register values and configure them.
|
218
|
-
p1 = int(
|
219
|
-
|
220
|
-
)
|
221
|
-
p2 = int(
|
222
|
-
128 * numerator
|
223
|
-
- denominator * math.floor(128 * (numerator / denominator))
|
224
|
-
)
|
212
|
+
p1 = int(128 * multiplier + math.floor(128 * (numerator / denominator) - 512))
|
213
|
+
p2 = int(128 * numerator - denominator * math.floor(128 * (numerator / denominator)))
|
225
214
|
p3 = denominator
|
226
215
|
self._configure_registers(p1, p2, p3)
|
227
216
|
# Calculate exact frequency and store it for reference.
|
@@ -251,7 +240,7 @@ class SI5351:
|
|
251
240
|
self._divider = None
|
252
241
|
|
253
242
|
@property
|
254
|
-
def frequency(self) -> float:
|
243
|
+
def frequency(self) -> float: # noqa: PLR0911
|
255
244
|
"""Get the frequency of this clock output in hertz. This is
|
256
245
|
computed based on the configured PLL, clock divider, and R divider.
|
257
246
|
"""
|
@@ -263,7 +252,6 @@ class SI5351:
|
|
263
252
|
base_frequency = self._pll.frequency / self._divider
|
264
253
|
# And add a further division for the R divider if set.
|
265
254
|
r_divider = self.r_divider
|
266
|
-
# pylint: disable=no-else-return
|
267
255
|
# Disable should be removed when refactor can be tested.
|
268
256
|
if r_divider == R_DIV_1:
|
269
257
|
return base_frequency
|
@@ -325,9 +313,7 @@ class SI5351:
|
|
325
313
|
buf[8] = p2 & 0x000000FF
|
326
314
|
i2c.write(buf, end=9)
|
327
315
|
|
328
|
-
def configure_integer(
|
329
|
-
self, pll: "PLL", divider: int, inverted: bool = False
|
330
|
-
) -> None:
|
316
|
+
def configure_integer(self, pll: "PLL", divider: int, inverted: bool = False) -> None:
|
331
317
|
"""Configure the clock output with the specified PLL source
|
332
318
|
(should be a PLL instance on the SI5351 class) and specific integer
|
333
319
|
divider. This is the most accurate way to set the clock output
|
@@ -371,13 +357,10 @@ class SI5351:
|
|
371
357
|
fractional divider with numerator/denominator. Again this is less
|
372
358
|
accurate but has a wider range of output frequencies.
|
373
359
|
"""
|
374
|
-
# pylint: disable=too-many-arguments
|
375
360
|
if divider >= 2049 or divider <= 3:
|
376
361
|
raise ValueError("Divider must be in range 3 to 2049.")
|
377
362
|
if denominator > 0xFFFFF or denominator <= 0: # Prevent divide by zero.
|
378
|
-
raise ValueError(
|
379
|
-
"Denominator must be greater than 0 and less than 0xFFFFF."
|
380
|
-
)
|
363
|
+
raise ValueError("Denominator must be greater than 0 and less than 0xFFFFF.")
|
381
364
|
if numerator >= 0xFFFFF or numerator < 0:
|
382
365
|
raise ValueError("Numerator must be in range 0 to 0xFFFFF.")
|
383
366
|
divider = int(divider)
|
@@ -388,10 +371,7 @@ class SI5351:
|
|
388
371
|
raise RuntimeError("PLL must be configured.")
|
389
372
|
# Compute MSx register values.
|
390
373
|
p1 = int(128 * divider + math.floor(128 * (numerator / denominator)) - 512)
|
391
|
-
p2 = int(
|
392
|
-
128 * numerator
|
393
|
-
- denominator * math.floor(128 * (numerator / denominator))
|
394
|
-
)
|
374
|
+
p2 = int(128 * numerator - denominator * math.floor(128 * (numerator / denominator)))
|
395
375
|
p3 = denominator
|
396
376
|
self._configure_registers(p1, p2, p3)
|
397
377
|
# Configure the clock control register.
|
@@ -1,6 +0,0 @@
|
|
1
|
-
adafruit_si5351.py,sha256=thR2OsRTGc88240qi_4evjvYskV5uKyq-ayz5b-f8_k,21269
|
2
|
-
adafruit_circuitpython_si5351-1.4.6.dist-info/LICENSE,sha256=JKh8vHklhmbG1yo3Kb8RoUpvAbiWo-1mN044FsMIsI4,1102
|
3
|
-
adafruit_circuitpython_si5351-1.4.6.dist-info/METADATA,sha256=J1vtOQpWmVRhCWyr0dx956yo9YW8Z37X4FiesgdSiVk,3407
|
4
|
-
adafruit_circuitpython_si5351-1.4.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
5
|
-
adafruit_circuitpython_si5351-1.4.6.dist-info/top_level.txt,sha256=Nz5hRW4kRVOegzoCsdAX1mZCp0tR45819r42dSZu-EY,16
|
6
|
-
adafruit_circuitpython_si5351-1.4.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|