LowPowerLab Forum

Hardware support => Low Power Techniques => Topic started by: Neko on April 05, 2017, 05:02:58 PM

Title: Trying out ListenMode
Post by: Neko on April 05, 2017, 05:02:58 PM
Alas, I get the following errors when I #include<listen.h).
Arduino 1.6.4 on OSX.
ListenMode branch of RFM69 library.

In file included from /Users/neko/Documents/Arduino/libraries/listen/listen.cpp:1:0:
/Users/neko/Documents/Arduino/libraries/RFM69-ListenMode/RFM69.h: In function 'void irq()':
/Users/neko/Documents/Arduino/libraries/RFM69-ListenMode/RFM69.h:167:18: error: 'virtual void RFM69::select()' is protected
     virtual void select();
                  ^
/Users/neko/Documents/Arduino/libraries/listen/listen.cpp:40:20: error: within this context
     pRadio->select();
                    ^


Lots of similar errors for unselect() and setMode() as well.

Code: [Select]
#include <RFM69.h>
#include <SPI.h>
#include <LowPower.h>
#include <listen.h>

// Uncomment the appropriate frequency for your hardware
//#define FREQUENCY     RF69_433MHZ
//#define FREQUENCY     RF69_868MHZ
#define FREQUENCY     RF69_915MHZ
//#define IS_RFM69HW    //uncomment only for RFM69HW! Leave out if you have RFM69W!

#define ENCRYPT_KEY "sampleEncryptKey"
#define ADDRESS 2
#define NETWORK_ID 100
Title: Re: Trying out ListenMode
Post by: Felix on April 06, 2017, 04:25:07 PM
Here is the branch of listen mode (https://github.com/LowPowerLab/RFM69/tree/ListenMode), this needs to completely replace RFM69 if you had that installed (ie not side by side, only this one in your arduino/libraries).

Then load these examples:
https://github.com/LowPowerLab/RFM69/tree/ListenMode/Examples/ListenMode_Master
https://github.com/LowPowerLab/RFM69/tree/ListenMode/Examples/ListenMode_Node
Title: Re: Trying out ListenMode
Post by: Neko on April 06, 2017, 05:43:24 PM
The ListenMode branch is installed, replacing RFM69 as you suggest. The ListenMode_Master and ListenMode_Node examples work well together.

The trouble arises when I try to add the listen.h and listen.cpp, which has the nice timed delay function in it. I don't know how to add them without creating these conflicts.

Listen.h and Listen.cpp are from joelucid in reply 13 of this thread (https://lowpowerlab.com/forum/low-power-techniques/using-listenmode-as-wakeup-timer/).

Is there a way to make a delay using the ListenMode branch alone?
Title: Re: Trying out ListenMode
Post by: Felix on April 06, 2017, 10:00:06 PM
joe's version might require the MAIN RFM69 branch but this was posted in september 2015 so since then the library has had some changes, though I don't really expect breaking changes, if the assumption that the RFM69 lib was used is valid. So try his sketch with the MAIN RFM69 branch.
Title: Re: Trying out ListenMode
Post by: Neko on April 07, 2017, 12:50:39 PM
Thanks Felix

I got it working by adapting the relevant bits (delay, delayIrq and endlistener) from joelucid's library and putting them directly into the ListenMode branch of the RFM69 library.

Can I put C++ on my resume now...
Title: Re: Trying out ListenMode
Post by: Felix on April 07, 2017, 12:57:52 PM
Very cool, you sure can !!