Project 4  Seven-Segment Display with I2C interface
Neff Site
Macros | Functions
i2c.h File Reference

Header file for the I2C interface. More...

Go to the source code of this file.

Macros

#define F_I2C   100000L
 
#define I2C_PORT   PORTF
 
#define I2C_MODULE   TWIF
 
#define I2C_SDA_bp   PIN0_bp
 
#define I2C_SDA_bm   PIN0_bm
 
#define I2C_SCL_bp   PIN1_bp
 
#define I2C_SCL_bm   PIN1_bm
 

Functions

void i2c_init (void)
 Initializes the I2C module. More...
 
void i2c_start_write (uint8_t addr)
 Start a write transaction. More...
 
void i2c_write (uint8_t data)
 Write one byte. More...
 
void i2c_stop (void)
 Close the current transaction. More...
 

Detailed Description

Header file for the I2C interface.

This library provides high level access to the Inter-Integrated Circuit bus module.

Author
Wolfgang Neff
Version
3.0
Date
2016-05-14
History
Created: 2013-06-20
Modified: 2016-05-14
Modified: 2017-12-20

Macro Definition Documentation

◆ F_I2C

#define F_I2C   100000L

◆ I2C_MODULE

#define I2C_MODULE   TWIF

◆ I2C_PORT

#define I2C_PORT   PORTF

◆ I2C_SCL_bm

#define I2C_SCL_bm   PIN1_bm

◆ I2C_SCL_bp

#define I2C_SCL_bp   PIN1_bp

◆ I2C_SDA_bm

#define I2C_SDA_bm   PIN0_bm

◆ I2C_SDA_bp

#define I2C_SDA_bp   PIN0_bp

Function Documentation

◆ i2c_init()

void i2c_init ( void  )

Initializes the I2C module.

◆ i2c_start_write()

void i2c_start_write ( uint8_t  addr)

Start a write transaction.

Starts a master write transaction by issuing a START condition which is followed by a write request for the addressed slave.

Parameters
addrThe address of the receiver.

◆ i2c_stop()

void i2c_stop ( void  )

Close the current transaction.

Closes the current transaction by issuing a STOP condition.

◆ i2c_write()

void i2c_write ( uint8_t  data)

Write one byte.

Send one byte to the addressed slave.

Parameters
dataThe byte to be sent.
Contact