1 Reply Latest reply on May 28, 2020 6:17 AM by HemanthR_06

    have two i2c interfaces. clarification needed regarding with dependency of API to both interfaces.

    AMRA_4710126
      CyU3PReturnStatus_t
      SensorWrite (
              uint8_t slaveAddr,
              uint8_t highAddr,
              uint8_t lowAddr,
              uint8_t count,
              uint8_t *buf)
      {
          CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
          CyU3PI2cPreamble_t preamble;    /* Validate the I2C slave address. */
          if ((slaveAddr != SENSOR_ADDR_WR) && (slaveAddr != I2C_MEMORY_ADDR_WR))
          {
              CyU3PDebugPrint (4, "I2C Slave address is not valid!\n");
              return 1;
          }    if (count > 64)
          {
              CyU3PDebugPrint (4, "ERROR: SensorWrite count > 64\n");
              return 1;
          }    /* Set up the I2C control parameters and invoke the write API. */
          preamble.buffer[0] = slaveAddr;
          preamble.buffer[1] = highAddr;
          //preamble.buffer[2] = lowAddr;
          preamble.length    = 2;
          preamble.ctrlMask  = 0x0000;    apiRetStatus = CyU3PI2cTransmitBytes (&preamble, buf, count, 0);
          SensorI2CAccessDelay (apiRetStatus);    return apiRetStatus;
      }

       

       

       

      CyU3PReturnStatus_t
      SensorRead (
              uint8_t slaveAddr,
              uint8_t highAddr,
              uint8_t lowAddr,
              uint8_t count,
              uint8_t *buf)
      {
          CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
          CyU3PI2cPreamble_t preamble;    /* Validate the parameters. */
          if ((slaveAddr != SENSOR_ADDR_RD) && (slaveAddr != I2C_MEMORY_ADDR_RD))
          {
              CyU3PDebugPrint (4, "I2C Slave address is not valid!\n");
              return 1;
          }
          if ( count > 64 )
          {
              CyU3PDebugPrint (4, "ERROR: SensorWrite count > 64\n");
              return 1;
          }    preamble.buffer[0] = slaveAddr & I2C_SLAVEADDR_MASK;        /*  Mask out the transfer type bit. */
          preamble.buffer[1] = highAddr;
          //preamble.buffer[2] = lowAddr;
          preamble.buffer[2] = slaveAddr;
          preamble.length    = 3;
          preamble.ctrlMask  = 0x0002;                                /*  Send start bit after third byte of preamble. */    apiRetStatus = CyU3PI2cReceiveBytes (&preamble, buf, count, 0);
          SensorI2CAccessDelay (apiRetStatus);    return apiRetStatus;
      }

       

      These are the read and write functions of i2c interface in fx3 (CYUSB3014) for camera sensor setting .
      we need to use a LED driver (LP8556), that should be pre-configured the eprom memory via i2c interface. if suppose we need to make any modification in API for led driver it should not affect the camera. How can i do that? i am bit more confusing about that? can anyone guide me to reach out?
      thanks in advance.