2 Replies Latest reply on Aug 8, 2018 11:19 AM by jett

    Typo in I2C "Get Slave Events Notification" example in the Cypress Peripheral Driver Library Version 3.0.1.1508

    chrisfrederickson

      There appears to be a typo in the "Get Slave Events Notification" example. CY_SCB_I2C_SLAVE_RD_CMPLT_EVENT should be CY_SCB_I2C_SLAVE_WR_CMPLT_EVENT for the write event.

       

      /* Callback implementation */
      void I2C_SlaveEventHandler(uint32_t events)
      {
         /* Slave sent data to master */
         if (0UL != (events & CY_SCB_I2C_SLAVE_RD_CMPLT_EVENT))
        {
         if (0UL == (events & CY_SCB_I2C_SLAVE_ERR_EVENT))
        {
         /* Read complete without errors: update buffer content */
        }
         /* Setup read buffer for the next read transaction */
         Cy_SCB_I2C_SlaveConfigReadBuf(SCB3, i2cReadBuffer, BUFFER_SIZE, &i2cContext);
        }
         /* Slave received data from master */
         if (0UL != (events & CY_SCB_I2C_SLAVE_RD_CMPLT_EVENT)) // Should be CY_SCB_I2C_SLAVE_WR_CMPLT_EVENT 
        {
         if (0UL == (events & CY_SCB_I2C_SLAVE_ERR_EVENT))
        {
         /* Write complete without errors: Process received data */
        }
         /* Setup buffer for the next write transaction */
         Cy_SCB_I2C_SlaveConfigWriteBuf(SCB3, i2cWriteBuffer, BUFFER_SIZE, &i2cContext);
        }
         /* Ignore all other events */
      }