binary Clock
Macros | Functions
i2c_drvr_4313.h File Reference

Low level I2C definitions for the ATtiny4313. More...

#include "global_defines.h"
#include <stdint.h>

Go to the source code of this file.

Macros

#define I2C_START_RETRY   5
 defines how many times we should retry to start communication More...
 
#define I2C_BITBANG
 Don't use I2C hardware modules, but rather manual port manipulation. More...
 

Functions

retval_t i2c_drvr_init (void)
 
retval_t i2c_drvr_start (uint8_t byte_to_tx)
 
retval_t i2c_drvr_end (void)
 
retval_t i2c_drvr_write_byte (uint8_t byte_to_tx)
 
retval_t i2c_drvr_read_byte (uint8_t *byte_read_ptr, uint8_t ack)
 
void toggle_scl (void)
 

Detailed Description

Low level I2C definitions for the ATtiny4313.

Macro Definition Documentation

◆ I2C_BITBANG

#define I2C_BITBANG

Don't use I2C hardware modules, but rather manual port manipulation.

◆ I2C_START_RETRY

#define I2C_START_RETRY   5

defines how many times we should retry to start communication

Function Documentation

◆ i2c_drvr_end()

retval_t i2c_drvr_end ( void  )

Creates an end condition and returns if it was successful.

Parameters
[out]retval(retval_t): Returns if the end condition worked.

◆ i2c_drvr_init()

retval_t i2c_drvr_init ( void  )

Initializes the I2C lines.

Parameters
[out]retval(retval_t): Returns if the initialization worked.

◆ i2c_drvr_read_byte()

retval_t i2c_drvr_read_byte ( uint8_t *  byte_read_ptr,
uint8_t  ack 
)

Reads a byte of information to from the I2C line.

Parameters
[in]byte_read_ptr(uint8_t *): Location to return the read back value.
[in]ack(uint8_t): Whether or not to acknowledge the byte.
[out]retval(retval_t): Returns if the read was successful.

◆ i2c_drvr_start()

retval_t i2c_drvr_start ( uint8_t  addr_with_mode)

Creates a start condition, addresses the chip and returns if it was successful.

Parameters
[in]addr_with_mode(uint8_t): Address of the chip with mode set.
[out]retval(retval_t): Returns if the start condition worked.

◆ i2c_drvr_write_byte()

retval_t i2c_drvr_write_byte ( uint8_t  byte_to_tx)

Writes a byte of information to the I2C line.

Parameters
[in]byte_to_tx(uint8_t): Byte to transmit.
[out]retval(retval_t): Returns if the byte write was acknowledged.

◆ toggle_scl()

void toggle_scl ( void  )