From 77c3f7f5b40c57dec9c5f49ec5a0e320784a581b Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Sun, 25 Jun 2023 21:05:50 +0200 Subject: [PATCH] drivers/shield_w5100: add module for the W5100 Ethernet Shield This module provides no more than the correct configuration parameters for the `w5100` driver using the Arduino I/O mapping features. But by doing so, it will work out of the box with every mechanically and electrically compatible board for which the Arduino I/O mapping features are implemented. --- drivers/Makefile.dep | 8 ++++++++ drivers/doc.txt | 30 +++++++++++++++++++++++++++- drivers/w5100/include/w5100_params.h | 6 ++++++ makefiles/pseudomodules.inc.mk | 1 + 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/Makefile.dep b/drivers/Makefile.dep index 9be99ff67e82a..f3ef3486f83fe 100644 --- a/drivers/Makefile.dep +++ b/drivers/Makefile.dep @@ -180,6 +180,14 @@ ifneq (,$(filter servo_%,$(USEMODULE))) USEMODULE += servo endif +ifneq (,$(filter shield_w5100,$(USEMODULE))) + FEATURES_REQUIRED += arduino_pins + FEATURES_REQUIRED += arduino_shield_isp + FEATURES_REQUIRED += arduino_shield_uno + FEATURES_REQUIRED += arduino_spi + USEMODULE += w5100 +endif + ifneq (,$(filter sht1%,$(USEMODULE))) USEMODULE += sht1x endif diff --git a/drivers/doc.txt b/drivers/doc.txt index 5a90ad875b1cc..8d88e72bf373d 100644 --- a/drivers/doc.txt +++ b/drivers/doc.txt @@ -121,4 +121,32 @@ * @ingroup config * @brief Compile time configurations for different kinds of * devices that do not match any other category - */ \ No newline at end of file + */ + +/** + * @defgroup drivers_shield Shields - hardware extension daughter board drivers + * @ingroup driver + * @brief Provides drivers for hardware extension daughter boards such as + * Arduino Shields + */ + +/** + * @defgroup drivers_shield_w5100 W5100 Ethernet Shield driver + * @ingroup driver_shield + * @brief Driver for the Arduino W5100 Ethernet Shield + * + * Usage + * ===== + * + * The driver is enabled by using the module `shield_w5100`, e.g. with: + * + * ``` + * USEMODULE=shield_w5100 make BOARD=arduino-due -C examples/gnrc_networking + * ``` + * + * It depends on @ref drivers_w5100 and provides nothing more than the providing + * the correct configuration. For this, it depends on the `arduino_pins`, + * `arduino_spi`, `arduino_shield_uno` and the `arduino_shield_isp` feature. + * It should work out of the box for any fully Arduino UNO compatible board + * (including the ISP header) and correct I/O mapping (`arduino_*`) features. + */ diff --git a/drivers/w5100/include/w5100_params.h b/drivers/w5100/include/w5100_params.h index 30ebd3b2dbfc6..83c904bb1179d 100644 --- a/drivers/w5100/include/w5100_params.h +++ b/drivers/w5100/include/w5100_params.h @@ -25,6 +25,12 @@ extern "C" { #endif +#ifdef MODULE_SHIELD_W5100 +#define W5100_PARAM_SPI ARDUINO_SPI_ISP +#define W5100_PARAM_CS ARDUINO_PIN_10 +#define W5100_PARAM_EVT ARDUINO_PIN_2 +#endif + /** * @name Default configuration parameters for the W5100 driver * @{ diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 8d0ecdb50403e..9c824ae899f23 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -494,6 +494,7 @@ PSEUDOMODULES += shell_commands ## @} PSEUDOMODULES += shell_hooks PSEUDOMODULES += shell_lock_auto_locking +PSEUDOMODULES += shield_w5100 PSEUDOMODULES += slipdev_stdio PSEUDOMODULES += slipdev_l2addr PSEUDOMODULES += sock