Skip to content

Commit 50b7a1e

Browse files
committed
DRAFT LORA
1 parent f3aeb43 commit 50b7a1e

File tree

9 files changed

+868
-5
lines changed

9 files changed

+868
-5
lines changed

examples/examples-communication/esp-now/pcm/communication-espnow-receive/communication-espnow-receive.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file example-serial-receive.ino
2+
* @file example-espnow-receive.ino
33
* @author Phil Schatzmann
44
* @brief Receiving audio via ESPNow
55
* @version 0.1

examples/examples-communication/esp-now/pcm/communication-espnow-receive_csv/communication-espnow-receive_csv.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file example-serial-receive_csv.ino
2+
* @file example-espnow-receive_csv.ino
33
* @author Phil Schatzmann
44
* @brief Receiving audio via ESPNow
55
* @version 0.1

examples/examples-communication/esp-now/pcm/communication-espnow-receive_measure/communication-espnow-receive_measure.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file example-serial-receive_measure.ino
2+
* @file example-espnow-receive_measure.ino
33
* @author Phil Schatzmann
44
* @brief Receiving audio via ESPNow with max speed to measure thruput
55
* @version 0.1

examples/examples-communication/esp-now/pcm/communication-espnow-send/communication-espnow-send.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @file example-serial-send.ino
2+
* @file example-espnow-send.ino
33
* @author Phil Schatzmann
44
* @brief Sending audio over ESPNow
55
* @version 0.1
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* @file example-lora-receive_measure.ino
3+
* @author Phil Schatzmann
4+
* @brief Receiving audio via LoRa with max speed to measure thruput.
5+
* @version 0.1
6+
* @date 2023-11-09
7+
*
8+
* @copyright Copyright (c) 2022
9+
*
10+
*/
11+
12+
#include "AudioTools.h"
13+
#include "AudioTools/Communication/LoRaStream.h"
14+
15+
LoRaStream lora;
16+
MeasuringStream out; // or CSVStream<uint8_t>
17+
StreamCopy copier(out, lora);
18+
19+
void setup() {
20+
Serial.begin(115200);
21+
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
22+
while(!Serial);
23+
24+
auto cfg = lora.defaultConfig();
25+
lora.begin(cfg);
26+
27+
// start output
28+
Serial.println("starting Out...");
29+
out.begin();
30+
31+
Serial.println("Receiver started...");
32+
}
33+
34+
void loop() {
35+
copier.copy();
36+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* @file example-lora-send.ino
3+
* @author Phil Schatzmann
4+
* @brief Sending data over LoRa. We use a Heltec WiFi LoRa V3 board for testing.
5+
* V3 boards use the SX1262.
6+
* @version 0.1
7+
* @date 2023-11-09
8+
*
9+
* @copyright Copyright (c) 2022
10+
*/
11+
12+
#include "AudioTools.h"
13+
#include "AudioTools/Communication/LoRaStream.h"
14+
15+
AudioInfo info(8000, 1, 16);
16+
SineWaveGenerator<int16_t> sineWave( 32000); // subclass of SoundGenerator with max amplitude of 32000
17+
GeneratedSoundStream<int16_t> sound( sineWave); // Stream generated from sine wave
18+
LoRaStream lora;
19+
StreamCopy copier(lora, sound); // copies sound into i2s
20+
21+
void setup() {
22+
Serial.begin(115200);
23+
AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Info);
24+
while(!Serial);
25+
Serial.println("starting...");
26+
27+
// Setup LoRa
28+
Serial.printf("SCK: %d, MISO: %d, MOSI: %d, SS=%d", SCK,MISO,MOSI,SS);
29+
SPI.begin(SCK, MISO, MOSI, SS);
30+
auto cfg = lora.defaultConfig();
31+
cfg.copyFrom(info);
32+
if (!lora.begin(cfg)){
33+
Serial.println("LoRa failed");
34+
stop();
35+
}
36+
37+
// Setup sine wave
38+
sineWave.begin(info, N_B4);
39+
40+
Serial.println("Sender started...");
41+
}
42+
43+
void loop() {
44+
copier.copy();
45+
}

src/AudioTools/Communication/RadioHeadStream.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace audio_tools {
66

7-
87
/**
98
* @brief Arduino Stream which is using the RadioHead library to send and
109
* receive data. We use the river API directly.

0 commit comments

Comments
 (0)