From 4217ab9c308d947acd99b444e93eca4224d0ee91 Mon Sep 17 00:00:00 2001 From: Anton Viktorov Date: Thu, 2 May 2024 03:49:06 +0200 Subject: [PATCH] bmp3xx SPI support added (#3801) Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- components/sensor/bmp3xx.rst | 71 +++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 14 deletions(-) diff --git a/components/sensor/bmp3xx.rst b/components/sensor/bmp3xx.rst index 28ebee1db..af4f4d99e 100644 --- a/components/sensor/bmp3xx.rst +++ b/components/sensor/bmp3xx.rst @@ -7,8 +7,8 @@ BMP388 / BMP390 Temperature+Pressure Sensor :keywords: BMP388 BMP390 The ``bmp3xx`` sensor platform allows you to use your BMP388 or BMP390 -(`datasheet `__, `BMP390 product page `__) temperature and pressure sensors with ESPHome. The :ref:`I²C ` bus is -required to be set up in your configuration for this sensor to work. +(`datasheet `__, `BMP390 product page `__) temperature and pressure sensors with ESPHome. +Either :ref:`I²C ` bus or :ref:`SPI ` bus is required to be set up in your configuration for this sensor to work. .. figure:: images/bmp388.jpg :align: center @@ -16,11 +16,16 @@ required to be set up in your configuration for this sensor to work. BMP388/BMP390 Temperature and Pressure Sensor. + +Over I²C +-------- +The ``bmp3xx_i2c`` component allows you to use the device over :ref:`I²C ` interface. + .. code-block:: yaml - # Example configuration entry + # Example configuration entry for I2C connection sensor: - - platform: bmp3xx + - platform: bmp3xx_i2c temperature: name: "Outside Temperature" oversampling: 16x @@ -29,34 +34,72 @@ required to be set up in your configuration for this sensor to work. address: 0x77 update_interval: 60s -Configuration variables: ------------------------- +Configuration variables: +************************ + +- **address** (*Optional*, int): Manually specify the I²C address of the sensor. Defaults to ``0x77``. + Another address can be ``0x76``. - **temperature** (*Optional*): The information for the temperature sensor. - - **name** (**Required**, string): The name for the temperature - sensor. - **oversampling** (*Optional*): The oversampling parameter for the temperature sensor. See :ref:`Oversampling Options `. - - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. - All other options from :ref:`Sensor `. - **pressure** (*Optional*): The information for the pressure sensor. - - **name** (**Required**, string): The name for the pressure sensor. - **oversampling** (*Optional*): The oversampling parameter for the temperature sensor. See :ref:`Oversampling Options `. - - **id** (*Optional*, :ref:`config-id`): Set the ID of this sensor for use in lambdas. - All other options from :ref:`Sensor `. -- **address** (*Optional*, int): Manually specify the I²C address of - the sensor. Defaults to ``0x77``. Another address can be ``0x76``. - **iir_filter** (*Optional*): Set up an Infinite Impulse Response filter to increase accuracy. One of ``OFF``, ``2x``, ``4x``, ``16x``, ``32``, ``64x``, ``128x``. Defaults to ``OFF``. - **update_interval** (*Optional*, :ref:`config-time`): The interval to check the sensor. Defaults to ``60s``. +Over SPI +-------- +The ``bmp3xx_spi`` component allows you to use the device over :ref:`SPI ` interface. + +.. code-block:: yaml + + # Example configuration entry for SPI connection + sensor: + - platform: bmp3xx_spi + temperature: + name: "Outside Temperature" + oversampling: 16x + pressure: + name: "Outside Pressure" + cs_pin: 13 + update_interval: 60s + + +Configuration variables: +************************ + +- **cs_pin** (**Required**, :ref:`Pin Schema `): The Chip Select (CS) pin. +- **temperature** (*Optional*): The information for the temperature sensor. + + - **oversampling** (*Optional*): The oversampling parameter for the temperature sensor. + See :ref:`Oversampling Options `. + - All other options from :ref:`Sensor `. + +- **pressure** (*Optional*): The information for the pressure sensor. + + - **oversampling** (*Optional*): The oversampling parameter for the temperature sensor. + See :ref:`Oversampling Options `. + - All other options from :ref:`Sensor `. + +- **iir_filter** (*Optional*): Set up an Infinite Impulse Response filter to increase accuracy. One of + ``OFF``, ``2x``, ``4x``, ``16x``, ``32``, ``64x``, ``128x``. Defaults to ``OFF``. +- **address** (*Optional*, int): *I2C* only. Manually specify the I²C address of + the sensor. Defaults to ``0x77``. Another address can be ``0x76``. +- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the + sensor. Defaults to ``60s``. + + .. _bmp3xx-oversampling: Oversampling Options @@ -80,7 +123,7 @@ See Also - :doc:`bmp280` - :doc:`bme680` - :doc:`bmp085` -- :apiref:`bmp3xx/bmp3xx.h` +- :apiref:`bmp3xx_base/bmp3xx_base.h` - `BMP3 sensor API `__ - `BMP388/BMP390 Library `__ by Martin Lindupp - :ghedit:`Edit`