[STM32WL] Renamed basic examples to _Blocking
This commit is contained in:
parent
06529844c3
commit
9bad00ed39
3 changed files with 62 additions and 53 deletions
examples/STM32WLx
STM32WLx_Receive_Blocking
STM32WLx_Transmit_Blocking
STM32WLx_Transmit_Interrupt
|
@ -1,27 +1,32 @@
|
||||||
/*
|
/*
|
||||||
RadioLib STM32WLx Receive Example
|
RadioLib STM32WLx Blocking Receive Example
|
||||||
|
|
||||||
This example listens for LoRa transmissions using STM32WL MCU with
|
This example listens for LoRa transmissions using STM32WL MCU with
|
||||||
integrated (SX126x) LoRa radio.
|
integrated (SX126x) LoRa radio.
|
||||||
|
|
||||||
To successfully receive data, the following settings have to be the same
|
To successfully receive data, the following settings have to be the same
|
||||||
on both transmitter and receiver:
|
on both transmitter and receiver:
|
||||||
- carrier frequency
|
- carrier frequency
|
||||||
- bandwidth
|
- bandwidth
|
||||||
- spreading factor
|
- spreading factor
|
||||||
- coding rate
|
- coding rate
|
||||||
- sync word
|
- sync word
|
||||||
- preamble length
|
- preamble length
|
||||||
|
|
||||||
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
|
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
|
||||||
or standalone STM32WL, some configuration such as TCXO voltage and
|
or standalone STM32WL, some configuration such as TCXO voltage and
|
||||||
RF switch control may have to be adjusted.
|
RF switch control may have to be adjusted.
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
Using blocking receive is not recommended, as it will lead
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
to significant amount of timeouts, inefficient use of processor
|
||||||
|
time and can some miss packets!
|
||||||
|
Instead, interrupt receive is recommended.
|
||||||
|
|
||||||
For full API reference, see the GitHub Pages
|
For default module settings, see the wiki page
|
||||||
https://jgromes.github.io/RadioLib/
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// include the library
|
// include the library
|
||||||
|
@ -75,9 +80,6 @@ void loop() {
|
||||||
Serial.print(F("[STM32WL] Waiting for incoming transmission ... "));
|
Serial.print(F("[STM32WL] Waiting for incoming transmission ... "));
|
||||||
|
|
||||||
// you can receive data as an Arduino String
|
// you can receive data as an Arduino String
|
||||||
// NOTE: receive() is a blocking method!
|
|
||||||
// See example ReceiveInterrupt for details
|
|
||||||
// on non-blocking reception method.
|
|
||||||
String str;
|
String str;
|
||||||
int state = radio.receive(str);
|
int state = radio.receive(str);
|
||||||
|
|
|
@ -1,23 +1,27 @@
|
||||||
/*
|
/*
|
||||||
RadioLib STM32WLx Transmit Example
|
RadioLib STM32WLx Blocking Transmit Example
|
||||||
|
|
||||||
This example transmits packets using STM32WL MCU with integrated
|
This example transmits packets using STM32WL MCU with integrated
|
||||||
(SX126x) LoRa radio.
|
(SX126x) LoRa radio.
|
||||||
|
|
||||||
Each packet contains up to 256 bytes of data, in the form of:
|
Each packet contains up to 256 bytes of data, in the form of:
|
||||||
- Arduino String
|
- Arduino String
|
||||||
- null-terminated char array (C-string)
|
- null-terminated char array (C-string)
|
||||||
- arbitrary binary data (byte array)
|
- arbitrary binary data (byte array)
|
||||||
|
|
||||||
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
|
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
|
||||||
or standalone STM32WL, some configuration such as TCXO voltage and
|
or standalone STM32WL, some configuration such as TCXO voltage and
|
||||||
RF switch control may have to be adjusted.
|
RF switch control may have to be adjusted.
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
Using blocking transmit is not recommended, as it will lead
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
to inefficient use of processor time!
|
||||||
|
Instead, interrupt transmit is recommended.
|
||||||
|
|
||||||
For full API reference, see the GitHub Pages
|
For default module settings, see the wiki page
|
||||||
https://jgromes.github.io/RadioLib/
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
||||||
|
|
||||||
|
For full API reference, see the GitHub Pages
|
||||||
|
https://jgromes.github.io/RadioLib/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// include the library
|
// include the library
|
||||||
|
@ -67,15 +71,15 @@ void setup() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// counter to keep track of transmitted packets
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
Serial.print(F("[STM32WL] Transmitting packet ... "));
|
Serial.print(F("[STM32WL] Transmitting packet ... "));
|
||||||
|
|
||||||
// you can transmit C-string or Arduino string up to
|
// you can transmit C-string or Arduino string up to
|
||||||
// 256 characters long
|
// 256 characters long
|
||||||
// NOTE: transmit() is a blocking method!
|
int state = radio.transmit("Hello World! #" + String(count++));
|
||||||
// See example STM32WLx_Transmit_Interrupt for details
|
|
||||||
// on non-blocking transmission method.
|
|
||||||
int state = radio.transmit("Hello World!");
|
|
||||||
|
|
||||||
// you can also transmit byte array up to 256 bytes long
|
// you can also transmit byte array up to 256 bytes long
|
||||||
/*
|
/*
|
|
@ -1,18 +1,18 @@
|
||||||
/*
|
/*
|
||||||
RadioLib STM32WLx Transmit with Interrupts Example
|
RadioLib STM32WLx Transmit with Interrupts Example
|
||||||
|
|
||||||
This example transmits LoRa packets with one second delays
|
This example transmits LoRa packets with one second delays
|
||||||
between them. Each packet contains up to 256 bytes
|
between them. Each packet contains up to 256 bytes
|
||||||
of data, in the form of:
|
of data, in the form of:
|
||||||
- Arduino String
|
- Arduino String
|
||||||
- null-terminated char array (C-string)
|
- null-terminated char array (C-string)
|
||||||
- arbitrary binary data (byte array)
|
- arbitrary binary data (byte array)
|
||||||
|
|
||||||
For default module settings, see the wiki page
|
For default module settings, see the wiki page
|
||||||
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
|
||||||
|
|
||||||
For full API reference, see the GitHub Pages
|
For full API reference, see the GitHub Pages
|
||||||
https://jgromes.github.io/RadioLib/
|
https://jgromes.github.io/RadioLib/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// include the library
|
// include the library
|
||||||
|
@ -95,6 +95,9 @@ void setFlag(void) {
|
||||||
transmittedFlag = true;
|
transmittedFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// counter to keep track of transmitted packets
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// check if the previous transmission finished
|
// check if the previous transmission finished
|
||||||
if(transmittedFlag) {
|
if(transmittedFlag) {
|
||||||
|
@ -128,13 +131,13 @@ void loop() {
|
||||||
|
|
||||||
// you can transmit C-string or Arduino string up to
|
// you can transmit C-string or Arduino string up to
|
||||||
// 256 characters long
|
// 256 characters long
|
||||||
transmissionState = radio.startTransmit("Hello World!");
|
transmissionState = radio.startTransmit("Hello World! #" + String(count++));
|
||||||
|
|
||||||
// you can also transmit byte array up to 256 bytes long
|
// you can also transmit byte array up to 256 bytes long
|
||||||
/*
|
/*
|
||||||
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
|
||||||
0x89, 0xAB, 0xCD, 0xEF};
|
0x89, 0xAB, 0xCD, 0xEF};
|
||||||
int state = radio.startTransmit(byteArr, 8);
|
transmissionState = radio.startTransmit(byteArr, 8);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue