#include "config.h"
#include "pic_utils.h"
Go to the source code of this file.
Defines | |
#define | __i2c_h defined |
#define | i2c_read_sda() set_bit(tris_array[i2c_sda_port - PORTA], i2c_sda_pin); |
#define | i2c_write_sda() clear_bit(tris_array[i2c_sda_port - PORTA], i2c_sda_pin); |
Functions | |
uns8 | i2c_read_eeprom (uns8 device_address, uns8 mem_address) |
Read an 8 bit byte over I2C buss. | |
uns16 | i2c_read_eeprom_16bit (uns8 device_address, uns8 mem_address) |
Read 16 bits of data over I2C buss. | |
uns8 | i2c_receive_byte () |
Receive byte from I2C buss. | |
void | i2c_send_byte (uns8 data) |
Send a byte to I2C buss. | |
void | i2c_setup () |
Setup ports and pins for I2C communication. | |
void | i2c_start (void) |
Send start signal to I2C buss. | |
void | i2c_stop (void) |
Send stop signal to I2C buss. | |
void | i2c_write_eeprom (uns8 device_address, uns8 mem_address, uns8 data) |
Write an 8 bit byte ove I2C buss. |
Definition in file i2c.h.
#define i2c_read_sda | ( | ) | set_bit(tris_array[i2c_sda_port - PORTA], i2c_sda_pin); |
Change SDA line to read mode
Definition at line 34 of file i2c.h.
Referenced by i2c_receive_byte(), and i2c_send_byte().
#define i2c_write_sda | ( | ) | clear_bit(tris_array[i2c_sda_port - PORTA], i2c_sda_pin); |
Change SDA line to write mode
Definition at line 32 of file i2c.h.
Referenced by i2c_read_eeprom(), i2c_read_eeprom_16bit(), i2c_send_byte(), i2c_start(), and i2c_stop().
uns8 i2c_read_eeprom | ( | uns8 | device_address, | |
uns8 | mem_address | |||
) |
Read an 8 bit byte from the specified device at the memory address
Definition at line 32 of file i2c.c.
References clear_pin, DELAY_AMOUNT, i2c_receive_byte(), i2c_send_byte(), i2c_start(), i2c_stop(), i2c_write_sda, set_pin, and uns8.
Referenced by ds1631_get_config(), lm75_get_config(), rtc_get_config(), rtc_get_date(), rtc_get_day(), rtc_get_hours(), rtc_get_minutes(), rtc_get_month(), rtc_get_seconds(), rtc_get_year(), rtc_set_seconds(), rtc_start_clock(), and rtc_stop_clock().
uns16 i2c_read_eeprom_16bit | ( | uns8 | device_address, | |
uns8 | mem_address | |||
) |
Read a 16 bit chunk of data from the given device and memory address
Definition at line 60 of file i2c.c.
References clear_pin, DELAY_AMOUNT, i2c_receive_byte(), i2c_send_byte(), i2c_start(), i2c_stop(), i2c_write_sda, set_pin, and uns16.
Referenced by ds1631_get_temp(), and lm75_get_temp().
uns8 i2c_receive_byte | ( | ) |
Clock in a byte over I2C lines. Note that an acknowledge is not sent/received
Definition at line 125 of file i2c.c.
References clear_pin, DELAY_AMOUNT, i2c_read_sda, set_pin, test_pin, and uns8.
Referenced by i2c_read_eeprom(), and i2c_read_eeprom_16bit().
void i2c_send_byte | ( | uns8 | data | ) |
Clock out a byte from the I2C buss. An acknowledge is "received" (although ignored).
Definition at line 147 of file i2c.c.
References change_pin, clear_pin, DELAY_AMOUNT, i2c_read_sda, i2c_write_sda, set_pin, and uns8.
Referenced by ds1631_convert_temp(), i2c_ack_polling(), i2c_read_eeprom(), i2c_read_eeprom_16bit(), and i2c_write_eeprom().
void i2c_setup | ( | ) |
Set port and pins correctly for I2C communication
Definition at line 170 of file i2c.c.
References make_output.
Referenced by ds1631_setup(), lm75_setup(), and rtc_setup().
void i2c_start | ( | void | ) |
Signals a start condition on the I2C buss.
Definition at line 100 of file i2c.c.
References clear_pin, DELAY_AMOUNT, and i2c_write_sda.
Referenced by ds1631_convert_temp(), i2c_ack_polling(), i2c_read_eeprom(), i2c_read_eeprom_16bit(), and i2c_write_eeprom().
void i2c_stop | ( | void | ) |
Signals a stop condition on the I2C buss.
Definition at line 110 of file i2c.c.
References clear_pin, DELAY_AMOUNT, i2c_write_sda, and set_pin.
Referenced by ds1631_convert_temp(), i2c_ack_polling(), i2c_read_eeprom(), i2c_read_eeprom_16bit(), and i2c_write_eeprom().
void i2c_write_eeprom | ( | uns8 | device_address, | |
uns8 | mem_address, | |||
uns8 | data | |||
) |
Write a byte to a given device address at the memory address
Definition at line 15 of file i2c.c.
References i2c_send_byte(), i2c_start(), i2c_stop(), serial_print_int_hex(), serial_print_spc(), and serial_print_str().
Referenced by ds1631_set_config(), lm75_set_config(), rtc_set_config(), rtc_set_date(), rtc_set_day(), rtc_set_hours(), rtc_set_minutes(), rtc_set_month(), rtc_set_seconds(), rtc_set_year(), rtc_start_clock(), and rtc_stop_clock().