Microchip® Advanced Software Framework

twim.h File Reference

TWI driver for AVR.

This file defines a useful set of functions for the TWI interface on AVR devices.

Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.

#include <compiler.h>
#include <status_codes.h>
#include "conf_twim.h"
#include "twi_common.h"

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...