Macros | |
#define | TWI_BAUD(F_SYS, F_TWI) (((F_SYS / (2 * F_TWI)) - 5)+1) |
#define | TWI_SUCCESS (STATUS_OK) |
Error Codes for the Module. More... | |
Functions | |
static void | twi_master_disable (TWI_t *twi) |
Disable Master Mode of the TWI. More... | |
static void | twi_master_enable (TWI_t *twi) |
Enable Master Mode of the TWI. More... | |
status_code_t | twi_master_init (TWI_t *twi, const twi_options_t *opt) |
Initialize the twi master module. More... | |
static status_code_t | twi_master_read (TWI_t *twi, const twi_package_t *package) |
Read multiple bytes from a TWI compatible slave device. More... | |
status_code_t | twi_master_transfer (TWI_t *twi, const twi_package_t *package, bool read) |
Perform a TWI master write or read transfer. More... | |
static status_code_t | twi_master_write (TWI_t *twi, const twi_package_t *package) |
Write multiple bytes to a TWI compatible slave device. More... | |
#define TWI_BAUD | ( | F_SYS, | |
F_TWI | |||
) | (((F_SYS / (2 * F_TWI)) - 5)+1) |
Baud register setting calculation. Formula described in datasheet.
Referenced by twi_master_setup(), and twi_slave_setup().
#define TWI_SUCCESS (STATUS_OK) |
Error Codes for the Module.
Referenced by main().
|
inlinestatic |
Disable Master Mode of the TWI.
twi | Base address of the TWI instance. |
|
inlinestatic |
Enable Master Mode of the TWI.
twi | Base address of the TWI instance. |
status_code_t twi_master_init | ( | TWI_t * | twi, |
const twi_options_t * | opt | ||
) |
Initialize the twi master module.
twi | Base address of the TWI (i.e. &TWIC). |
*opt | Options for initializing the twi module (see twi_options_t) |
STATUS_OK | Transaction is successful |
ERR_INVALID_ARG | Invalid arguments in opt . |
References CONF_PMIC_INTLVL, CONF_TWIM_INTLVL, cpu_irq_enable, twi_options_t::speed_reg, STATUS_OK, and transfer.
Referenced by twi_master_setup().
|
inlinestatic |
Read multiple bytes from a TWI compatible slave device.
twi | Base address of the TWI (i.e. &TWI_t). |
package | Package information and data (see twi_package_t) |
References twi_master_transfer().
Referenced by main().
status_code_t twi_master_transfer | ( | TWI_t * | twi, |
const twi_package_t * | package, | ||
bool | read | ||
) |
Perform a TWI master write or read transfer.
This function is a TWI Master write or read transaction.
twi | Base address of the TWI (i.e. &TWI_t). |
package | Package information and data (see twi_package_t) |
read | Selects the transfer direction |
References twi_package_t::addr_length, twi_package_t::chip, ERR_INVALID_ARG, twi_package_t::no_wait, read, status, STATUS_OK, transfer, twim_acquire(), and twim_release().
Referenced by twi_master_read(), and twi_master_write().
|
inlinestatic |
Write multiple bytes to a TWI compatible slave device.
twi | Base address of the TWI (i.e. &TWI_t). |
package | Package information and data (see twi_package_t) |
References twi_master_transfer().
Referenced by main().