LTlib LaurTec Library
4.0.1
Open Source C Library for Microchip Microcontrollers based on XC8 Compiler
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
I2C_EEPROM.h
Go to the documentation of this file.
1
/*******************************************************************************
2
3
Author : Mauro Laurenti
4
Version : 1.4
5
6
Created on Date : 04/09/2006
7
Last update : 29/11/2015
8
9
CopyRight 2006-2015 all rights are reserved
10
11
********************************************************
12
SOFTWARE LICENSE AGREEMENT
13
********************************************************
14
15
The usage of the supplied software imply the acceptance of the following license.
16
17
The software supplied herewith by Mauro Laurenti (the Author) is intended for
18
use solely and exclusively on Microchip PIC Microcontroller (registered mark).
19
The software is owned by the Author, and is protected under applicable
20
copyright laws. All rights are reserved.
21
Any use in violation of the foregoing restrictions may subject the
22
user to criminal sanctions under applicable laws, as well as to civil liability
23
for the breach of the terms and conditions of this license.
24
Commercial use is forbidden without a written acknowledgement with the Author.
25
Personal or educational use is allowed if the application containing the
26
following software doesn't aim to commercial use or monetary earning of any kind.
27
28
THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
29
WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
30
TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
31
PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE AUTHOR SHALL NOT,
32
IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
33
CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
34
35
36
********************************************************
37
PURPOSES
38
********************************************************
39
40
These functions allow the user to read/write inside the eeprom
41
that requires 2 address bytes such as the 24LC512.
42
43
********************************************************************************/
44
45
#ifndef LTLIB_I2C_EEPROM_H
46
#define LTLIB_I2C_EEPROM_H
47
48
#ifdef __XC8
49
#include <xc.h>
50
#endif
51
52
//*****************************************
53
// Library Test
54
//*****************************************
55
#include "
LTlib.h
"
56
57
#ifndef LTLIB_DELAY_H
58
#error The I2C_EEPROM Library requires the "delay" library to be included.
59
#endif
60
61
#ifndef LTLIB_I2C_MODULE_H
62
#error The I2C_EEPROM Library requires the "module_I2C" library to be included.
63
#endif
64
65
66
//*****************************************
67
// I2C Module Switch
68
//*****************************************
69
#define EEPROM_I2C_MODULE_1
70
//#define EEPROM_I2C_MODULE_2
71
72
#ifdef EEPROM_I2C_MODULE_1
73
#define EEPROM_I2C_open I2C1_open
74
#define EEPROM_I2C_baud_rate I2C1_baud_rate
75
#define EEPROM_I2C_wait_bus_IDLE I2C1_wait_bus_IDLE
76
#define EEPROM_I2C_start_bit I2C1_start_bit
77
#define EEPROM_I2C_stop_bit I2C1_stop_bit
78
#define EEPROM_I2C_write_byte I2C1_write_byte
79
#define EEPROM_I2C_check_bus_collision I2C1_check_bus_collision
80
#define EEPROM_I2C_check_ACK I2C1_check_ACK
81
#define EEPROM_I2C_negative_ACK I2C1_negative_ACK
82
#define EEPROM_I2C_set_master_as_receiver I2C1_set_master_as_receiver
83
#define EEPROM_I2C_read_byte I2C1_read_byte
84
#define EEPROM_I2C_restart_communication I2C1_restart_communication
85
#endif
86
87
#ifdef EEPROM_I2C_MODULE_2
88
#define EEPROM_I2C_open I2C2_open
89
#define EEPROM_I2C_baud_rate I2C2_baud_rate
90
#define EEPROM_I2C_wait_bus_IDLE I2C2_wait_bus_IDLE
91
#define EEPROM_I2C_start_bit I2C2_start_bit
92
#define EEPROM_I2C_stop_bit I2C2_stop_bit
93
#define EEPROM_I2C_write_byte I2C2_write_byte
94
#define EEPROM_I2C_check_bus_collision I2C2_check_bus_collision
95
#define EEPROM_I2C_check_ACK I2C2_check_ACK
96
#define EEPROM_I2C_negative_ACK I2C2_negative_ACK
97
#define EEPROM_I2C_set_master_as_receiver I2C2_set_master_as_receiver
98
#define EEPROM_I2C_read_byte I2C2_read_byte
99
#define EEPROM_I2C_restart_communication I2C2_restart_communication
100
#endif
101
102
115
void
I2C_EEPROM_initialize
(
unsigned
int
baud_rate_KHz);
116
#define initialize_I2C_EEPROM I2C_EEPROM_initialize
117
118
136
signed
char
I2C_EEPROM_write_byte
(
unsigned
char
control,
unsigned
int
address,
unsigned
char
data );
137
#define write_I2C_EEPROM I2C_EEPROM_write_byte
138
#define I2C_EEPROM_write I2C_EEPROM_write_byte
139
140
161
signed
char
I2C_EEPROM_write_byte_check
(
unsigned
char
control,
unsigned
int
address,
unsigned
char
data );
162
#define write_I2C_EEPROM_check I2C_EEPROM_write_byte_check
163
#define I2C_EEPROM_write_check I2C_EEPROM_write_byte_check
164
184
signed
char
I2C_EEPROM_read_byte
(
unsigned
char
control,
unsigned
int
address,
unsigned
char
*data );
185
#define read_I2C_EEPROM I2C_EEPROM_read_byte
186
#define I2C_EEPROM_read I2C_EEPROM_read_byte
187
188
#endif
LTlib_v_4.0.1
inc
I2C_EEPROM.h
Generated on Sat Mar 12 2016 11:01:40 for LTlib LaurTec Library by
1.8.3.1