Skip to content

Commit

Permalink
into the library manager
Browse files Browse the repository at this point in the history
* Added examples
* Changed metadata for arduino library manager
  • Loading branch information
ropg committed Feb 13, 2024
1 parent 74d8912 commit 981b4ed
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 4 deletions.
15 changes: 15 additions & 0 deletions examples/minimal_demo/minimal_demo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
This will allow you to accs the Command Line Interpreter from the Serial
Monitor, letteing you set up a radio and receive and transmit packets.
*/

#include <OOKwiz.h>

void setup() {
Serial.begin(115200);
OOKwiz::setup();
}

void loop() {
OOKwiz::loop();
}
33 changes: 33 additions & 0 deletions examples/receiving_packet/receiving_packet.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Prints payload of a very specific type of packet, ignores all else.
See README under "Meaning"
*/

#include <OOKwiz.h>

void setup() {
Serial.begin(115200);
OOKwiz::setup();
OOKwiz::onReceive(receive);
}

void loop() {
OOKwiz::loop();
}

void receive(RawTimings raw, Pulsetrain train, Meaning meaning) {
if (
meaning.elements.size() != 2 ||
meaning.elements[0].type != PULSE ||
!tools::between(meaning.elements[0].time1, 5800, 6000) ||
meaning.elements[1].type != PWM ||
!tools::between(meaning.elements[1].time1, 175, 205) ||
!tools::between(meaning.elements[1].time2, 560, 590) ||
meaning.elements[1].data_len != 24
) {
return;
}
// .data() on an std::vector gives a pointer to the first element
uint8_t *data = meaning.elements[1].data.data();
Serial.printf("Data received 0:%02X 1:%02X 2:%02X", data[0], data[1], data[2]);
}
23 changes: 23 additions & 0 deletions examples/transmitting_packet/transmitting_packet.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Tranmits a specific type of packet. See README under "Meaning"
*/

#include <OOKwiz.h>

void setup() {
Serial.begin(115200);
if (OOKwiz::setup()) {
Meaning newPacket;
newPacket.addPulse(5900);
uint8_t data[3] = {0x17, 0x72, 0xA4};
// 190 and 575 are space and mark timings, 24 is data length in bits
newPacket.addPWM(190, 575, 24, data);
newPacket.repeats = 6;
newPacket.gap = 130;
OOKwiz::transmit(newPacket);
}
}

void loop() {
OOKwiz::loop();
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "Rop Gonggrijp",
"url": ""
},
"version": "0.1.3",
"version": "0.1.4",
"frameworks": "arduino",
"platforms": "espressif32",
"headers": "OOKwiz.h"
Expand Down
5 changes: 3 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name=OOKwiz
version=0.1.3
version=0.1.4
author=Rop Gonggrijp
maintainer=Rop Gonggrijp
url=https://github.com/ropg/OOKwiz
sentence=Receiving/analysing/sending on-off-keying signals for radio remote controls 📱, weather stations 🌦️ and more.
paragraph=OOKwiz is an ESP32 Arduino library for receiving, analysing, decoding, encoding and transmitting On/Off keyed signals using a number of radios via RadioLib as well as a generic type. Radio plugins easy to build. Not just a library, also a versatile rx/tx OOK Swiss army knife. Used in a sketch that only calls the library's `setup()` and `loop()` functions, it prints output like below for received signals and provides a command line interpreter to set radio type, GPIO-pins used, etc. Settings are stored in flash on the ESP32 using SPIFFS. OOKwiz tries to read the data from messages, example: `pulse(5906) + pwm(timing 190/575, 24 bits 0x1772A4)` (all time in µs). That same format is among those accepted by the CLI `transmit` function, so on-the-fly experimentation is super-easy: just copy the string, change a few bits and transmit it back out.
category=radio
category=Signal Input/Output
architectures=esp32
includes=OOKwiz.h
depends=RadioLib
2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define ARDUINO_LOOP_TASK_STACK_SIZE (16 * 1024)
#define SERIAL_RX_BUFFER_SIZE 1024

#define OOKWIZ_VERSION "0.1.3"
#define OOKWIZ_VERSION "0.1.4"
#define SPIFFS_PREFIX /OOKwiz

#define MAX_BINS 10
Expand Down

0 comments on commit 981b4ed

Please sign in to comment.