RadioLib Universal wireless communication library for Arduino

STM32WLx.h
1 /*
2 Copyright (c) 2018 Jan Gromeš
3 Copyright (c) 2022 STMicroelectronics
4
5 This file is licensed under the MIT License: https://opensource.org/licenses/MIT
6 */
7
8 #if !defined(_RADIOLIB_STM32WLx_H)
9 #define _RADIOLIB_STM32WLx_H
10
11 #include "../../TypeDef.h"
12
13 #if !defined(RADIOLIB_EXCLUDE_STM32WLX)
14
15 #include "../../Module.h"
16 #include "SX1262.h"
17 #include "STM32WLx_Module.h"
18
33 class STM32WLx : public SX1262 {
34 // NOTE: This class could not be named STM32WL (or STM32WLxx), since
35 // those are macros defined by
36 // system/Drivers/CMSIS/Device/ST/STM32WLxxx/Include/stm32wlxx.h
37 public:
42 STM32WLx(STM32WLx_Module* mod);
43
51 enum OpMode_t {
53 MODE_END_OF_TABLE = Module::MODE_END_OF_TABLE,
55 MODE_IDLE = Module::MODE_IDLE,
57 MODE_RX = Module::MODE_RX,
59 MODE_TX_LP = Module::MODE_TX,
61 MODE_TX_HP,
62 };
63
64 // basic methods
65
69 int16_t begin(float freq = 434.0, float bw = 125.0, uint8_t sf = 9, uint8_t cr = 7, uint8_t syncWord = RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power = 10, uint16_t preambleLength = 8, float tcxoVoltage = 1.6, bool useRegulatorLDO = false);
70
74 int16_t beginFSK(float freq = 434.0, float br = 4.8, float freqDev = 5.0, float rxBw = 156.2, int8_t power = 10, uint16_t preambleLength = 16, float tcxoVoltage = 1.6, bool useRegulatorLDO = false);
75
76 // configuration methods
77
92 virtual int16_t setOutputPower(int8_t power) override;
93
109 // Note: This explicitly inherits this method only to override docs
110 using SX126x::setRfSwitchTable;
111
116 void setDio1Action(void (*func)(void));
117
121 void clearDio1Action();
122
127 void setPacketReceivedAction(void (*func)(void));
128
132 void clearPacketReceivedAction();
133
138 void setPacketSentAction(void (*func)(void));
139
143 void clearPacketSentAction();
144
149 void setChannelScanAction(void (*func)(void));
150
154 void clearChannelScanAction();
155
156 #if !defined(RADIOLIB_GODMODE)
157 protected:
158 #endif
159 virtual int16_t clearIrqStatus(uint16_t clearIrqParams) override;
160
161 #if !defined(RADIOLIB_GODMODE)
162 private:
163 #endif
164 };
165
166 #endif // !defined(RADIOLIB_EXCLUDE_SX126X)
167
168 #endif // _RADIOLIB_STM32WLX_MODULE_H
Module::MODE_TX
@ MODE_TX
Definition: Module.h:71
Module::MODE_IDLE
@ MODE_IDLE
Definition: Module.h:67
Module::MODE_RX
@ MODE_RX
Definition: Module.h:69
Module::MODE_END_OF_TABLE
@ MODE_END_OF_TABLE
Definition: Module.h:65
STM32WLx_Module
Definition: STM32WLx_Module.h:26
STM32WLx
Derived class for STM32WL modules.
Definition: STM32WLx.h:33
STM32WLx::begin
int16_t begin(float freq=434.0, float bw=125.0, uint8_t sf=9, uint8_t cr=7, uint8_t syncWord=RADIOLIB_SX126X_SYNC_WORD_PRIVATE, int8_t power=10, uint16_t preambleLength=8, float tcxoVoltage=1.6, bool useRegulatorLDO=false)
Initialization method for LoRa modem.
Definition: STM32WLx.cpp:13
STM32WLx::clearDio1Action
void clearDio1Action()
Clears interrupt service routine to call when DIO1/2/3 activates.
Definition: STM32WLx.cpp:125
STM32WLx::setDio1Action
void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1/2/3 activates.
Definition: STM32WLx.cpp:115
STM32WLx::setPacketSentAction
void setPacketSentAction(void(*func)(void))
Sets interrupt service routine to call when a packet is sent.
Definition: STM32WLx.cpp:137
STM32WLx::setPacketReceivedAction
void setPacketReceivedAction(void(*func)(void))
Sets interrupt service routine to call when a packet is received.
Definition: STM32WLx.cpp:129
STM32WLx::clearChannelScanAction
void clearChannelScanAction()
Clears interrupt service routine to call when a channel scan is finished.
Definition: STM32WLx.cpp:149
STM32WLx::setOutputPower
virtual int16_t setOutputPower(int8_t power) override
Sets output power. Allowed values are in range from -17 to 22 dBm.
Definition: STM32WLx.cpp:41
STM32WLx::clearPacketReceivedAction
void clearPacketReceivedAction()
Clears interrupt service routine to call when a packet is received.
Definition: STM32WLx.cpp:133
STM32WLx::STM32WLx
STM32WLx(STM32WLx_Module *mod)
Default constructor.
Definition: STM32WLx.cpp:11
STM32WLx::OpMode_t
OpMode_t
Custom operation modes for STMWLx.
Definition: STM32WLx.h:51
STM32WLx::MODE_END_OF_TABLE
@ MODE_END_OF_TABLE
Definition: STM32WLx.h:53
STM32WLx::MODE_TX_LP
@ MODE_TX_LP
Definition: STM32WLx.h:59
STM32WLx::MODE_TX_HP
@ MODE_TX_HP
Definition: STM32WLx.h:61
STM32WLx::MODE_RX
@ MODE_RX
Definition: STM32WLx.h:57
STM32WLx::MODE_IDLE
@ MODE_IDLE
Definition: STM32WLx.h:55
STM32WLx::setChannelScanAction
void setChannelScanAction(void(*func)(void))
Sets interrupt service routine to call when a channel scan is finished.
Definition: STM32WLx.cpp:145
STM32WLx::clearPacketSentAction
void clearPacketSentAction()
Clears interrupt service routine to call when a packet is sent.
Definition: STM32WLx.cpp:141
STM32WLx::beginFSK
int16_t beginFSK(float freq=434.0, float br=4.8, float freqDev=5.0, float rxBw=156.2, int8_t power=10, uint16_t preambleLength=16, float tcxoVoltage=1.6, bool useRegulatorLDO=false)
Initialization method for FSK modem.
Definition: STM32WLx.cpp:27
SX1262
Derived class for SX1262 modules.
Definition: SX1262.h:22
SX126x::setRfSwitchTable
void setRfSwitchTable(const uint32_t(&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[])
Some modules contain external RF switch controlled by pins. This function gives RadioLib control over...
Definition: SX126x.cpp:1463