Skip to content

Commit

Permalink
drivers: Add shield_llcc68 module
Browse files Browse the repository at this point in the history
This implements the `shield_llcc68` module that allows using the LLCC68
LoRa shield on Arduino UNO compatible boards (with Arduino IO mappings
provided by the board) by just selecting the module.
  • Loading branch information
maribu committed Oct 1, 2024
1 parent 182c103 commit 678ef7c
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 25 deletions.
7 changes: 7 additions & 0 deletions drivers/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ ifneq (,$(filter servo_%,$(USEMODULE)))
USEMODULE += servo
endif

ifneq (,$(filter shield_llcc68,$(USEMODULE)))
FEATURES_REQUIRED += arduino_pins
FEATURES_REQUIRED += arduino_shield_uno
FEATURES_REQUIRED += arduino_spi
USEMODULE += llcc68
endif

ifneq (,$(filter shield_w5100,$(USEMODULE)))
FEATURES_REQUIRED += arduino_pins
FEATURES_REQUIRED += arduino_shield_isp
Expand Down
28 changes: 28 additions & 0 deletions drivers/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,31 @@
* 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.
*/

/**
* @defgroup drivers_shield_llcc68 LLCC68 Arduino LoRa Shield
* @ingroup drivers_shield
* @brief LLCC68 Arduino LoRa Shield
*
* # Overview
*
* @image html https://www.semtech.com/uploads/products/product/LLCC68MB2BAS_image2_horiz_300x300px.jpg "Photo of the LLCC68 Shield" width=50%
*
* | Key | Value |
* |:---------------------- |:--------------------------------------------------------------------- |
* | Abstract | LoRa Transceiver |
* | Product Name | LLCC68MB2CAS0 |
* | Vendor | Semtech |
* | Vendor Doc | [Product Homepage][shield_llcc68_hp] |
* | Attachment Standard | Arduino UNO Shield (Side SPI used, no ISP-SPI required) |
*
* [shield_llcc68_hp]: http://web.archive.org/web/20240528223141/https://www.semtech.com/products/wireless-rf/lora-connect/llcc68mb2cas
*
* # Usage
*
* Use the `shield_llcc68` module, e.g. using
*
* ```
* USEMODULE=shield_llcc68 make BOARD=arduino-zero -C examples/lorawan
* ```
*/
62 changes: 37 additions & 25 deletions drivers/sx126x/include/sx126x_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,70 +23,82 @@
#include "sx126x.h"
#include "sx126x_driver.h"

#ifdef MODULE_SHIELD_LC68
# include "arduino_iomap.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifdef MODULE_SHIELD_LLCC68
# define SX126X_PARAM_SPI ARDUINO_SPI_D11D12D13
# define SX126X_PARAM_SPI_NSS ARDUINO_PIN_7
# define SX126X_PARAM_RESET ARDUINO_PIN_A0
# define SX126X_PARAM_BUSY ARDUINO_PIN_3
# define SX126X_PARAM_DIO1 ARDUINO_PIN_5
#endif

/**
* @name Set default configuration parameters
*
* Default values are adapted for mbed shield used with to nucleo64 boards
* @{
*/
#ifndef SX126X_PARAM_SPI
#define SX126X_PARAM_SPI SPI_DEV(0)
# define SX126X_PARAM_SPI SPI_DEV(0)
#endif

#ifndef SX126X_PARAM_SPI_NSS
#define SX126X_PARAM_SPI_NSS GPIO_PIN(0, 8) /* D7 */
# define SX126X_PARAM_SPI_NSS GPIO_PIN(0, 8) /* D7 */
#endif

#ifndef SX126X_PARAM_RESET
#define SX126X_PARAM_RESET GPIO_PIN(0, 0) /* A0 */
# define SX126X_PARAM_RESET GPIO_PIN(0, 0) /* A0 */
#endif

#ifndef SX126X_PARAM_BUSY
#define SX126X_PARAM_BUSY GPIO_PIN(1, 3) /* D3 */
# define SX126X_PARAM_BUSY GPIO_PIN(1, 3) /* D3 */
#endif

