Duhjoker
Well-known member
ok heres the deal. I'm working with two libraries, the t3 library and esp32 library. As it stands, testing both libraries requires me to switch out the MCU every other time I need to test something. Major PITA!!! So I wanted to have a console for each library. Unfortunately I cant get any support from Adafruit and the esp32 forum hasn't been much help either.
This is what I have. I went in to the pins_arduino (pin out library) and marked out the DAC pin assignments and used those pins as the second set of i2c pins.
then I was told I needed to add this to the wire.cpp file.
TwoWire Wire = TwoWire(0);
TwoWire Wire2 = TwoWire(0);
Then I added the second address for the second i2c device like so..
#define SEESAW_ADDRESS (0x49)
#define SEESAW_ADDRESS2 (0x4a)
but I cant get an answer from any one on what to do next.
I feel like I should add the second i2c lines to wire .h like so....
then add the sda2 stuff to this......
but like I said I cant get any answers.
This is what I have. I went in to the pins_arduino (pin out library) and marked out the DAC pin assignments and used those pins as the second set of i2c pins.
Code:
static const uint8_t TX = 17;
static const uint8_t RX = 16;
static const uint8_t SDA = 23;
static const uint8_t SCL = 22;
static const uint8_t SDA2 = 25;
static const uint8_t SCL2 = 26;
static const uint8_t SS = 2;
static const uint8_t MOSI = 18;
static const uint8_t MISO = 19;
static const uint8_t SCK = 5;
// mapping to match other feathers and also in order
static const uint8_t A0 = 26;
static const uint8_t A1 = 25;
static const uint8_t A2 = 34;
static const uint8_t A3 = 39;
static const uint8_t A4 = 36;
static const uint8_t A5 = 4;
static const uint8_t A6 = 14;
static const uint8_t A7 = 32;
static const uint8_t A8 = 15;
static const uint8_t A9 = 33;
static const uint8_t A10 = 27;
static const uint8_t A11 = 12;
static const uint8_t A12 = 13;
// vbat measure
static const uint8_t A13 = 35;
//static const uint8_t Ax = 0; // not used/available
//static const uint8_t Ax = 2; // not used/available
static const uint8_t T0 = 4;
static const uint8_t T1 = 0;
static const uint8_t T2 = 2;
static const uint8_t T3 = 15;
static const uint8_t T4 = 13;
static const uint8_t T5 = 12;
static const uint8_t T6 = 14;
static const uint8_t T7 = 27;
static const uint8_t T8 = 33;
static const uint8_t T9 = 32;
//static const uint8_t DAC1 = 25;
//static const uint8_t DAC2 = 26;
#endif /* Pins_Arduino_h */
then I was told I needed to add this to the wire.cpp file.
TwoWire Wire = TwoWire(0);
TwoWire Wire2 = TwoWire(0);
Then I added the second address for the second i2c device like so..
#define SEESAW_ADDRESS (0x49)
#define SEESAW_ADDRESS2 (0x4a)
but I cant get an answer from any one on what to do next.
I feel like I should add the second i2c lines to wire .h like so....
Code:
class TwoWire: public Stream
{
protected:
uint8_t num;
int8_t sda;
int8_t scl;
int8_t sda2; //////added by duhjoker
int8_t scl2; //////" "
i2c_t * i2c;
uint8_t rxBuffer[I2C_BUFFER_LENGTH];
uint16_t rxIndex;
uint16_t rxLength;
uint8_t txBuffer[I2C_BUFFER_LENGTH];
uint16_t txIndex;
uint16_t txLength;
uint8_t txAddress;
uint8_t transmitting;
then add the sda2 stuff to this......
Code:
void TwoWire::begin(int sdaPin, int sclPin, uint32_t frequency)
{
if(sdaPin < 0) {
if(num == 0) {
sdaPin = SDA;
} else {
return;
}
}
if(sclPin < 0) {
if(num == 0) {
sclPin = SCL;
} else {
return;
}
}
if(i2c == NULL) {
i2c = i2cInit(num, 0, false);
if(i2c == NULL) {
return;
}
}
i2cSetFrequency(i2c, frequency);
if(sda >= 0 && sda != sdaPin) {
i2cDetachSDA(i2c, sda);
}
if(scl >= 0 && scl != sclPin) {
i2cDetachSCL(i2c, scl);
}
sda = sdaPin;
scl = sclPin;
i2cAttachSDA(i2c, sda);
i2cAttachSCL(i2c, scl);
flush();
i2cInitFix(i2c);
}
but like I said I cant get any answers.