Including any Library doesnt work

Hey there!

I am just getting started with platformIO and i’m loving it. Way better and more organized than the ArduinoIDE i was working with previously.

But i have one problem: including libraries doesn’t really work.
When i include a library through “#include ” i always get 17 or more problems after compiling. More specifically i try to include the IRRemoteControl library into a project with an STM32 BluePill board. On the library page it says that it supports the ST STM32 platform and Arduino framework.
I get the following errors with an empty file that just includes the library:

Is it a problem with the Timers on the STM32 board? I doubt that i have to manually port the library to work with such a normal board like the BluePill.

I sure is just a dumb fail on my side, but thanks in advance!

Which is because the auther of the library has stated in his library.properties:

Which to PIO (and Arduino) means “I support everything”. However, once you start looking in the code of the library, in the selection which hardware timer to use…

you’ll see it only supports

  • Arduino Mega
  • Teensy 1.0
  • Teensy 2.0
  • Teensy++ 1.0 & 2.0
  • Sanguino (ATmega644P)
  • Atmega8
  • Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, etc (ATmega168)

Which are all AVR chips, and not a single ARM / STM32 chip is in there, so author set this option incorrectly and the code tries to access AVR timer registers. It also wouldn’t work when compiled in the Arduino IDE.

Judging from this comment STM32 support, specifically for the STM32F103, is still lacking even in the Arduino-IRremote library. Someone made a fork of the library with receive-and-decode only capability and provided an example for the Bluepill / STM32F1 though. (that library can be used by setting lib_deps = https://github.com/KiLLAAA/Arduino-IRremote.git).

A different blog post talks about using the “Infrared Multi Protocol Decoder” codebase. A reddit post about an IR lib for STM32 + Arduino goes unanswered.

2 Likes