twi.h
Default mainpageat91libperipheralstwitwi.h
Description Overview  
Description
Purpose
Interface for configuration the Two Wire Interface (TWI) peripheral.

Usage
  1. Configures a TWI peripheral to operate in master mode, at the given frequency (in Hz) using TWI_ConfigureMaster().
  2. or if hardware possible, configures a TWI peripheral to operate in slave mode, at the given frequency (in Hz) using TWI_ConfigureSlave().
  3. Sends a STOP condition on the TWI using TWI_Stop().
  4. Starts a read operation on the TWI bus with the specified slave using TWI_StartRead(). Data must then be read using TWI_ReadByte() whenever a byte is available (poll using TWI_ByteReceived()).
  5. Starts a write operation on the TWI to access the selected slave using TWI_StartWrite(). A byte of data must be provided to start the write; other bytes are written next.
  6. Sends a byte of data to one of the TWI slaves on the bus using TWI_WriteByte(). This function must be called once before TWI_StartWrite() with the first byte of data to send, then it shall be called repeatedly after that to send the remaining bytes.
  7. Check if a byte has been received and can be read on the given TWI peripheral using TWI_ByteReceived(). Check if a byte has been sent using TWI_ByteSent().
  8. Check if the current transmission is complete (the STOP has been sent) using TWI_TransferComplete().
  9. Enables & disable the selected interrupts sources on a TWI peripheral using TWI_EnableIt() and TWI_DisableIt().
  10. Get current status register of the given TWI peripheral using TWI_GetStatus(). Get current status register of the given TWI peripheral, but masking interrupt sources which are not currently enabled using TWI_GetMaskedStatus().