adafruit-circuitpython-si5351 1.4.5__py3-none-any.whl → 1.4.7__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.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: adafruit-circuitpython-si5351
3
- Version: 1.4.5
3
+ Version: 1.4.7
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/code%20style-black-000000.svg
37
- :target: https://github.com/psf/black
38
- :alt: Code Style: Black
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=tN7GKaWMMaNYDfnq8UvM7LkQQz19qBTsk68nCSnzBIo,20805
2
+ adafruit_circuitpython_si5351-1.4.7.dist-info/licenses/LICENSE,sha256=JKh8vHklhmbG1yo3Kb8RoUpvAbiWo-1mN044FsMIsI4,1102
3
+ adafruit_circuitpython_si5351-1.4.7.dist-info/METADATA,sha256=kkhlxEyVNK0qeznl3LmgJ6vBcd8b4ujBTOR2ZrXP3-E,3485
4
+ adafruit_circuitpython_si5351-1.4.7.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
5
+ adafruit_circuitpython_si5351-1.4.7.dist-info/top_level.txt,sha256=Nz5hRW4kRVOegzoCsdAX1mZCp0tR45819r42dSZu-EY,16
6
+ adafruit_circuitpython_si5351-1.4.7.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (80.7.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
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
- from micropython import const
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 # pylint: disable=unused-import
22
+ import typing
23
+
23
24
  from busio import I2C
24
25
  except ImportError:
25
26
  pass
26
27
 
27
- __version__ = "1.4.5"
28
+ __version__ = "1.4.7"
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
- 128 * multiplier + math.floor(128 * ((numerator / denominator)) - 512)
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=jw-6hbBgs5nrDNQIA4wfOhb6E-SQr3aIJrqOR9vwSU4,21269
2
- adafruit_circuitpython_si5351-1.4.5.dist-info/LICENSE,sha256=JKh8vHklhmbG1yo3Kb8RoUpvAbiWo-1mN044FsMIsI4,1102
3
- adafruit_circuitpython_si5351-1.4.5.dist-info/METADATA,sha256=v9d3jXHMTWzUyNrmBKa1KIxRBLtwp1BBxjzpJMWPWQ4,3407
4
- adafruit_circuitpython_si5351-1.4.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
5
- adafruit_circuitpython_si5351-1.4.5.dist-info/top_level.txt,sha256=Nz5hRW4kRVOegzoCsdAX1mZCp0tR45819r42dSZu-EY,16
6
- adafruit_circuitpython_si5351-1.4.5.dist-info/RECORD,,