Subversion Repositories idreammicro-avr

Rev

Rev 46 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
45 jlesech 1
/**************************************************************************//**
2
 * \brief EEPROM 24C512 library.
3
 * \author Copyright (C) 2012  Julien Le Sech - www.idreammicro.com
4
 * \version 1.0
5
 * \date 20121031
6
 *
7
 * This file is part of the iDreamMicro library.
8
 *
9
 * This library is free software: you can redistribute it and/or modify it under
10
 * the terms of the GNU Lesser General Public License as published by the Free
11
 * Software Foundation, either version 3 of the License, or (at your option) any
12
 * later version.
13
 *
14
 * This library is distributed in the hope that it will be useful, but WITHOUT
15
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17
 * details.
18
 *
19
 * You should have received a copy of the GNU Lesser General Public License
20
 * along with this program. If not, see http://www.gnu.org/licenses/
21
 ******************************************************************************/
22
 
23
/**************************************************************************//**
24
 * \headerfile eeprom_24c512.h
25
 ******************************************************************************/
26
 
27
#ifndef H__IDREAMMICRO__EEPROM_24C512__H
28
#define H__IDREAMMICRO__EEPROM_24C512__H
29
 
30
#ifdef _cplusplus
31
extern "C"{
32
#endif
33
 
34
/******************************************************************************
35
 * Header file inclusion.
36
 ******************************************************************************/
37
 
38
#include <stdint.h>
39
 
40
/******************************************************************************
41
 * Public macro definitions.
42
 ******************************************************************************/
43
 
44
/**************************************************************************//**
45
 * \def     EEPROM_24C512__CLOCK_RATE
46
 * \brief   24C512 frequency in Hertz.
47
 * On ATmega, can be 100 kHz or 400 Khz.
48
 ******************************************************************************/
49
#define EEPROM_24C512__CLOCK_RATE   100000
50
 
51
/******************************************************************************
52
 * Public function prototypes.
53
 ******************************************************************************/
54
 
55
/**************************************************************************//**
56
 * \fn void eeprom_24c512__initialize(uint8_t hardware_address)
57
 *
58
 * \brief Initialize EEPROM 24C512.
59
 *
48 jlesech 60
 * \param hardware_address Hardware address. Pins A0 to A1.
45 jlesech 61
 ******************************************************************************/
62
void
63
eeprom_24c512__initialize
64
(
65
    uint8_t hardware_address
66
);
67
 
68
/**************************************************************************//**
69
 * \fn void eeprom_24c512__write_byte(uint16_t address, uint8_t data)
70
 *
71
 * \brief Write a byte into memory.
72
 *
73
 * \param   address Address in memory.
74
 * \param   data    Byte to write.
75
 ******************************************************************************/
76
void
77
eeprom_24c512__write_byte
78
(
79
    uint16_t    address,
80
    uint8_t     data
81
);
82
 
83
/**************************************************************************//**
84
 * \fn void eeprom_24c512__write_bytes(
85
 * uint16_t address,
86
 * uint16_t length,
87
 * uint8_t* p_data)
88
 *
89
 * \brief Write bytes into memory.
90
 *
91
 * \param       address Start address.
92
 * \param       length  Number of bytes to write.
93
 * \param[in]   p_data  Bytes to write.
94
 ******************************************************************************/
95
void
96
eeprom_24c512__write_bytes
97
(
98
    uint16_t    address,
99
    uint16_t    length,
100
    uint8_t*    p_data
101
);
102
 
103
/**************************************************************************//**
104
 * \fn uint8_t eeprom_24c512__read_byte(uint16_t address)
105
 *
106
 * \brief Read a byte in memory.
107
 *
108
 * \param address   Address to read.
109
 *
110
 * \return Read byte.
111
 ******************************************************************************/
112
uint8_t
113
eeprom_24c512__read_byte
114
(
115
    uint16_t address
116
);
117
 
118
/**************************************************************************//**
119
 * \fn void eeprom_24c512__read_bytes(
120
 * uint16_t address,
121
 * uint16_t length,
122
 * uint8_t* p_data)
123
 *
124
 * \brief Read bytes in memory.
125
 *
126
 * \param       address Start address of data to read.
127
 * \param       length  Number of bytes to read.
128
 * \param[in]   p_data  Buffer to fill with read bytes.
129
 ******************************************************************************/
130
void
131
eeprom_24c512__read_bytes
132
(
133
    uint16_t    address,
134
    uint16_t    length,
135
    uint8_t*    p_data
136
);
137
 
138
#ifdef _cplusplus
139
}
140
#endif
141
 
142
#endif /* H__IDREAMMICRO__EEPROM_24C512__H */