diff --git a/.pylintrc b/.pylintrc index 40208c3..6eea82f 100644 --- a/.pylintrc +++ b/.pylintrc @@ -279,7 +279,7 @@ function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ # Good variable names which should always be accepted, separated by a comma # good-names=i,j,k,ex,Run,_ -good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_ +good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_,cs # Include a hint for the correct naming format with invalid-name include-naming-hint=no diff --git a/adafruit_bme280/advanced.py b/adafruit_bme280/advanced.py index d8da95c..98ed180 100644 --- a/adafruit_bme280/advanced.py +++ b/adafruit_bme280/advanced.py @@ -284,36 +284,36 @@ class Adafruit_BME280_I2C(Adafruit_BME280_Advanced): **Quickstart: Importing and using the BME280** - Here is an example of using the :class:`Adafruit_BME280_I2C`. - First you will need to import the libraries to use the sensor + Here is an example of using the :class:`Adafruit_BME280_I2C`. + First you will need to import the libraries to use the sensor - .. code-block:: python + .. code-block:: python - import board - import adafruit_bme280.advanced as adafruit_bme280 + import board + import adafruit_bme280.advanced as adafruit_bme280 - Once this is done you can define your `board.I2C` object and define your sensor object + Once this is done you can define your `board.I2C` object and define your sensor object - .. code-block:: python + .. code-block:: python - i2c = board.I2C() # uses board.SCL and board.SDA - bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) + i2c = board.I2C() # uses board.SCL and board.SDA + bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) - You need to setup the pressure at sea level + You need to setup the pressure at sea level - .. code-block:: python + .. code-block:: python - bme280.sea_level_pressure = 1013.25 + bme280.sea_level_pressure = 1013.25 - Now you have access to the :attr:`temperature`, :attr:`relative_humidity` - :attr:`pressure` and :attr:`altitude` attributes + Now you have access to the :attr:`temperature`, :attr:`relative_humidity` + :attr:`pressure` and :attr:`altitude` attributes - .. code-block:: python + .. code-block:: python - temperature = bme280.temperature - relative_humidity = bme280.relative_humidity - pressure = bme280.pressure - altitude = bme280.altitude + temperature = bme280.temperature + relative_humidity = bme280.relative_humidity + pressure = bme280.pressure + altitude = bme280.altitude """ @@ -334,38 +334,38 @@ class Adafruit_BME280_SPI(Adafruit_BME280_Advanced): **Quickstart: Importing and using the BME280** - Here is an example of using the :class:`Adafruit_BME280_SPI` class. - First you will need to import the libraries to use the sensor + Here is an example of using the :class:`Adafruit_BME280_SPI` class. + First you will need to import the libraries to use the sensor - .. code-block:: python + .. code-block:: python - import board - from digitalio import DigitalInOut - import adafruit_bme280.advanced as adafruit_bme280 + import board + from digitalio import DigitalInOut + import adafruit_bme280.advanced as adafruit_bme280 - Once this is done you can define your `board.SPI` object and define your sensor object + Once this is done you can define your `board.SPI` object and define your sensor object - .. code-block:: python + .. code-block:: python - cs = digitalio.DigitalInOut(board.D10) - spi = board.SPI() - bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs) + cs = digitalio.DigitalInOut(board.D10) + spi = board.SPI() + bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs) - You need to setup the pressure at sea level + You need to setup the pressure at sea level - .. code-block:: python + .. code-block:: python - bme280.sea_level_pressure = 1013.25 + bme280.sea_level_pressure = 1013.25 - Now you have access to the :attr:`temperature`, :attr:`relative_humidity` - :attr:`pressure` and :attr:`altitude` attributes + Now you have access to the :attr:`temperature`, :attr:`relative_humidity` + :attr:`pressure` and :attr:`altitude` attributes - .. code-block:: python + .. code-block:: python - temperature = bme280.temperature - relative_humidity = bme280.relative_humidity - pressure = bme280.pressure - altitude = bme280.altitude + temperature = bme280.temperature + relative_humidity = bme280.relative_humidity + pressure = bme280.pressure + altitude = bme280.altitude """ diff --git a/adafruit_bme280/basic.py b/adafruit_bme280/basic.py index c4e345a..958da93 100644 --- a/adafruit_bme280/basic.py +++ b/adafruit_bme280/basic.py @@ -331,36 +331,36 @@ class Adafruit_BME280_I2C(Adafruit_BME280): **Quickstart: Importing and using the BME280** - Here is an example of using the :class:`Adafruit_BME280_I2C`. - First you will need to import the libraries to use the sensor + Here is an example of using the :class:`Adafruit_BME280_I2C`. + First you will need to import the libraries to use the sensor - .. code-block:: python + .. code-block:: python - import board - from adafruit_bme280 import basic as adafruit_bme280 + import board + from adafruit_bme280 import basic as adafruit_bme280 - Once this is done you can define your `board.I2C` object and define your sensor object + Once this is done you can define your `board.I2C` object and define your sensor object - .. code-block:: python + .. code-block:: python - i2c = board.I2C() # uses board.SCL and board.SDA - bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) + i2c = board.I2C() # uses board.SCL and board.SDA + bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c) - You need to setup the pressure at sea level + You need to setup the pressure at sea level - .. code-block:: python + .. code-block:: python - bme280.sea_level_pressure = 1013.25 + bme280.sea_level_pressure = 1013.25 - Now you have access to the :attr:`temperature`, :attr:`relative_humidity` - :attr:`pressure` and :attr:`altitude` attributes + Now you have access to the :attr:`temperature`, :attr:`relative_humidity` + :attr:`pressure` and :attr:`altitude` attributes - .. code-block:: python + .. code-block:: python - temperature = bme280.temperature - relative_humidity = bme280.relative_humidity - pressure = bme280.pressure - altitude = bme280.altitude + temperature = bme280.temperature + relative_humidity = bme280.relative_humidity + pressure = bme280.pressure + altitude = bme280.altitude """ diff --git a/adafruit_bme280/protocol.py b/adafruit_bme280/protocol.py index b24a397..8cb7058 100644 --- a/adafruit_bme280/protocol.py +++ b/adafruit_bme280/protocol.py @@ -26,18 +26,18 @@ def read_register(self, register: int, length: int) -> bytearray: return result def write_register_byte(self, register: int, value: int) -> None: - "Write to the device register." + """Write to the device register""" with self._i2c as i2c: i2c.write(bytes([register & 0xFF, value & 0xFF])) class SPI_Impl: - "Protocol implemenation for the SPI bus." + """Protocol implemenation for the SPI bus.""" def __init__( self, spi: SPI, - cs: DigitalInOut, # pylint: disable=invalid-name + cs: DigitalInOut, baudrate: int = 100000, ) -> None: from adafruit_bus_device import ( # pylint: disable=import-outside-toplevel diff --git a/docs/api.rst b/docs/api.rst index 8818b61..ffdfd9a 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -9,3 +9,6 @@ .. automodule:: adafruit_bme280.advanced :members: + +.. automodule:: adafruit_bme280.protocol + :members: