Hi All,
I recently downloaded an Arduino library from here GitHub - antodom/pwm_lib: This is a C++ library to abstract the use of the eight hardware PWM channels available on Arduino DUE's Atmel ATSAM3X8E microcontroller.. The example program I tied, supplied with the library, works very well when compiled with Arduino IDE, but the same example file does not compile under Platformio and produces hundreds or error messages. They are (on cursory inspection) all the same message. I’ve pasted in some of them below.
In file included from lib/pwm_lib/pwm_lib.h:37:0,
from src/main.cpp:36:
/home/ian/.platformio/packages/framework-arduino-sam/system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:494:21: error: 'reinterpret_cast<Pio*>(1074662912)' is not a constant expression
#define PIOA ((Pio *)0x400E0E00U) /**< \brief (PIOA ) Base Address */
~^~~~~~~~~~~~~~~~~~~~~~
lib/pwm_lib/pwm_defs.h:98:37: note: in definition of macro 'pin_traits_specialization'
static constexpr Pio* pio_p = pio; \
^~~
lib/pwm_lib/pwm_defs.h:109:52: note: in expansion of macro 'PIOA'
pin_traits_specialization(pwm_pin::PWMH0_PA8 , PIOA, PIO_PA8B_PWMH0 , ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT, PWM_CH0, false );
^~~~
/home/ian/.platformio/packages/framework-arduino-sam/system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:495:21: error: 'reinterpret_cast<Pio*>(1074663424)' is not a constant expression
#define PIOB ((Pio *)0x400E1000U) /**< \brief (PIOB ) Base Address */
~^~~~~~~~~~~~~~~~~~~~~~
lib/pwm_lib/pwm_defs.h:98:37: note: in definition of macro 'pin_traits_specialization'
static constexpr Pio* pio_p = pio; \
^~~
lib/pwm_lib/pwm_defs.h:110:52: note: in expansion of macro 'PIOB'
pin_traits_specialization(pwm_pin::PWMH0_PB12, PIOB, PIO_PB12B_PWMH0, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT, PWM_CH0, false );
^~~~
/home/ian/.platformio/packages/framework-arduino-sam/system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:496:21: error: 'reinterpret_cast<Pio*>(1074663936)' is not a constant expression
#define PIOC ((Pio *)0x400E1200U) /**< \brief (PIOC ) Base Address */
~^~~~~~~~~~~~~~~~~~~~~~
lib/pwm_lib/pwm_defs.h:98:37: note: in definition of macro 'pin_traits_specialization'
static constexpr Pio* pio_p = pio; \
^~~
lib/pwm_lib/pwm_defs.h:111:52: note: in expansion of macro 'PIOC'
pin_traits_specialization(pwm_pin::PWMH0_PC3 , PIOC, PIO_PC3B_PWMH0 , ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT, PWM_CH0, false );
^~~~
I’ve updated all the libraries to the latest versions. Is there something else I need to do in Platformio to get this library to work?
Thanks,
Ian