boards: shields: add spi support to mikroe weather click shield

Added support for the SPI interface which is availble on the shield
if the jumper configurations are changed.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
This commit is contained in:
Ian Morris 2024-11-18 09:13:49 -08:00 committed by Benjamin Cabé
commit 12fada03e9
5 changed files with 36 additions and 4 deletions

View file

@ -1,5 +1,8 @@
# Copyright (c) 2024 Common Ground Electronics
# SPDX-License-Identifier: Apache-2.0
config SHIELD_MIKROE_WEATHER_CLICK
def_bool $(shields_list_contains,mikroe_weather_click)
config SHIELD_MIKROE_WEATHER_CLICK_I2C
def_bool $(shields_list_contains,mikroe_weather_click_i2c)
config SHIELD_MIKROE_WEATHER_CLICK_SPI
def_bool $(shields_list_contains,mikroe_weather_click_spi)

View file

@ -21,8 +21,15 @@ Requirements
This shield can only be used with a board that provides a mikroBUS |trade|
socket and defines a ``mikrobus_i2c`` node label for the mikroBUS |trade| I2C
interface or a ``mikrobus_spi`` node label for the mikroBUS |trade| SPI
interface (see :ref:`shields` for more details).
.. note::
By default the Weather Click is configured to use the I2C interface. In
order to use the SPI interface the jumper settings must be changed. See
the `Weather Click Schematic`_ for further details.
For more information about the BME280 and the Weather Click, see the following
documentation:
@ -34,13 +41,14 @@ documentation:
Programming
***********
Set ``--shield mikroe_weather_click`` when you invoke ``west build``. For
Set ``--shield mikroe_weather_click_i2c`` or
``--shield mikroe_weather_click_spi`` when you invoke ``west build``. For
example:
.. zephyr-app-commands::
:zephyr-app: samples/sensor/bme280
:board: lpcxpresso55s16
:shield: mikroe_weather_click
:shield: [mikroe_weather_click_i2c | mikroe_weather_click_spi]
:goals: build
.. _Weather Click:

View file

@ -0,0 +1,17 @@
/*
* Copyright (c) 2024 Ian Morris
*
* SPDX-License-Identifier: Apache-2.0
*/
&mikrobus_spi {
status = "okay";
cs-gpios = <&mikrobus_header 2 GPIO_ACTIVE_LOW>;
bme280_mikroe_weather_click: bme280@0 {
status = "okay";
compatible = "bosch,bme280";
spi-max-frequency = <1000000>;
reg = <0>;
};
};

View file

@ -38,6 +38,10 @@ Security
Boards
******
* Shield ``mikroe_weather_click`` now supports both I2C and SPI interfaces. Users should select
the required configuration by using ``mikroe_weather_click_i2c`` or ``mikroe_weather_click_spi``
instead of ``mikroe_weather_click``.
Devicetree
**********