Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library throwing error when compiling for ESP32 #2

Open
krs1980 opened this issue Mar 15, 2022 · 1 comment
Open

Library throwing error when compiling for ESP32 #2

krs1980 opened this issue Mar 15, 2022 · 1 comment

Comments

@krs1980
Copy link

krs1980 commented Mar 15, 2022

Hello folks, It moight appear silly but when I tried to use library with ESP32, my code doesn't compile. It throws error TLC59108.cpp:37:61: error: no matching function for call to 'TwoWire::TwoWire()'
TLC59108::TLC59108(const byte i2c_address): addr(i2c_address)

I was able to compile for Arduino Mega 2560 and it works fine. My project needs it to use ESP32. What should I do to get it working.
Here is my code:
#include "TLC59108.h"

#define HW_RESET_PIN 19
#define I2C_ADDR 0x40 //TLC59108::I2C_ADDR::BASE
#define RED_PIN_ADDR 2

typedef struct clrName{
uint8_t red[3] ={0xFF,0x00,0x00};
uint8_t green[3] ={0x00,0xFF,0x00};
uint8_t blue[3] ={0x00,0x00,0xFF};
uint8_t cyan[3] ={0x00,0xFF,0xFF};
uint8_t orange[3] ={0xFF,0x99,0x00};
uint8_t yellow[3] ={0xFF,0xFF,0x00};
uint8_t pink[3] ={0xFF,0x14,0x93};
uint8_t magenta[3]={0xFF,0x00,0xFF};
uint8_t violet[3] ={0xEE,0x82,0xEE};
uint8_t purple[3] ={0x80,0x00,0x80};
uint8_t black[3] ={0x00,0x00,0x00};
uint8_t white[3] ={0xFF,0xFF,0xFF};
}colorNames_t;

TLC59108 leds(I2C_ADDR);

class rgbStrip{
public:
colorNames_t colorName;

public:
void init(void);
void setColor(uint8_t ledNo, uint8_t color[], uint8_t colorIntensity);
};

rgbStrip statusIndicator;

void setup() {
statusIndicator.init();
Serial.begin(9600);
}

void loop(){
sweep();
}

void sweep() {
byte pwm;

for(uint8_t i = 0; i < 100; i++){
statusIndicator.setColor(RED_PIN_ADDR, statusIndicator.colorName.cyan, i);
delay(10);
}
for(uint8_t i = 99; i < 0xFF; i--){
statusIndicator.setColor(RED_PIN_ADDR, statusIndicator.colorName.cyan, i);
delay(10);
}

for(uint8_t i = 0; i < 100; i++){
statusIndicator.setColor(RED_PIN_ADDR, statusIndicator.colorName.red, i);
delay(10);
}
for(uint8_t i = 99; i < 0xFF; i--){
statusIndicator.setColor(RED_PIN_ADDR, statusIndicator.colorName.red, i);
delay(10);
}

for(uint8_t i = 0; i < 100; i++){
statusIndicator.setColor(RED_PIN_ADDR, statusIndicator.colorName.green, i);
delay(10);
}
for(uint8_t i = 99; i < 0xFF; i--){
statusIndicator.setColor(RED_PIN_ADDR, statusIndicator.colorName.green, i);
delay(10);
}
}

/**

  • Method to initialize I2C interface and set mode for TLC59108 chip \n
  • @param [in] nothing
  • @returns nothing
  • */

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

/**

  • Method to set color of analog RGB strip \n
  • @param [in] ledNo led channel to be controlled
  • @param [in] color array with values of R,G,B
  • @param [in] colorIntensity intensity to be set for selected color combination
  • @returns nothing
  • */

void rgbStrip :: setColor(uint8_t ledNo, uint8_t color[], uint8_t colorIntensity){
uint8_t setColor[3];
float tempVal;
for (uint8_t i = 0; i < sizeof(setColor); i++){
tempVal = (color[i] * colorIntensity)/100;
setColor[i] = (uint8_t)tempVal;
}
leds.setBrightness(2, setColor[0]);
leds.setBrightness(3, setColor[0]);
leds.setBrightness(0, setColor[1]);
leds.setBrightness(1, setColor[1]);
leds.setBrightness(4, setColor[2]);
leds.setBrightness(5, setColor[2]);
delay(10);
}

Any help would be highly appreciated.

@chrylis
Copy link
Owner

chrylis commented Aug 5, 2022

Is the TwoWire API available on ESP? If so, how do you create one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants