Skip to content

Commit

Permalink
boards: shields: add spi support to mikroe weather click shield
Browse files Browse the repository at this point in the history
Added support for the SPI interface which is availble on the shield
if the jumper configurations are changed.

Signed-off-by: Ian Morris <[email protected]>
  • Loading branch information
iandmorris committed Nov 27, 2024
1 parent 318492b commit 38b77fb
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 10 deletions.
6 changes: 6 additions & 0 deletions boards/shields/mikroe_weather_click/Kconfig.shield
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@

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)
9 changes: 8 additions & 1 deletion boards/shields/mikroe_weather_click/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 changned. See
the `Weather Click Schematic`_ for further details.

For more information about the BME280 and the Weather Click, see the following
documentation:

Expand All @@ -40,7 +47,7 @@ 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:
Expand Down
14 changes: 5 additions & 9 deletions boards/shields/mikroe_weather_click/mikroe_weather_click.overlay
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/*
* Copyright (c) 2024 Common Ground Electronics
* Copyright (c) 2024 Ian Morris
*
* SPDX-License-Identifier: Apache-2.0
*/

&mikrobus_i2c {
status = "okay";

bme280_mikroe_weather_click: bme280@76 {
compatible = "bosch,bme280";
reg = <0x76>;
};
};
/*
* This file is intentionally empty. Please refer to shield documentation for
* instructions on how to use this shield.
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2024 Common Ground Electronics
*
* SPDX-License-Identifier: Apache-2.0
*/

&mikrobus_i2c {
status = "okay";

bme280_mikroe_weather_click: bme280@76 {
compatible = "bosch,bme280";
reg = <0x76>;
};
};
Original file line number Diff line number Diff line change
@@ -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>;
};
};

0 comments on commit 38b77fb

Please sign in to comment.