[STM32WL] Renamed basic examples to _Blocking

This commit is contained in:
jgromes 2023-06-24 22:03:28 +02:00
parent 06529844c3
commit 9bad00ed39
3 changed files with 62 additions and 53 deletions

View file

@ -1,27 +1,32 @@
/*
RadioLib STM32WLx Receive Example
RadioLib STM32WLx Blocking Receive Example
This example listens for LoRa transmissions using STM32WL MCU with
integrated (SX126x) LoRa radio.
This example listens for LoRa transmissions using STM32WL MCU with
integrated (SX126x) LoRa radio.
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bandwidth
- spreading factor
- coding rate
- sync word
- preamble length
To successfully receive data, the following settings have to be the same
on both transmitter and receiver:
- carrier frequency
- bandwidth
- spreading factor
- coding rate
- sync word
- preamble length
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
or standalone STM32WL, some configuration such as TCXO voltage and
RF switch control may have to be adjusted.
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
or standalone STM32WL, some configuration such as TCXO voltage and
RF switch control may have to be adjusted.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
Using blocking receive is not recommended, as it will lead
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
https://jgromes.github.io/RadioLib/
For default module settings, see the wiki page
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
@ -75,9 +80,6 @@ void loop() {
Serial.print(F("[STM32WL] Waiting for incoming transmission ... "));
// 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;
int state = radio.receive(str);

View file

@ -1,23 +1,27 @@
/*
RadioLib STM32WLx Transmit Example
RadioLib STM32WLx Blocking Transmit Example
This example transmits packets using STM32WL MCU with integrated
(SX126x) LoRa radio.
This example transmits packets using STM32WL MCU with integrated
(SX126x) LoRa radio.
Each packet contains up to 256 bytes of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
or standalone STM32WL, some configuration such as TCXO voltage and
RF switch control may have to be adjusted.
Each packet contains up to 256 bytes of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
This example assumes Nucleo WL55JC1 is used. For other Nucleo boards
or standalone STM32WL, some configuration such as TCXO voltage and
RF switch control may have to be adjusted.
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
Using blocking transmit is not recommended, as it will lead
to inefficient use of processor time!
Instead, interrupt transmit is recommended.
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For default module settings, see the wiki page
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
@ -67,15 +71,15 @@ void setup() {
}
}
// counter to keep track of transmitted packets
int count = 0;
void loop() {
Serial.print(F("[STM32WL] Transmitting packet ... "));
// you can transmit C-string or Arduino string up to
// 256 characters long
// NOTE: transmit() is a blocking method!
// See example STM32WLx_Transmit_Interrupt for details
// on non-blocking transmission method.
int state = radio.transmit("Hello World!");
int state = radio.transmit("Hello World! #" + String(count++));
// you can also transmit byte array up to 256 bytes long
/*

View file

@ -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
between them. Each packet contains up to 256 bytes
of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
This example transmits LoRa packets with one second delays
between them. Each packet contains up to 256 bytes
of data, in the form of:
- Arduino String
- null-terminated char array (C-string)
- arbitrary binary data (byte array)
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#sx126x---lora-modem
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/
*/
// include the library
@ -95,6 +95,9 @@ void setFlag(void) {
transmittedFlag = true;
}
// counter to keep track of transmitted packets
int count = 0;
void loop() {
// check if the previous transmission finished
if(transmittedFlag) {
@ -128,13 +131,13 @@ void loop() {
// you can transmit C-string or Arduino string up to
// 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
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
int state = radio.startTransmit(byteArr, 8);
transmissionState = radio.startTransmit(byteArr, 8);
*/
}
}