Skip to content

Commit

Permalink
shields: Add arduino uno click shield
Browse files Browse the repository at this point in the history
The shield converts Arduino UNO R3 headers to two mikroBUS
sockets.
Two mickoBUS sockets are exposed via the overlay labelled
mikrobus_header_1 and mikrobus_header_2.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
  • Loading branch information
talih0 committed Jul 4, 2023
1 parent 6e72e40 commit ea67682
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
5 changes: 5 additions & 0 deletions boards/shields/arduino_uno_click/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) 2023 Andriy Gelman
# SPDX-License-Identifier: Apache-2.0

config ARDUINO_UNO_CLICK
def_bool $(shields_list_contains,arduino_uno_click)
57 changes: 57 additions & 0 deletions boards/shields/arduino_uno_click/arduino_uno_click.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2023 Andriy Gelman
*
* SPDX-License-Identifier: Apache-2.0
*/

/ {
mikrobus_header_1: mikrobus-connector-1 {
compatible = "mikro-bus";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &arduino_header 0 0>, /* AN -> A0 */
<1 0 &arduino_header 3 0>, /* RST -> A3 */
<2 0 &arduino_header 16 0>, /* CS -> D10 */
<3 0 &arduino_header 19 0>, /* SCK -> D13 */
<4 0 &arduino_header 18 0>, /* MISO -> D12 */
<5 0 &arduino_header 17 0>, /* MOSI -> D11 */
/* +3.3V */
/* GND */
<6 0 &arduino_header 12 0>, /* PWM -> D6 */
<7 0 &arduino_header 8 0>, /* INT -> D2 */
<8 0 &arduino_header 6 0>, /* RX -> D0 */
<9 0 &arduino_header 7 0>, /* TX -> D1 */
<10 0 &arduino_header 5 0>, /* SCL -> A5 */
<11 0 &arduino_header 4 0>; /* SDA -> A4 */
/* +5V */
/* GND */
};

mikrobus_header_2: mikrobus-connector-2 {
compatible = "mikro-bus";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map = <0 0 &arduino_header 1 0>, /* AN -> A1 */
<1 0 &arduino_header 2 0>, /* RST -> A2 */
<2 0 &arduino_header 15 0>, /* CS -> D9 */
<3 0 &arduino_header 19 0>, /* SCK -> D13 */
<4 0 &arduino_header 18 0>, /* MISO -> D12 */
<5 0 &arduino_header 17 0>, /* MOSI -> D11 */
/* +3.3V */
/* GND */
<6 0 &arduino_header 11 0>, /* PWM -> D5 */
<7 0 &arduino_header 9 0>, /* INT -> D3 */
<8 0 &arduino_header 6 0>, /* RX -> D0 */
<9 0 &arduino_header 7 0>, /* TX -> D1 */
<10 0 &arduino_header 5 0>, /* SCL -> A5 */
<11 0 &arduino_header 4 0>; /* SDA -> A4 */
/* +5V */
/* GND */
};
};

mikrobus_spi: &arduino_spi {};
mikrobus_serial: &arduino_serial {};
mikrobus_i2c: &arduino_i2c {};
62 changes: 62 additions & 0 deletions boards/shields/arduino_uno_click/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.. _arduino_uno_click:

Arduino UNO click shield
########################

Overview
********

The Arduino UNO click is an extension to the Arduino UNO R3 headers.
It's a simple shield that converts Arduino UNO R3 headers to two mikroBUS
host sockets that allow you to connect many other click shields to your
board.
In other words, he Arduino UNO click will generally be used by other
shields using the mikroBUS interface.

Two mikroBUS headers are exposed by the overlay: mikrobus_headers_1 and
mikrobus_headers_2, each corresponding to a socket on the Arduino UNO
click shield.

More information about the shield can be found at
`Arduino UNO click shield website`_.

Requirements
************

This shield can only be used with a board which provides a configuration
for Arduino R3 connector.

Since the Arduino UNO click has two sockets, the user must create a node
alias depeding on which of the sockets is used:

mikrobus_header: &mikrobus_header_1 {}; or
mikrobus_header: &mikrobus_header_2 {};

The board must also define node aliases for arduino Serial,
SPI and I2C interfaces (see :ref:`shields` for more details).

If a node alias for one of the interfaces does not exist and it is not used
by the connecting shield, a dummy node alias can be created by the board.
An alternative is to simply delete the node alias from the
arduino_uno_click.overlay file. For example if a connecting shield only uses
the mikrobus_spi node alias, then mikrobus_serial and mikrobus_i2c can be deleted.

Programming
***********

Include ``-DSHIELD=arduino_uno_click`` when you invoke ``west build`` with
other mikroBUS shields. For example:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/can/counter
:board: xmc47_relax_kit
:shield: "arduino_uno_click mcp2518fd_click"
:goals: build

References
**********

.. target-notes::

.. _Arduino UNO click shield website:
https://www.mikroe.com/arduino-uno-click-shield

0 comments on commit ea67682

Please sign in to comment.