LTlib LaurTec Library
4.0.1
Open Source C Library for Microchip Microcontrollers based on XC8 Compiler
|
#include "LTlib.h"
Go to the source code of this file.
Macros | |
#define | EEPROM_I2C_MODULE_1 |
#define | EEPROM_I2C_open I2C1_open |
#define | EEPROM_I2C_baud_rate I2C1_baud_rate |
#define | EEPROM_I2C_wait_bus_IDLE I2C1_wait_bus_IDLE |
#define | EEPROM_I2C_start_bit I2C1_start_bit |
#define | EEPROM_I2C_stop_bit I2C1_stop_bit |
#define | EEPROM_I2C_write_byte I2C1_write_byte |
#define | EEPROM_I2C_check_bus_collision I2C1_check_bus_collision |
#define | EEPROM_I2C_check_ACK I2C1_check_ACK |
#define | EEPROM_I2C_negative_ACK I2C1_negative_ACK |
#define | EEPROM_I2C_set_master_as_receiver I2C1_set_master_as_receiver |
#define | EEPROM_I2C_read_byte I2C1_read_byte |
#define | EEPROM_I2C_restart_communication I2C1_restart_communication |
#define | initialize_I2C_EEPROM I2C_EEPROM_initialize |
#define | write_I2C_EEPROM I2C_EEPROM_write_byte |
#define | I2C_EEPROM_write I2C_EEPROM_write_byte |
#define | write_I2C_EEPROM_check I2C_EEPROM_write_byte_check |
#define | I2C_EEPROM_write_check I2C_EEPROM_write_byte_check |
#define | read_I2C_EEPROM I2C_EEPROM_read_byte |
#define | I2C_EEPROM_read I2C_EEPROM_read_byte |
Functions | |
void | I2C_EEPROM_initialize (unsigned int baud_rate_KHz) |
signed char | I2C_EEPROM_write_byte (unsigned char control, unsigned int address, unsigned char data) |
signed char | I2C_EEPROM_write_byte_check (unsigned char control, unsigned int address, unsigned char data) |
signed char | I2C_EEPROM_read_byte (unsigned char control, unsigned int address, unsigned char *data) |
#define EEPROM_I2C_baud_rate I2C1_baud_rate |
Definition at line 74 of file I2C_EEPROM.h.
#define EEPROM_I2C_check_ACK I2C1_check_ACK |
Definition at line 80 of file I2C_EEPROM.h.
#define EEPROM_I2C_check_bus_collision I2C1_check_bus_collision |
Definition at line 79 of file I2C_EEPROM.h.
#define EEPROM_I2C_MODULE_1 |
Definition at line 69 of file I2C_EEPROM.h.
#define EEPROM_I2C_negative_ACK I2C1_negative_ACK |
Definition at line 81 of file I2C_EEPROM.h.
#define EEPROM_I2C_open I2C1_open |
Definition at line 73 of file I2C_EEPROM.h.
#define EEPROM_I2C_read_byte I2C1_read_byte |
Definition at line 83 of file I2C_EEPROM.h.
#define EEPROM_I2C_restart_communication I2C1_restart_communication |
Definition at line 84 of file I2C_EEPROM.h.
#define EEPROM_I2C_set_master_as_receiver I2C1_set_master_as_receiver |
Definition at line 82 of file I2C_EEPROM.h.
#define EEPROM_I2C_start_bit I2C1_start_bit |
Definition at line 76 of file I2C_EEPROM.h.
#define EEPROM_I2C_stop_bit I2C1_stop_bit |
Definition at line 77 of file I2C_EEPROM.h.
#define EEPROM_I2C_wait_bus_IDLE I2C1_wait_bus_IDLE |
Definition at line 75 of file I2C_EEPROM.h.
#define EEPROM_I2C_write_byte I2C1_write_byte |
Definition at line 78 of file I2C_EEPROM.h.
#define I2C_EEPROM_read I2C_EEPROM_read_byte |
Definition at line 186 of file I2C_EEPROM.h.
#define I2C_EEPROM_write I2C_EEPROM_write_byte |
Definition at line 138 of file I2C_EEPROM.h.
#define I2C_EEPROM_write_check I2C_EEPROM_write_byte_check |
Definition at line 163 of file I2C_EEPROM.h.
#define initialize_I2C_EEPROM I2C_EEPROM_initialize |
Definition at line 116 of file I2C_EEPROM.h.
#define read_I2C_EEPROM I2C_EEPROM_read_byte |
Definition at line 185 of file I2C_EEPROM.h.
#define write_I2C_EEPROM I2C_EEPROM_write_byte |
Definition at line 137 of file I2C_EEPROM.h.
#define write_I2C_EEPROM_check I2C_EEPROM_write_byte_check |
Definition at line 162 of file I2C_EEPROM.h.
void I2C_EEPROM_initialize | ( | unsigned int | baud_rate_KHz | ) |
This function initialize the I2C module accordingly to the clock and baud rate.
baud_rate_KHz | Baud rate expressed in KHz |
Definition at line 54 of file I2C_EEPROM.c.
References EEPROM_I2C_baud_rate, EEPROM_I2C_open, and I2C_MASTER.
signed char I2C_EEPROM_read_byte | ( | unsigned char | control, |
unsigned int | address, | ||
unsigned char * | data | ||
) |
This function reads a byte from an external I2C EEPROM.
control | Is the address of the EEPROM set with the external address pins and the internal one. The bit R/'W set to 0. (e.g 0xA0) |
address | Address where the byte must be read out [min: 0, max: depends on the EEPROM] |
*data | Address of the variable where the read data will be written into. |
Definition at line 205 of file I2C_EEPROM.c.
References EEPROM_I2C_check_ACK, EEPROM_I2C_check_bus_collision, EEPROM_I2C_negative_ACK, EEPROM_I2C_read_byte, EEPROM_I2C_restart_communication, EEPROM_I2C_set_master_as_receiver, EEPROM_I2C_start_bit, EEPROM_I2C_stop_bit, EEPROM_I2C_wait_bus_IDLE, and EEPROM_I2C_write_byte.
signed char I2C_EEPROM_write_byte | ( | unsigned char | control, |
unsigned int | address, | ||
unsigned char | data | ||
) |
This function writes a byte inside an I2C external EEPROM.
data | Byte to write [min: 0, max: 255] |
address | Address where the byte must be written [min: 0, max: depends on the EEPROM] |
control | Is the address of the EEPROM set with the external address pins and the internal one. The bit R/'W set to 0. (e.g 0xA0) |
Definition at line 66 of file I2C_EEPROM.c.
References EEPROM_I2C_check_ACK, EEPROM_I2C_check_bus_collision, EEPROM_I2C_start_bit, EEPROM_I2C_stop_bit, EEPROM_I2C_wait_bus_IDLE, and EEPROM_I2C_write_byte.
signed char I2C_EEPROM_write_byte_check | ( | unsigned char | control, |
unsigned int | address, | ||
unsigned char | data | ||
) |
This function writes a byte inside the EEPROM but it reads back the value to make sure that it has been properly written. It's slower than the other one due to this feature.
data | Byte to write [min: 0, max: 255] |
address | Address where the byte must be written [min: 0, max: depends on the EEPROM] |
control | Is the address of the EEPROM set with the external address pins and the internal one. The bit R/'W set to 0. (e.g 0xA0) |
Definition at line 173 of file I2C_EEPROM.c.
References delay_ms(), I2C_EEPROM_read_byte(), and I2C_EEPROM_write_byte().