arch/arm/src/sam34/sam_twi.c
/*******************************************************************************
 * Name: twi_startread
 *
 * Description:
 *   Start the next read message
 *
 *******************************************************************************/
twi_startread
Description:
Start the next read message
twi_startread Description : Start the next read message
static void twi_startread(struct twi_dev_s *priv, struct i2c_msg_s *msg)
{
  priv->result = -EBUSY;
  priv->xfrd   = 0;
  if (msg->length == 1)
    {
      twi_putrel(priv, SAM_TWI_CR_OFFSET, TWI_CR_STOP);
    }
  twi_putrel(priv, SAM_TWI_MMR_OFFSET, 0);
  twi_putrel(priv, SAM_TWI_MMR_OFFSET, TWI_MMR_IADRSZ_NONE | TWI_MMR_MREAD | TWI_MMR_DADR(msg->addr));
  twi_putrel(priv, SAM_TWI_IADR_OFFSET, 0);
  twi_putrel(priv, SAM_TWI_IER_OFFSET, TWI_INT_RXRDY | TWI_INT_ERRORS);
  twi_putrel(priv, SAM_TWI_CR_OFFSET, TWI_CR_START);
}
static void twi_startread ( struct twi_dev_s * priv , struct i2c_msg_s * msg ) { priv -> result = - EBUSY ; priv -> xfrd = 0 ; if ( msg -> length == 1 ) { twi_putrel ( priv , SAM_TWI_CR_OFFSET , TWI_CR_STOP ) ; } twi_putrel ( priv , SAM_TWI_MMR_OFFSET , 0 ) ; twi_putrel ( priv , SAM_TWI_MMR_OFFSET , TWI_MMR_IADRSZ_NONE | TWI_MMR_MREAD | TWI_MMR_DADR ( msg -> addr ) ) ; twi_putrel ( priv , SAM_TWI_IADR_OFFSET , 0 ) ; twi_putrel ( priv , SAM_TWI_IER_OFFSET , TWI_INT_RXRDY | TWI_INT_ERRORS ) ; twi_putrel ( priv , SAM_TWI_CR_OFFSET , TWI_CR_START ) ; }
Name: twi_startread
 Description:
   Start the next read message
Name : twi_startread Description : Start the next read message
/* Setup for the transfer */ /* Set STOP signal if only one byte is sent*/ /* Set slave address and number of internal address bytes. */ /* Set internal address bytes (not used) */ /* Enable read interrupt and send the START condition */