binary Clock
|
Low level I2C driver functions for the ATtiny4313. More...
#include "i2c_drvr_4313.h"
#include "i2c.h"
#include <avr/io.h>
#include <avr/cpufunc.h>
#include <stdint.h>
Functions | |
retval_t | check_ack (void) |
void | set_SDA (uint8_t val) |
void | set_SCL (uint8_t val) |
uint8_t | read_SDA (void) |
void | write_ack (uint8_t val) |
retval_t | i2c_drvr_init (void) |
retval_t | i2c_drvr_start (uint8_t addr_with_mode) |
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) |
Low level I2C driver functions for the ATtiny4313.
retval_t check_ack | ( | void | ) |
Checks is the slave asserts an acknowledge condition on the I2C bus.
[out] | retval | (retval_t): Returns if the slave acknowledged. |
retval_t i2c_drvr_end | ( | void | ) |
Creates an end condition and returns if it was successful.
[out] | retval | (retval_t): Returns if the end condition worked. |
retval_t i2c_drvr_init | ( | void | ) |
Initializes the I2C lines.
[out] | retval | (retval_t): Returns if the initialization worked. |
retval_t i2c_drvr_read_byte | ( | uint8_t * | byte_read_ptr, |
uint8_t | ack | ||
) |
Reads a byte of information to from the I2C line.
[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. |
retval_t i2c_drvr_start | ( | uint8_t | addr_with_mode | ) |
Creates a start condition, addresses the chip and returns if it was successful.
[in] | addr_with_mode | (uint8_t): Address of the chip with mode set. |
[out] | retval | (retval_t): Returns if the start condition worked. |
retval_t i2c_drvr_write_byte | ( | uint8_t | byte_to_tx | ) |
Writes a byte of information to the I2C line.
[in] | byte_to_tx | (uint8_t): Byte to transmit. |
[out] | retval | (retval_t): Returns if the byte write was acknowledged. |
uint8_t read_SDA | ( | void | ) |
Reads the state of the SDA line.
[out] | SDA_state | (uint8_t): State of the SDA line. |
void set_SCL | ( | uint8_t | val | ) |
Drives the SCL line low or lets it go high.
[in] | val | (uint8_t): Value to set the SCL line to. (high or low) |
void set_SDA | ( | uint8_t | val | ) |
Drives the SDA line low or lets it go high.
[in] | val | (uint8_t): Value to set the SDA line to. (high or low) |
void write_ack | ( | uint8_t | val | ) |
Writes an acknowledge or neg-ack to the I2C bus.
[in] | ack | (uint8_t): Whether or not to acknowledge |
[out] | retval | (retval_t): Returns if the read was successful. |