Loading...
Searching...
No Matches
sx126x_params.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef SX126X_PARAMS_H
20#define SX126X_PARAMS_H
21
22#include "board.h"
23#include "sx126x.h"
24#include "sx126x_driver.h"
25
26#ifdef MODULE_SHIELD_LC68
27# include "arduino_iomap.h"
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#ifdef MODULE_SHIELD_LLCC68
35# define SX126X_PARAM_SPI ARDUINO_SPI_D11D12D13
36# define SX126X_PARAM_SPI_NSS ARDUINO_PIN_7
37# define SX126X_PARAM_RESET ARDUINO_PIN_A0
38# define SX126X_PARAM_BUSY ARDUINO_PIN_3
39# define SX126X_PARAM_DIO1 ARDUINO_PIN_5
40#endif
41
48#ifndef SX126X_PARAM_SPI
49# define SX126X_PARAM_SPI SPI_DEV(0)
50#endif
51
52#ifndef SX126X_PARAM_SPI_NSS
53# define SX126X_PARAM_SPI_NSS GPIO_PIN(0, 8) /* D7 */
54#endif
55
56#ifndef SX126X_PARAM_RESET
57# define SX126X_PARAM_RESET GPIO_PIN(0, 0) /* A0 */
58#endif
59
60#ifndef SX126X_PARAM_BUSY
61# define SX126X_PARAM_BUSY GPIO_PIN(1, 3) /* D3 */
62#endif
63
64#ifndef SX126X_PARAM_DIO1
65# define SX126X_PARAM_DIO1 GPIO_PIN(1, 4) /* D5 */
66#endif
67
68#ifndef SX126X_PARAM_REGULATOR
69# define SX126X_PARAM_REGULATOR SX126X_REG_MODE_DCDC
70#endif
71
72#ifndef SX126X_PARAM_SET_RF_MODE_CB
73# define SX126X_PARAM_SET_RF_MODE_CB NULL
74#endif
75
76#ifndef SX126X_PARAM_TX_PA_MODE
77# define SX126X_PARAM_TX_PA_MODE SX126X_RF_MODE_TX_LPA
78#endif
79
80#ifndef SX126X_PARAM_TYPE
81# if IS_USED(MODULE_SX1261)
82# define SX126X_PARAM_TYPE SX126X_TYPE_SX1261
83# elif IS_USED(MODULE_SX1262)
84# define SX126X_PARAM_TYPE SX126X_TYPE_SX1262
85# elif IS_USED(MODULE_SX1268)
86# define SX126X_PARAM_TYPE SX126X_TYPE_SX1268
87# elif IS_USED(MODULE_LLCC68)
88# define SX126X_PARAM_TYPE SX126X_TYPE_LLCC68
89# elif IS_USED(MODULE_SX126X_STM32WL)
90# define SX126X_PARAM_TYPE SX126X_TYPE_STM32WL
91# else
92# error "You should select at least one of the SX126x variants."
93# endif
94#endif
95
96#if IS_USED(MODULE_SX126X_RF_SWITCH)
97# define SX126X_SET_RF_MODE .set_rf_mode = SX126X_PARAM_SET_RF_MODE_CB,
98# define SX126X_TX_PA_MODE .tx_pa_mode = SX126X_PARAM_TX_PA_MODE
99#else
100# define SX126X_SET_RF_MODE
101# define SX126X_TX_PA_MODE
102#endif
103
104#ifndef SX126X_PARAMS
105# define SX126X_PARAMS { .spi = SX126X_PARAM_SPI, \
106 .nss_pin = SX126X_PARAM_SPI_NSS, \
107 .reset_pin = SX126X_PARAM_RESET, \
108 .busy_pin = SX126X_PARAM_BUSY, \
109 .dio1_pin = SX126X_PARAM_DIO1, \
110 .type = SX126X_PARAM_TYPE, \
111 .regulator = SX126X_PARAM_REGULATOR, \
112 SX126X_SET_RF_MODE \
113 SX126X_TX_PA_MODE}
114#endif
115
122{
123 SX126X_PARAMS
124};
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* SX126X_PARAMS_H */
Device initialization parameters.
Definition sx126x.h:85
static const sx126x_params_t sx126x_params[]
Configuration struct.