Installing a Teensy library from Github into global scope

I’m having trouble installing a library from github. (GitHub - pedvide/ADC: Teensy 4/3.x/LC ADC implementation)

I use git to manage my project directory, so I don’t want to try and add it to lib/

I saw elsewhere in the community questions, a reference to installing libraries in the “global” scope under ~/.platformio/libs

So, I’ve done that, however when I try to compile my project, one of the ADC library header files is not seeing the Teensy specific defines that it needs…

In file included from .pioenvs/teensy31/ADC/ADC.h:44:0,
from src/main.cpp:5:
.pioenvs/teensy31/ADC/ADC_Module.h:302:2: error: #error "F_BUS must be 108, 60, 56, 54, 48, 40, 36, 24, 4 or 2 MHz"
#error "F_BUS must be 108, 60, 56, 54, 48, 40, 36, 24, 4 or 2 MHz"

I get the same error from my IDE (CLion) and platformio run.

My hunch is that this library is being pre-compiled, and that step of compilation doesn’t know that this library needs teensy-specific headers?

Should platformio be putting the teensy-specific bits into the compile step automatically, or do I need to do something specific to the ADC library so that platformio knows to bring them in?

Edited to note that Ivan showed this library working correctly when added to the project library under lib/PJRC (Teensy) Forum

Because it should be lib instead libs :slight_smile:

Heh. Only a typo… in my question. On disk, it is in the right place :grin:

$ ls  ~/.platformio/lib/
ADC		Terminal_ID249

I’ve just moved ADC to ~/.platformio/lib and it builds without any errors.

Try to remove a .pioenvs directory from the project and rebuild. Which example do you use for test?

I did try removing .pioenvs and re-running platformio init, but that had the same problem.

Using an example from the ADC lib project, I do get a clean compile, so thank you for confirming that this global library install is working.

I’ve narrowed it down to the framework declaration in platformio.ini:

platform = teensy
framework = arduino,mbed
board = teensy31

When I remove the “,mbed” from the framework value, it builds just fine…

I thought multiple frameworks are allowed? Redirecting...

You can use simultaneously multiple frameworks if they depend each other or extend. For example, framework = cmsis, spl is OK for STM32 development platform. arduino and mbed are different frameworks. They are not compatible between itself. You can’t use arduino library for mbed framework.

If you want to write compatible project for the 2 frameworks, you need to define 2 different [env:*] in platformio.ini and make code compatible.