#include "chip.h"#include <assert.h>Go to the source code of this file.
Defines | |
| #define | TWIHS_IT |
Functions | |
| void | TWI_ConfigureMaster (Twihs *pTwi, uint32_t dwTwCk, uint32_t dwMCk) |
| Configures a TWI peripheral to operate in master mode, at the given frequency (in Hz). The duty cycle of the TWI clock is set to 50%. | |
| void | TWI_ConfigureSlave (Twihs *pTwi, uint8_t slaveAddress) |
| Configures a TWI peripheral to operate in slave mode. | |
| void | TWI_Stop (Twihs *pTwi) |
| Sends a STOP condition on the TWI. | |
| void | TWI_StartRead (Twihs *pTwi, uint8_t address, uint32_t iaddress, uint8_t isize) |
| Starts a read operation on the TWI bus with the specified slave, it returns immediately. Data must then be read using TWI_ReadByte() whenever a byte is available (poll using TWI_ByteReceived()). | |
| uint8_t | TWI_ReadByte (Twihs *pTwi) |
| Reads a byte from the TWI bus. The read operation must have been started using TWI_StartRead() and a byte must be available (check with TWI_ByteReceived()). | |
| void | TWI_WriteByte (Twihs *pTwi, uint8_t byte) |
| Sends a byte of data to one of the TWI slaves on the bus. | |
| void | TWI_StartWrite (Twihs *pTwi, uint8_t address, uint32_t iaddress, uint8_t isize, uint8_t byte) |
| Starts a write operation on the TWI to access the selected slave, then returns immediately. A byte of data must be provided to start the write; other bytes are written next. after that to send the remaining bytes. | |
| uint8_t | TWI_ByteReceived (Twihs *pTwi) |
| Check if a byte have been received from TWI. | |
| uint8_t | TWI_ByteSent (Twihs *pTwi) |
| Check if a byte have been sent to TWI. | |
| uint8_t | TWI_TransferComplete (Twihs *pTwi) |
| Check if current transmission is completed. | |
| void | TWI_EnableIt (Twihs *pTwi, uint32_t sources) |
| Enables the selected interrupts sources on a TWI peripheral. | |
| void | TWI_DisableIt (Twihs *pTwi, uint32_t sources) |
| Disables the selected interrupts sources on a TWI peripheral. | |
| uint32_t | TWI_GetStatus (Twihs *pTwi) |
| Get the current status register of the given TWI peripheral. | |
| uint32_t | TWI_GetMaskedStatus (Twihs *pTwi) |
| Returns the current status register of the given TWI peripheral, but masking interrupt sources which are not currently enabled. | |
| void | TWI_SendSTOPCondition (Twihs *pTwi) |
| Sends a STOP condition. STOP Condition is sent just after completing the current byte transmission in master read mode. | |
Variables | |
| uint32_t | twi_send_stop = 0 |
Implementation of Two Wire Interface (TWI).
Definition in file twi.c.
| #define TWIHS_IT |
(TWIHS_IER_TXCOMP | TWIHS_IER_TXCOMP | TWIHS_IER_RXRDY \ | TWIHS_IER_TXRDY | TWIHS_IER_SVACC | TWIHS_IER_GACC | \ TWIHS_IER_OVRE | TWIHS_IER_UNRE | TWIHS_IER_NACK | \ TWIHS_IER_ARBLST | TWIHS_IER_SCL_WS | TWIHS_IER_EOSACC | \ TWIHS_IER_MCACK | TWIHS_IER_TOUT | TWIHS_IER_PECERR |\ TWIHS_IER_SMBDAM | TWIHS_IER_SMBHHM)
| uint8_t TWI_ByteReceived | ( | Twihs * | pTwi | ) |
| uint8_t TWI_ByteSent | ( | Twihs * | pTwi | ) |
| void TWI_ConfigureMaster | ( | Twihs * | pTwi, | |
| uint32_t | dwTwCk, | |||
| uint32_t | dwMCk | |||
| ) |
| void TWI_ConfigureSlave | ( | Twihs * | pTwi, | |
| uint8_t | slaveAddress | |||
| ) |
| void TWI_DisableIt | ( | Twihs * | pTwi, | |
| uint32_t | sources | |||
| ) |
| void TWI_EnableIt | ( | Twihs * | pTwi, | |
| uint32_t | sources | |||
| ) |
| uint32_t TWI_GetMaskedStatus | ( | Twihs * | pTwi | ) |
Returns the current status register of the given TWI peripheral, but masking interrupt sources which are not currently enabled.
| pTwi | Pointer to an Twihs instance. |
| uint32_t TWI_GetStatus | ( | Twihs * | pTwi | ) |
| uint8_t TWI_ReadByte | ( | Twihs * | pTwi | ) |
Reads a byte from the TWI bus. The read operation must have been started using TWI_StartRead() and a byte must be available (check with TWI_ByteReceived()).
| pTwi | Pointer to an Twihs instance. |
| void TWI_SendSTOPCondition | ( | Twihs * | pTwi | ) |
| void TWI_StartRead | ( | Twihs * | pTwi, | |
| uint8_t | address, | |||
| uint32_t | iaddress, | |||
| uint8_t | isize | |||
| ) |
Starts a read operation on the TWI bus with the specified slave, it returns immediately. Data must then be read using TWI_ReadByte() whenever a byte is available (poll using TWI_ByteReceived()).
| pTwi | Pointer to an Twihs instance. | |
| address | Slave address on the bus. | |
| iaddress | Optional internal address bytes. | |
| isize | Number of internal address bytes. |
| void TWI_StartWrite | ( | Twihs * | pTwi, | |
| uint8_t | address, | |||
| uint32_t | iaddress, | |||
| uint8_t | isize, | |||
| uint8_t | byte | |||
| ) |
Starts a write operation on the TWI to access the selected slave, then returns immediately. A byte of data must be provided to start the write; other bytes are written next. after that to send the remaining bytes.
| pTwi | Pointer to an Twihs instance. | |
| address | Address of slave to acccess on the bus. | |
| iaddress | Optional slave internal address. | |
| isize | Number of internal address bytes. | |
| byte | First byte to send. |
Definition at line 255 of file twi.c.

| void TWI_Stop | ( | Twihs * | pTwi | ) |
| uint8_t TWI_TransferComplete | ( | Twihs * | pTwi | ) |
| void TWI_WriteByte | ( | Twihs * | pTwi, | |
| uint8_t | byte | |||
| ) |
Sends a byte of data to one of the TWI slaves on the bus.
| pTwi | Pointer to an Twihs instance. | |
| byte | Byte to send. |
| uint32_t twi_send_stop = 0 |
1.7.1