SX126x-Arduino  2.0.1
sx126x-board.h
Go to the documentation of this file.
1 /*
2  ______ _
3  / _____) _ | |
4 ( (____ _____ ____ _| |_ _____ ____| |__
5  \____ \| ___ | (_ _) ___ |/ ___) _ \
6  _____) ) ____| | | || |_| ____( (___| | | |
7 (______/|_____)_|_|_| \__)_____)\____)_| |_|
8  (C)2013 Semtech
9 
10 Description: SX126x driver specific target board functions implementation
11 
12 License: Revised BSD License, see LICENSE.TXT file include in the project
13 
14 Maintainer: Miguel Luis and Gregory Cristian
15 */
16 
17 /******************************************************************************
18  * @file sx126x-board.h
19  * @author Insight SiP
20  * @version V2.0.0
21  * @date 30-january-2019
22  * @brief SX126x header compatible with LoraWan/semtech drivers.
23  *
24  * @attention
25  * THIS SOFTWARE IS PROVIDED BY INSIGHT SIP "AS IS" AND ANY EXPRESS
26  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27  * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
28  * DISCLAIMED. IN NO EVENT SHALL INSIGHT SIP OR CONTRIBUTORS BE
29  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
34  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35  *
36  *****************************************************************************/
37 
38 #ifndef __SX126x_ARCH_H__
39 #define __SX126x_ARCH_H__
40 
41 #include <Arduino.h>
42 #include "sx126x-debug.h"
43 
44 extern "C"
45 {
48  void SX126xIoInit(void);
49 
52  void SX126xIoReInit(void);
53 
58  void SX126xIoIrqInit(DioIrqHandler dioIrq);
59 
64  void SX126xIoDeInit(void);
65 
68  void SX126xReset(void);
69 
72  void SX126xWaitOnBusy(void);
73 
76  void SX126xWakeup(void);
77 
84  void SX126xWriteCommand(RadioCommands_t opcode, uint8_t *buffer, uint16_t size);
85 
92  void SX126xReadCommand(RadioCommands_t opcode, uint8_t *buffer, uint16_t size);
93 
99  void SX126xWriteRegister(uint16_t address, uint8_t value);
100 
107  uint8_t SX126xReadRegister(uint16_t address);
108 
113  void SX126xSetRfTxPower(int8_t power);
114 
120  uint8_t SX126xGetPaSelect(uint32_t channel);
121 
124  void SX126xAntSwOn(void);
125 
130  void SX126xAntSwOff(void);
131 
136  void SX126xRXena(void);
137 
142  void SX126xTXena(void);
143 
149  bool SX126xCheckRfFrequency(uint32_t frequency);
150 
157  void SX126xGetStats(uint16_t *nb_pkt_received, uint16_t *nb_pkt_crc_error, uint16_t *nb_pkt_length_error);
158 
161  void SX126xResetStats(void);
162 
165  extern SX126x_t SX126x;
166 };
167 #endif // __SX126x_ARCH_H__
SX126xWriteCommand
void SX126xWriteCommand(RadioCommands_t opcode, uint8_t *buffer, uint16_t size)
Send a command that write data to the radio.
Definition: sx126x-board.cpp:173
SX126xIoDeInit
void SX126xIoDeInit(void)
De-initializes the radio I/Os pins interface.
Definition: sx126x-board.cpp:118
SX126xIoReInit
void SX126xIoReInit(void)
Initializes the radio I/Os pins interface after deep sleep wake.
Definition: sx126x-board.cpp:83
SX126xTXena
void SX126xTXena(void)
Set the RF antenna switch to transmitting mode.
Definition: sx126x-board.cpp:537
SX126xGetPaSelect
uint8_t SX126xGetPaSelect(uint32_t channel)
Gets the board PA selection configuration.
Definition: sx126x-board.cpp:315
SX126xRXena
void SX126xRXena(void)
Set the RF antenna switch to receiving mode.
Definition: sx126x-board.cpp:525
RadioCommands_t
enum RadioCommands_e RadioCommands_t
Represents all possible opcode understood by the radio.
SX126xIoIrqInit
void SX126xIoIrqInit(DioIrqHandler dioIrq)
Initializes DIO IRQ handlers.
Definition: sx126x-board.cpp:113
SX126x
SX126x_t SX126x
Radio hardware and global parameters.
Definition: radio.cpp:515
SX126xGetStats
void SX126xGetStats(uint16_t *nb_pkt_received, uint16_t *nb_pkt_crc_error, uint16_t *nb_pkt_length_error)
Gets info on the number of packets received.
Definition: sx126x-board.cpp:555
SX126xIoInit
void SX126xIoInit(void)
Initializes the radio I/Os pins interface.
Definition: sx126x-board.cpp:51
DioIrqHandler
void() DioIrqHandler(void)
Definition: sx126x.h:668
SX126xAntSwOff
void SX126xAntSwOff(void)
De-initializes the RF Switch I/Os pins interface.
Definition: sx126x-board.cpp:511
SX126xReadRegister
uint8_t SX126xReadRegister(uint16_t address)
Read a single byte of data from the radio memory.
Definition: sx126x-board.cpp:264
SX126xSetRfTxPower
void SX126xSetRfTxPower(int8_t power)
Sets the radio output power.
Definition: sx126x-board.cpp:310
sx126x-debug.h
Unified debug output for all platforms Set LIB_DEBUG to 1 to enable debug output.
SX126xWaitOnBusy
void SX126xWaitOnBusy(void)
Blocking loop to wait while the Busy pin in high.
Definition: sx126x-board.cpp:138
SX126xReadCommand
void SX126xReadCommand(RadioCommands_t opcode, uint8_t *buffer, uint16_t size)
Send a command that read data from the radio.
Definition: sx126x-board.cpp:196
SX126xWriteRegister
void SX126xWriteRegister(uint16_t address, uint8_t value)
Write a single byte of data to the radio memory.
Definition: sx126x-board.cpp:238
SX126xAntSwOn
void SX126xAntSwOn(void)
Initializes the RF Switch I/Os pins interface.
Definition: sx126x-board.cpp:496
SX126xCheckRfFrequency
bool SX126xCheckRfFrequency(uint32_t frequency)
Checks if the given RF frequency is supported by the hardware.
Definition: sx126x-board.cpp:549
SX126xResetStats
void SX126xResetStats(void)
Resets values read by GetStats.
Definition: sx126x-board.cpp:566
SX126xWakeup
void SX126xWakeup(void)
Wakes up the radio.
Definition: sx126x-board.cpp:154
SX126x_s
Definition: sx126x.h:653
SX126xReset
void SX126xReset(void)
HW Reset of the radio.
Definition: sx126x-board.cpp:128