RadioLib
Universal wireless communication library for Arduino
Loading...
Searching...
No Matches
STM32WLx.h
1/*
2Copyright (c) 2018 Jan Gromeš
3Copyright (c) 2022 STMicroelectronics
4
5This 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 !RADIOLIB_EXCLUDE_STM32WLX
14
15#include "../../Module.h"
16#include "SX1262.h"
17
18#if defined(ARDUINO_ARCH_STM32) && defined(STM32WLxx)
19#include "hal/Stm32duino/Stm32wlHal.h"
20#endif
21
36class STM32WLx : public SX1262 {
37 // NOTE: This class could not be named STM32WL (or STM32WLxx), since
38 // those are macros defined by
39 // system/Drivers/CMSIS/Device/ST/STM32WLxxx/Include/stm32wlxx.h
40 public:
45 STM32WLx(Module* mod); // cppcheck-suppress noExplicitConstructor
46
66
67 // basic methods
68
72 int16_t begin(const ConfigLoRa_t& config) override;
73
77 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) override;
78
82 int16_t beginFSK(const ConfigFSK_t& config) override;
83
87 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) override;
88
89 // configuration methods
90
105 int16_t setOutputPower(int8_t power) override;
106
113 int16_t checkOutputPower(int8_t power, int8_t* clipped) override;
114
130 // Note: This explicitly inherits this method only to override docs
132
133 #if defined(ARDUINO_ARCH_STM32)
138 void setDio1Action(void (*func)(void)) override;
139
143 void clearDio1Action() override;
144 #endif // ARDUINO_ARCH_STM32
145
150 void setPacketReceivedAction(void (*func)(void)) override;
151
155 void clearPacketReceivedAction() override;
156
161 void setPacketSentAction(void (*func)(void)) override;
162
166 void clearPacketSentAction() override;
167
172 void setChannelScanAction(void (*func)(void)) override;
173
177 void clearChannelScanAction() override;
178
179#if !RADIOLIB_GODMODE
180 protected:
181#endif
182 virtual int16_t clearIrqStatus(uint16_t clearIrqParams) override;
183
184#if !RADIOLIB_GODMODE
185 private:
186#endif
187};
188
189#endif
190
191#endif
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition Module.h:74
@ MODE_TX
Transmission mode.
Definition Module.h:120
@ MODE_IDLE
Idle mode.
Definition Module.h:114
@ MODE_RX
Receive mode.
Definition Module.h:117
@ MODE_END_OF_TABLE
End of table marker, use END_OF_MODE_TABLE constant instead. Value is zero to ensure zero-initialized...
Definition Module.h:111
Derived class for STM32WL modules.
Definition STM32WLx.h:36
void setChannelScanAction(void(*func)(void)) override
Sets interrupt service routine to call when a channel scan is finished.
Definition STM32WLx.cpp:221
void clearChannelScanAction() override
Clears interrupt service routine to call when a channel scan is finished.
Definition STM32WLx.cpp:225
void setPacketSentAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is sent.
Definition STM32WLx.cpp:213
int16_t setOutputPower(int8_t power) override
Sets output power. Allowed values are in range from -17 to 22 dBm.
Definition STM32WLx.cpp:77
int16_t checkOutputPower(int8_t power, int8_t *clipped) override
Check if output power is configurable.
Definition STM32WLx.cpp:140
void clearPacketReceivedAction() override
Clears interrupt service routine to call when a packet is received.
Definition STM32WLx.cpp:209
int16_t beginFSK(const ConfigFSK_t &config) override
Initialization method for FSK modem.
Definition STM32WLx.cpp:49
int16_t begin(const ConfigLoRa_t &config) override
Initialization method for LoRa modem.
Definition STM32WLx.cpp:21
void clearPacketSentAction() override
Clears interrupt service routine to call when a packet is sent.
Definition STM32WLx.cpp:217
OpMode_t
Custom operation modes for STMWLx.
Definition STM32WLx.h:54
@ MODE_END_OF_TABLE
Definition STM32WLx.h:56
@ MODE_TX_LP
Definition STM32WLx.h:62
@ MODE_TX_HP
Definition STM32WLx.h:64
@ MODE_RX
Definition STM32WLx.h:60
@ MODE_IDLE
Definition STM32WLx.h:58
void setPacketReceivedAction(void(*func)(void)) override
Sets interrupt service routine to call when a packet is received.
Definition STM32WLx.cpp:205
Derived class for SX1262 modules.
Definition SX1262.h:22
virtual void setDio1Action(void(*func)(void))
Sets interrupt service routine to call when DIO1 activates.
Definition SX126x_config.cpp:12
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_config.cpp:626
virtual void clearDio1Action()
Clears interrupt service routine to call when DIO1 activates.
Definition SX126x_config.cpp:16
bool useRegulatorLDO
Whether to use only LDO regulator (true) or DC-DC regulator (false). Defaults to false.
Definition SX126x.h:82
float tcxoVoltage
TCXO reference voltage to be set on DIO3. Defaults to 1.6 V. If you are seeing -706/-707 error codes,...
Definition SX126x.h:76
Definition PhysicalLayer.h:298
Definition PhysicalLayer.h:280