#ifndef SX126X_PARAM_DIO1
#define SX126X_PARAM_DIO1 GPIO_PIN(1, 4) /* D5 */
# define SX126X_PARAM_DIO1 GPIO_PIN(1, 4) /* D5 */
#endif

#ifndef SX126X_PARAM_REGULATOR
#define SX126X_PARAM_REGULATOR SX126X_REG_MODE_DCDC
# define SX126X_PARAM_REGULATOR SX126X_REG_MODE_DCDC
#endif

#ifndef SX126X_PARAM_SET_RF_MODE_CB
#define SX126X_PARAM_SET_RF_MODE_CB NULL
# define SX126X_PARAM_SET_RF_MODE_CB NULL
#endif

#ifndef SX126X_PARAM_TX_PA_MODE
#define SX126X_PARAM_TX_PA_MODE SX126X_RF_MODE_TX_LPA
# define SX126X_PARAM_TX_PA_MODE SX126X_RF_MODE_TX_LPA
#endif

#ifndef SX126X_PARAM_TYPE
# if IS_USED(MODULE_SX1261)
# define SX126X_PARAM_TYPE SX126X_TYPE_SX1261
# elif IS_USED(MODULE_SX1262)
# define SX126X_PARAM_TYPE SX126X_TYPE_SX1262
# elif IS_USED(MODULE_SX1268)
# define SX126X_PARAM_TYPE SX126X_TYPE_SX1268
# elif IS_USED(MODULE_LLCC68)
# define SX126X_PARAM_TYPE SX126X_TYPE_LLCC68
# elif IS_USED(MODULE_SX126X_STM32WL)
# define SX126X_PARAM_TYPE SX126X_TYPE_STM32WL
# else
# error "You should select at least one of the SX126x variants."
# endif
# if IS_USED(MODULE_SX1261)
# define SX126X_PARAM_TYPE SX126X_TYPE_SX1261
# elif IS_USED(MODULE_SX1262)
# define SX126X_PARAM_TYPE SX126X_TYPE_SX1262
# elif IS_USED(MODULE_SX1268)
# define SX126X_PARAM_TYPE SX126X_TYPE_SX1268
# elif IS_USED(MODULE_LLCC68)
# define SX126X_PARAM_TYPE SX126X_TYPE_LLCC68
# elif IS_USED(MODULE_SX126X_STM32WL)
# define SX126X_PARAM_TYPE SX126X_TYPE_STM32WL
# else
# error "You should select at least one of the SX126x variants."
# endif
#endif

#if IS_USED(MODULE_SX126X_RF_SWITCH)
#define SX126X_SET_RF_MODE .set_rf_mode = SX126X_PARAM_SET_RF_MODE_CB,
#define SX126X_TX_PA_MODE .tx_pa_mode = SX126X_PARAM_TX_PA_MODE
# define SX126X_SET_RF_MODE .set_rf_mode = SX126X_PARAM_SET_RF_MODE_CB,
# define SX126X_TX_PA_MODE .tx_pa_mode = SX126X_PARAM_TX_PA_MODE
#else
#define SX126X_SET_RF_MODE
#define SX126X_TX_PA_MODE
# define SX126X_SET_RF_MODE
# define SX126X_TX_PA_MODE
#endif

#define SX126X_PARAMS { .spi = SX126X_PARAM_SPI, \
Expand Down
1 change: 1 addition & 0 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ PSEUDOMODULES += shell_cmd_vfs
PSEUDOMODULES += shell_cmds_default
PSEUDOMODULES += shell_hooks
PSEUDOMODULES += shell_lock_auto_locking
PSEUDOMODULES += shield_llcc68
PSEUDOMODULES += shield_w5100
PSEUDOMODULES += slipdev_stdio
PSEUDOMODULES += slipdev_l2addr
Expand Down

0 comments on commit 678ef7c

Please sign in to comment.