I2C Multiplexer implementation

Hi everyone,

I’m having trouble writing the address and command to an I2C multiplexer. The following code snippet is in switches.pde----static void do_aux_switch_function(int8_t ch_function, uint8_t ch_flag){

uint8_t CAMERA_ONE = 0x01; uint8_t CAMERA_TWO = 0x02; uint8_t CAMERA_THREE = 0x04; #if CAMERA_MULTIPLEX == ENABLED case AUX_SWITCH_CAMERA_MULTIPLEX: switch (ch_flag) { case AUX_SWITCH_LOW: hal.console->printf("Switch flicked 1"); if (hal.i2c) hal.i2c->write(0x4C, 1, &CAMERA_ONE); else hal.console->printf("Camera 1 i2c not working"); break; case AUX_SWITCH_MIDDLE: hal.console->printf("Switch flicked 2"); if (hal.i2c) hal.i2c->write(0x4C, 1, &CAMERA_TWO); else hal.console->printf("Camera 2 i2c not working"); break; case AUX_SWITCH_HIGH: hal.console->printf("Switch flicked 3"); if (hal.i2c) hal.i2c->write(0x4C, 1, &CAMERA_THREE); else hal.console->printf("Camera 3 i2c not working"); break; } break; #endif

It compiles fine. When the channel 7’s three way switch on the transmitter is toggled the appropriate switch case is selected. I have scoped the i2c pins, nothing.

I know it is a bit hacky, i will create a proper driver when i get it to work.

I have looked at all other implementations of hal.i2c->write(, what have i missed?

Thanks in advance