Skip to content

Commit 1ceb9e2

Browse files
committed
pre-commit for library and example
1 parent 0100728 commit 1ceb9e2

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

adafruit_tmag5273.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@
2727
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
2828
"""
2929

30-
import time
3130
import struct
32-
from micropython import const
31+
import time
32+
3333
from adafruit_bus_device.i2c_device import I2CDevice
34-
from adafruit_register.i2c_struct import ROUnaryStruct, UnaryStruct
3534
from adafruit_register.i2c_bit import RWBit
3635
from adafruit_register.i2c_bits import RWBits
36+
from adafruit_register.i2c_struct import ROUnaryStruct, UnaryStruct
37+
from micropython import const
3738

3839
try:
3940
from typing import Tuple
41+
4042
from busio import I2C
4143
except ImportError:
4244
pass
@@ -335,7 +337,8 @@ def _read_raw_16(self, register: int) -> int:
335337
i2c.write_then_readinto(bytes([register]), buf)
336338
return struct.unpack(">h", buf)[0]
337339

338-
def _raw_to_microtesla(self, raw: int, range_mt: float) -> float:
340+
@staticmethod
341+
def _raw_to_microtesla(raw: int, range_mt: float) -> float:
339342
return (raw / 32768.0) * range_mt * 1000.0
340343

341344
@property
@@ -381,7 +384,7 @@ def magnitude_mt(self) -> float:
381384
"""
382385
raw = self._magnitude_raw
383386
angle_mode = self.angle_calculation
384-
if angle_mode in (ANGLE_XZ, ANGLE_YZ):
387+
if angle_mode in {ANGLE_XZ, ANGLE_YZ}:
385388
range_val = max(self._range_xy, self._range_z)
386389
else:
387390
range_val = self._range_xy

examples/tmag5273_simpletest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# SPDX-License-Identifier: MIT
44

55
import time
6+
67
import board
8+
79
import adafruit_tmag5273
810

911
i2c = board.I2C()

0 commit comments

Comments
 (0)