1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-28 23:49:47 +01:00

drivers: Add shield_llcc68 module

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.
This commit is contained in:
Marian Buschsieweke 2024-10-01 18:35:05 +02:00
parent 7bc7b732d5
commit 8c2f6ae9dc
No known key found for this signature in database
GPG Key ID: 758BD52517F79C41
4 changed files with 73 additions and 25 deletions

View File

@ -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

View File

@ -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
* ```
*/

View File

@ -23,10 +23,22 @@
#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
*
@ -34,59 +46,59 @@ extern "C" {
* @{
*/
#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, \

View File

@ -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