Using TLC59108 library with Arduino core for RP2040 Pico

Hello,

I have a commercial project I am working on which makes use of many TLC59108 8-Channel PWM Controllers for LED animation. I have been using the Arduino compatibleTLC59108 library written by Christopher Smith 8 years ago found on Github here:

https://github.com/chrylis/tlc59108

This has been working great on the AVR based microcontrollers I’ve been using to test my boards. However I would now like to transitoin to using the new RP2040, and cannot get the library to work (code won’t compile).

I’m not a C++ expert so I don’t understand exactly whats going wrong. The library is short and I’ve read through it and can’t see it doing anything that the new Arduino core for RP2040 wouldn’t support. However, this is the first time using an ARM based controller rather than AVR, and I’m thinking maybe the compiler is a bit more strict in how libraries are written?

Here is an example sketch which reproduces the error:

#include <Wire.h>
#include "TLC59108.h"

#define HW_RESET_PIN 2
#define I2C_ADDR TLC59108::I2C_ADDR::BASE

TLC59108 leds(I2C_ADDR);

void setup() {
  Wire.begin();
  leds.init(HW_RESET_PIN);
  leds.setLedOutputMode(TLC59108::LED_MODE::PWM_IND);
}

void loop(){
  // Blink On
  for(byte channel = 0; channel < 8; channel++)
  {
    leds.setBrightness(channel, 255);
  }
  delay(1000);

  // Blink off
  for(byte channel = 0; channel < 8; channel++)
  {
    leds.setBrightness(channel, 0);
  }
  delay(1000);
}

This results in errors at compilation:

In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/platform.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:25,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\sweep.ino.cpp:1:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/mbed_retarget.h:242:25: error: expected unqualified-id before numeric constant
 #define EINVAL          22      /* Invalid argument */
                         ^
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:182:24: note: in expansion of macro 'EINVAL'
   static const uint8_t EINVAL = 2;
                        ^~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/platform.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:25,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/mbed_retarget.h:242:25: error: expected unqualified-id before numeric constant
 #define EINVAL          22      /* Invalid argument */
                         ^
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:182:24: note: in expansion of macro 'EINVAL'
   static const uint8_t EINVAL = 2;
                        ^~~~~~
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp: In static member function 'static void TLC59108::setDefaultI2C(TwoWire)':
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:29:28: error: use of deleted function 'arduino::MbedI2C& arduino::MbedI2C::operator=(const arduino::MbedI2C&)'
    TLC59108::i2c_default = i2c_default;
                            ^~~~~~~~~~~
