Skip to content

Commit fdc7835

Browse files
committed
QA: Apply codespell suggestions.
Rename set_mag_full_scale_guass and provide a back-compat shim.
1 parent f7f9cc8 commit fdc7835

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lsm303d/__init__.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def __init__(self, i2c_addr=0x1D, i2c_dev=None):
340340
self._is_setup = False
341341

342342
self._accel_full_scale_g = 2
343-
self._mag_full_scale_guass = 2
343+
self._mag_full_scale_gauss = 2
344344

345345
def set_accel_full_scale_g(self, scale):
346346
"""Set the full scale range for the accelerometer in g
@@ -351,15 +351,17 @@ def set_accel_full_scale_g(self, scale):
351351
self._accel_full_scale_g = scale
352352
self._lsm303d.set('CONTROL2', accel_full_scale_g=self._accel_full_scale_g)
353353

354-
def set_mag_full_scale_guass(self, scale):
355-
"""Set the full scale range for the magnetometer in guass
354+
def set_mag_full_scale_gauss(self, scale):
355+
"""Set the full scale range for the magnetometer in gauss
356356
357-
:param scale: One of 2, 4, 8 or 12 guass
357+
:param scale: One of 2, 4, 8 or 12 gauss
358358
359359
"""
360-
self._mag_full_scale_guass = scale
360+
self._mag_full_scale_gauss = scale
361361
self._lsm303d.set('CONTROL6', mag_full_scale_gauss=scale) # +-2
362362

363+
set_mag_full_scale_guass = set_mag_full_scale_gauss
364+
363365
def setup(self):
364366
if self._is_setup:
365367
return
@@ -406,26 +408,26 @@ def setup(self):
406408
mag_data_rate_hz=50,
407409
enable_temperature=1)
408410

409-
self.set_mag_full_scale_guass(2)
411+
self.set_mag_full_scale_gauss(2)
410412

411413
self._lsm303d.set('CONTROL7', mag_mode='continuous')
412414

413415
def magnetometer(self):
414416
"""Return magnetometer x, y and z readings.
415417
416-
These readings are given in guass and should be +/- the given mag_full_scale_guass value.
418+
These readings are given in gauss and should be +/- the given mag_full_scale_gauss value.
417419
418420
"""
419421
self.setup()
420422
mag = self._lsm303d.get('MAGNETOMETER')
421423
x, y, z = mag.x, mag.y, mag.z
422-
x, y, z = [(p / 32767.0) * self._mag_full_scale_guass for p in (x, y, z)]
424+
x, y, z = [(p / 32767.0) * self._mag_full_scale_gauss for p in (x, y, z)]
423425
return x, y, z
424426

425427
def accelerometer(self):
426-
"""Return acelerometer x, y and z readings.
428+
"""Return accelerometer x, y and z readings.
427429
428-
These readings are given in g annd should be +/- the given accel_full_scale_g value.
430+
These readings are given in g and should be +/- the given accel_full_scale_g value.
429431
430432
"""
431433
self.setup()

0 commit comments

Comments
 (0)