LowPowerLab Forum

Hardware support => Moteino => Topic started by: JonM on May 22, 2017, 02:13:12 PM

Title: Load LowPower library within Platformio
Post by: JonM on May 22, 2017, 02:13:12 PM
I was able to load the RFM69 library into the Platformio registry using:
$ platformio lib install "RFM69"
but I cannot determine how to load the LowPower library at https://github.com/LowPowerLab/LowPower

I keep getting this error during a build:
[Mon May 22 12:53:46 2017] Processing moteino (platform: atmelavr; lib_deps: RFM69, SPIFlash, LowPower; board: moteino; framework: arduino)
--------------------------------------------------------------------------------
Warning! Library `LowPower` has not been found in PlatformIO Registry.
You can ignore this message, if `LowPower` is a built-in library (included in framework, SDK). E.g., SPI, Wire, etc.
Verbose mode can be enabled via `-v, --verbose` option
Converting MotionShockTest_v5a.ino


I've read thru the various Library related docs on the Platformio at http://docs.platformio.org but I cannot figure this out.  Can someone point me in the right direction?
Title: Re: Load LowPower library within Platformio
Post by: TomWS on May 22, 2017, 02:33:25 PM
What does your project directory structure look like and can you post your platformio.ini for the project?

I 'usually' set up a lib folder with symlinks to all the library folders I have.  I used the term 'usually' as I've only been using platformio for a little while and I'm definitely a newbie with this tool.  However, I do use LowPower library and have a link to the LowPower folder that, I believe, is unchanged from the published library.

Tom

Title: Re: Load LowPower library within Platformio
Post by: JonM on May 22, 2017, 02:49:52 PM
Attached is a image of the directory structure.  And here is the platformio.ini file:


; PlatformIO Project Configuration File
[env:moteino]
platform = atmelavr
board = moteino
framework = arduino
lib_deps =
  RFM69
  SPIFlash
  LowPower

I may need to add SPI.h since I get errors
Title: Re: Load LowPower library within Platformio
Post by: JonM on May 22, 2017, 03:25:52 PM
I may have figured it out (though it was a shotgun approach).  I changed the platformio.ini file from this:
lib_deps =
  RFM69
  SPIFlash
  LowPower


To this:
lib_deps =
  RFM69
  SPIFlash
  SPI
  https://github.com/LowPowerLab/LowPower.git


It doesn't make much sense to me but I think it worked! 
Title: Re: Load LowPower library within Platformio
Post by: TomWS on May 22, 2017, 05:37:46 PM
I don't use lib_deps.  I use 'lib_ldf_mode = deep' and platformio figures out what libraries I need and, as I said, goes to my local lib directory to find the library directories (which, of course, are symlinks to the real library folders).

Since I think you're on a Windows system, I'm not sure how to set that up.  However, it seems to me that LowPower should be easy... 

My project directory structure is:


...
   project_name
          src
               project_sources (.c, .h .cpp .ino)
          lib
               RFM69 (link)
               SPIFlash (link)
               LowPower (link)
               etc
          platformio.ini
       
Title: Re: Load LowPower library within Platformio
Post by: JonM on May 22, 2017, 05:52:45 PM
I thought platformio was suppose to determine what I needed!  Thank you for that!  I'll read about 'lib_ldf_mode = deep'.  I am on a Mac (macOS Sierra).

In your "lib" folder, what is RFM69 symlinked to?  Does RFM69 symlink to ~/Documents/Arduino/libraries/RFM69?
Title: Re: Load LowPower library within Platformio
Post by: TomWS on May 22, 2017, 09:30:08 PM
Quote from: JonM on May 22, 2017, 05:52:45 PM
I thought platformio was suppose to determine what I needed!  Thank you for that!  I'll read about 'lib_ldf_mode = deep'.  I am on a Mac (macOS Sierra).

In your "lib" folder, what is RFM69 symlinked to?  Does RFM69 symlink to ~/Documents/Arduino/libraries/RFM69?
Well, not in my case, but it could be in yours.  As long as you have a link to where the library is actually located, it doesn't matter where it is.  That's why I don't bother with registering a library, each project folder has a lib folder with links to the libraries necessary for the project.  From platformio's perspective they're local libraries.

T
EDIT: By the way, this also gives me the latitude to temporarily override a particular library with an 'enhanced' version.  I just change the link to point to the one-off folder instead.  I don't need to mess with the stable library at all.