Adafruit TinyWireM Library
|
Go to the source code of this file.
Macros | |
#define | T2_TWI 5 |
>4,7us | |
#define | T4_TWI 4 |
>4,0us | |
#define | SIGNAL_VERIFY |
be on always. More... | |
#define | TWI_READ_BIT 0 |
Bit position for R/W bit in "address byte". | |
#define | TWI_ADR_BITS 1 |
Bit position for LSB of the slave address bits in the init byte. | |
#define | TWI_NACK_BIT 0 |
Bit position for (N)ACK bit. | |
#define | USI_TWI_NO_DATA 0x08 |
Transmission buffer is empty. | |
#define | USI_TWI_DATA_OUT_OF_BOUND 0x09 |
Transmission buffer is outside SRAM space. | |
#define | USI_TWI_UE_START_CON 0x07 |
Unexpected Start Condition. | |
#define | USI_TWI_UE_STOP_CON 0x06 |
Unexpected Stop Condition. | |
#define | USI_TWI_UE_DATA_COL 0x05 |
Unexpected Data Collision (arbitration) | |
#define | USI_TWI_NO_ACK_ON_DATA 0x02 |
The slave did not acknowledge all data. | |
#define | USI_TWI_NO_ACK_ON_ADDRESS 0x01 |
The slave did not acknowledge the address. | |
#define | USI_TWI_MISSING_START_CON 0x03 |
Generated Start Condition not detected on bus. | |
#define | USI_TWI_MISSING_STOP_CON 0x04 |
Generated Stop Condition not detected on bus. | |
#define | USI_TWI_BAD_MEM_READ 0x0A |
Error during external memory read. | |
#define | TRUE 1 |
True. | |
#define | FALSE 0 |
False. | |
Functions | |
void | USI_TWI_Master_Initialise (void) |
USI TWI single master initialization function. | |
unsigned char | USI_TWI_Start_Random_Read (unsigned char *, unsigned char) |
USI Random (memory) Read function. This function sets up for call to USI_TWI_Start_Transceiver_With_Data which does the work. Doesn't matter if read/write bit is set or cleared, it'll be set correctly in this function. More... | |
unsigned char | USI_TWI_Start_Read_Write (unsigned char *, unsigned char) |
USI Normal Read / Write Function Transmit and receive function. LSB of first byte in buffer indicates if a read or write cycles is performed. If set a read operation is performed. More... | |
unsigned char | USI_TWI_Master_Stop (void) |
Function for generating a TWI Stop Condition. Used to release the TWI bus. More... | |
unsigned char | USI_TWI_Get_State_Info (void) |
Use this function to get hold of the error message from the last transmission. More... | |
#define SIGNAL_VERIFY |
be on always.
Verifies the signal is correct. This should probably
unsigned char USI_TWI_Start_Random_Read | ( | unsigned char * | msg, |
unsigned char | msgSize | ||
) |
USI Random (memory) Read function. This function sets up for call to USI_TWI_Start_Transceiver_With_Data which does the work. Doesn't matter if read/write bit is set or cleared, it'll be set correctly in this function.
The msgSize is passed to USI_TWI_Start_Transceiver_With_Data.
Success or error code is returned. Error codes are defined in USI_TWI_Master.h
msg | Pointer to the buffer that contains the messages to be read |
msgSize | How much to read from the buffer |
unsigned char USI_TWI_Start_Read_Write | ( | unsigned char * | msg, |
unsigned char | msgSize | ||
) |
USI Normal Read / Write Function Transmit and receive function. LSB of first byte in buffer indicates if a read or write cycles is performed. If set a read operation is performed.
Function generates (Repeated) Start Condition, sends address and R/W, Reads/Writes Data, and verifies/sends ACK.
Success or error code is returned. Error codes are defined in USI_TWI_Master.h
msg | Pointer to the buffer that has the messages |
msgSize | The size of the message |
unsigned char USI_TWI_Master_Stop | ( | void | ) |
Function for generating a TWI Stop Condition. Used to release the TWI bus.
unsigned char USI_TWI_Get_State_Info | ( | void | ) |
Use this function to get hold of the error message from the last transmission.