X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/blobdiff_plain/98f4a4378478d11e514acd7ff22a9c674f3cbca3..c2bc4a90827f28abb6b51eae659a1f80a65c0497:/src/adafruit_blinka/microcontroller/nxp_lpc4330/i2c.py?ds=sidebyside diff --git a/src/adafruit_blinka/microcontroller/nxp_lpc4330/i2c.py b/src/adafruit_blinka/microcontroller/nxp_lpc4330/i2c.py index e37fae1..53e18e8 100644 --- a/src/adafruit_blinka/microcontroller/nxp_lpc4330/i2c.py +++ b/src/adafruit_blinka/microcontroller/nxp_lpc4330/i2c.py @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries +# +# SPDX-License-Identifier: MIT """I2C Class for NXP LPC4330""" from greatfet import GreatFET @@ -5,6 +8,7 @@ from greatfet import GreatFET class I2C: """Custom I2C Class for NXP LPC4330""" + # pylint: disable=unused-argument def __init__(self, *, frequency=100000): self._gf = GreatFET() @@ -12,12 +16,11 @@ class I2C: """Perform an I2C Device Scan""" return [index for index, dev in enumerate(self._gf.i2c.scan()) if dev[0]] - # pylint: disable=unused-argument def writeto(self, address, buffer, *, start=0, end=None, stop=True): """Write data from the buffer to an address""" if end is None: end = len(buffer) - self._gf.i2c.write(address, buffer[start: end]) + self._gf.i2c.write(address, buffer[start:end]) def readfrom_into(self, address, buffer, *, start=0, end=None, stop=True): """Read data from an address and into the buffer""" @@ -26,6 +29,7 @@ class I2C: readin = self._gf.i2c.read(address, end - start) for i in range(end - start): buffer[i + start] = readin[i] + # pylint: enable=unused-argument def writeto_then_readfrom( @@ -38,7 +42,7 @@ class I2C: out_end=None, in_start=0, in_end=None, - stop=False + stop=False, ): """Write data from buffer_out to an address and then read data from an address and into buffer_in