In file included from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24:0,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:34:7: note: 'arduino::MbedI2C& arduino::MbedI2C::operator=(const arduino::MbedI2C&)' is implicitly deleted because the default definition would be ill-formed:
 class MbedI2C : public HardwareI2C
       ^~~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:34:7: error: use of deleted function 'rtos::Thread& rtos::Thread::operator=(const rtos::Thread&)'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: note: 'rtos::Thread& rtos::Thread::operator=(const rtos::Thread&)' is implicitly deleted because the default definition would be ill-formed:
 class Thread : private mbed::NonCopyable<Thread> {
       ^~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: error: use of deleted function 'mbed::NonCopyable<T>& mbed::NonCopyable<T>::operator=(const mbed::NonCopyable<T>&) [with T = rtos::Thread]'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/NonCopyable.h:185:18: note: declared here
     NonCopyable &operator=(const NonCopyable &) = delete;
                  ^~~~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: error: use of deleted function 'rtos::Semaphore& rtos::Semaphore::operator=(const rtos::Semaphore&)'
 class Thread : private mbed::NonCopyable<Thread> {
       ^~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:33:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Semaphore.h:50:7: note: 'rtos::Semaphore& rtos::Semaphore::operator=(const rtos::Semaphore&)' is implicitly deleted because the default definition would be ill-formed:
 class Semaphore : private mbed::NonCopyable<Semaphore> {
       ^~~~~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Semaphore.h:50:7: error: use of deleted function 'mbed::NonCopyable<T>& mbed::NonCopyable<T>::operator=(const mbed::NonCopyable<T>&) [with T = rtos::Semaphore]'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/NonCopyable.h:185:18: note: declared here
     NonCopyable &operator=(const NonCopyable &) = delete;
                  ^~~~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: error: use of deleted function 'rtos::Mutex& rtos::Mutex::operator=(const rtos::Mutex&)'
 class Thread : private mbed::NonCopyable<Thread> {
       ^~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/PlatformMutex.h:42:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/drivers/include/drivers/I2C.h:27,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Mutex.h:70:7: note: 'rtos::Mutex& rtos::Mutex::operator=(const rtos::Mutex&)' is implicitly deleted because the default definition would be ill-formed:
 class Mutex : private mbed::NonCopyable<Mutex> {
       ^~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Mutex.h:70:7: error: use of deleted function 'mbed::NonCopyable<T>& mbed::NonCopyable<T>::operator=(const mbed::NonCopyable<T>&) [with T = rtos::Mutex]'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/NonCopyable.h:185:18: note: declared here
     NonCopyable &operator=(const NonCopyable &) = delete;
                  ^~~~~~~~
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp: In constructor 'TLC59108::TLC59108(TwoWire, byte)':
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:32:84: error: use of deleted function 'arduino::MbedI2C::MbedI2C(const arduino::MbedI2C&)'
 TLC59108::TLC59108(TwoWire i2c, const byte i2c_address): i2c(i2c), addr(i2c_address)
                                                                                    ^
In file included from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24:0,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:34:7: note: 'arduino::MbedI2C::MbedI2C(const arduino::MbedI2C&)' is implicitly deleted because the default definition would be ill-formed:
 class MbedI2C : public HardwareI2C
       ^~~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:34:7: error: use of deleted function 'rtos::Thread::Thread(const rtos::Thread&)'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: note: 'rtos::Thread::Thread(const rtos::Thread&)' is implicitly deleted because the default definition would be ill-formed:
 class Thread : private mbed::NonCopyable<Thread> {
       ^~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: error: use of deleted function 'mbed::NonCopyable<T>::NonCopyable(const mbed::NonCopyable<T>&) [with T = rtos::Thread]'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/NonCopyable.h:179:5: note: declared here
     NonCopyable(const NonCopyable &) = delete;
     ^~~~~~~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: error: use of deleted function 'rtos::Semaphore::Semaphore(const rtos::Semaphore&)'
 class Thread : private mbed::NonCopyable<Thread> {
       ^~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:33:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Semaphore.h:50:7: note: 'rtos::Semaphore::Semaphore(const rtos::Semaphore&)' is implicitly deleted because the default definition would be ill-formed:
 class Semaphore : private mbed::NonCopyable<Semaphore> {
       ^~~~~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Semaphore.h:50:7: error: use of deleted function 'mbed::NonCopyable<T>::NonCopyable(const mbed::NonCopyable<T>&) [with T = rtos::Semaphore]'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/NonCopyable.h:179:5: note: declared here
     NonCopyable(const NonCopyable &) = delete;
     ^~~~~~~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/rtos.h:29:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:28,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Thread.h:92:7: error: use of deleted function 'rtos::Mutex::Mutex(const rtos::Mutex&)'
 class Thread : private mbed::NonCopyable<Thread> {
       ^~~~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/PlatformMutex.h:42:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/drivers/include/drivers/I2C.h:27,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Mutex.h:70:7: note: 'rtos::Mutex::Mutex(const rtos::Mutex&)' is implicitly deleted because the default definition would be ill-formed:
 class Mutex : private mbed::NonCopyable<Mutex> {
       ^~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/rtos/include/rtos/Mutex.h:70:7: error: use of deleted function 'mbed::NonCopyable<T>::NonCopyable(const mbed::NonCopyable<T>&) [with T = rtos::Mutex]'
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/NonCopyable.h:179:5: note: declared here
     NonCopyable(const NonCopyable &) = delete;
     ^~~~~~~~~~~
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp: In constructor 'TLC59108::TLC59108(byte)':
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:36:61: error: no matching function for call to 'arduino::MbedI2C::MbedI2C()'
 TLC59108::TLC59108(const byte i2c_address): addr(i2c_address)
                                                             ^
In file included from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:24:0,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:37:5: note: candidate: arduino::MbedI2C::MbedI2C(int, int)
     MbedI2C(int sda, int scl);
     ^~~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:37:5: note:   candidate expects 2 arguments, 0 provided
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:38:10: error: use of deleted function 'arduino::MbedI2C& arduino::MbedI2C::operator=(const arduino::MbedI2C&)'
    i2c = Wire;
          ^~~~
In file included from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/platform.h:26:0,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/FileHandle.h:25,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/macros.h:28,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\variants\RASPBERRY_PI_PICO/pins_arduino.h:2,
                 from C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/Arduino.h:79,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.h:23,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:25:
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp: In member function 'uint8_t TLC59108::setBrightness(uint8_t, uint8_t)':
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/mbed_retarget.h:242:25: error: expected unqualified-id before numeric constant
 #define EINVAL          22      /* Invalid argument */
                         ^
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:111:20: note: in expansion of macro 'EINVAL'
      return ERROR::EINVAL;
                    ^~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/mbed_retarget.h:242:25: error: expected ';' before numeric constant
 #define EINVAL          22      /* Invalid argument */
                         ^
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:111:20: note: in expansion of macro 'EINVAL'
      return ERROR::EINVAL;
                    ^~~~~~
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp: In member function 'uint8_t TLC59108::setLedOutputMode(uint8_t)':
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/mbed_retarget.h:242:25: error: expected unqualified-id before numeric constant
 #define EINVAL          22      /* Invalid argument */
                         ^
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:119:20: note: in expansion of macro 'EINVAL'
      return ERROR::EINVAL;
                    ^~~~~~
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\cores\arduino/mbed/platform/include/platform/mbed_retarget.h:242:25: error: expected ';' before numeric constant
 #define EINVAL          22      /* Invalid argument */
                         ^
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_252828\sketch\TLC59108.cpp:119:20: note: in expansion of macro 'EINVAL'
      return ERROR::EINVAL;
                    ^~~~~~
Using library Wire in folder: C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire (legacy)
exit status 1
Error compiling for board Raspberry Pi Pico.

Any insight into what might be wrong would be greatly appreciated!

Welcome,

Try to add #undef EINVAL at the very top of the sketch

Hi guix, I added this line to the sketch but the compilation produced the same error.

I think the root cause of the errors might be with these. It looks like the main constructor in the library is being deleted for some reason. Maybe thats whats causing the multitude of concequential errors?

C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_900552\sketch\TLC59108.h:182:24: note: in expansion of macro 'EINVAL'
   static const uint8_t EINVAL = 2;
                        ^~~~~~
C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_900552\sketch\TLC59108.cpp: In static member function 'static void TLC59108::setDefaultI2C(TwoWire)':
TLC59108.cpp:29:28: error: use of deleted function 'arduino::MbedI2C& arduino::MbedI2C::operator=(const arduino::MbedI2C&)'
    TLC59108::i2c_default = i2c_default;
                            ^~~~~~~~~~~
In file included from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_900552\sketch\TLC59108.h:24:0,
                 from C:\Users\ALEXST~1\AppData\Local\Temp\arduino_build_900552\sketch\TLC59108.cpp:25:
C:\Users\AlexStewart\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\2.0.0\libraries\Wire/Wire.h:34:7: note: 'arduino::MbedI2C& arduino::MbedI2C::operator=(const arduino::MbedI2C&)' is implicitly deleted because the default definition would be ill-formed:
 class MbedI2C : public HardwareI2C
       ^~~~~~~

Sorry I know nothing about mbed… Maybe you should try another library like this one :

In the .h it says it’s for arduino. It seems to be a modified copy of the library that you currently use, but adapted for mbed.

Thank you for pointing me to this library. Unfortunatley it produced similar errors.

As I am working on a commercial project I have been required to get a solution working quickly, so in the end I have taken the orignial library and translated line by line into a new one, elminating errors as they occured.

I have uploaded the new library to github. This is now tested and working in a RPi Pico. I hope it’s of use to anyone else who needs to use the TLC59108 with the RP2040.

Cheers,