amiro-lld / include / alld_at24c01bn-sh-b.h @ d6728c5b
History | View | Annotate | Download (3.03 KB)
1 |
/*
|
---|---|
2 |
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
|
3 |
Copyright (C) 2016..2018 Thomas Schöpping et al.
|
4 |
|
5 |
This program is free software: you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License as published by
|
7 |
the Free Software Foundation, either version 3 of the License, or
|
8 |
(at your option) any later version.
|
9 |
|
10 |
This program is distributed in the hope that it will be useful,
|
11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
GNU General Public License for more details.
|
14 |
|
15 |
You should have received a copy of the GNU General Public License
|
16 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
*/
|
18 |
|
19 |
#ifndef _AMIROLLD_AT24C01BN_H_
|
20 |
#define _AMIROLLD_AT24C01BN_H_
|
21 |
|
22 |
#include <amiro-lld.h> |
23 |
|
24 |
#if defined(AMIROLLD_CFG_USE_AT24C01BN) || defined(__DOXYGEN__)
|
25 |
|
26 |
/**
|
27 |
* @brief Memory size of the EEPROM in bits.
|
28 |
*/
|
29 |
#define AT24C01BN_LLD_SIZE_BITS 1024 |
30 |
|
31 |
/**
|
32 |
* @brief Memory size of the EEPROM in bytes
|
33 |
*/
|
34 |
#define AT24C01BN_LLD_SIZE_BYTES 128 |
35 |
|
36 |
|
37 |
/**
|
38 |
* @brief Size of a page in bytes
|
39 |
*/
|
40 |
#define AT24C01BN_LLD_PAGE_SIZE_BYTES 8 |
41 |
|
42 |
/**
|
43 |
* @brief Time in microseconds a write operation takes to complete (I2C will not respond).
|
44 |
* @note The system should wait slightly longer.
|
45 |
*/
|
46 |
#define AT24C01BN_LLD_WRITECYCLETIME_US 5000 |
47 |
|
48 |
/**
|
49 |
* @brief Maximum I2C frequency.
|
50 |
*/
|
51 |
#define AT24C01BN_LLD_I2C_MAXFREQUENCY 400000 |
52 |
|
53 |
/**
|
54 |
* @brief Maximum I2C frequency at 5V.
|
55 |
*/
|
56 |
#define AT24C01BN_LLD_I2C_MAXFREQUENCY_5V 1000000 |
57 |
|
58 |
/**
|
59 |
* @brief The AT24C01BN driver struct
|
60 |
*/
|
61 |
typedef struct { |
62 |
apalI2CDriver_t* i2cd; /**< @brief The I2C Driver */
|
63 |
uint8_t addr; /**< @brief The address of the AT24C01B for I2C communication, which is defined by the wiring of the A0, A1, A2 pins */
|
64 |
} AT24C01BNDriver; |
65 |
|
66 |
/**
|
67 |
* @brief Bitmasks for the I2C address, including the wiring of the A0, A1, A2 pins.
|
68 |
*/
|
69 |
enum {
|
70 |
AT24C01BN_LLD_I2C_ADDR_FIXED = 0x50u,
|
71 |
AT24C01BN_LLD_I2C_ADDR_A0 = 0x01u,
|
72 |
AT24C01BN_LLD_I2C_ADDR_A1 = 0x02u,
|
73 |
AT24C01BN_LLD_I2C_ADDR_A2 = 0x04u,
|
74 |
}; |
75 |
|
76 |
#ifdef __cplusplus
|
77 |
extern "C" { |
78 |
#endif
|
79 |
apalExitStatus_t at24c01bn_lld_poll_ack(const AT24C01BNDriver* const at24c01bn, const apalTime_t timeout); |
80 |
apalExitStatus_t at24c01bn_lld_read_current_address(const AT24C01BNDriver* const at24c01bn, uint8_t* const data, const uint8_t num, const apalTime_t timeout); |
81 |
apalExitStatus_t at24c01bn_lld_read(const AT24C01BNDriver* const at24c01bn, const uint8_t addr, uint8_t* const data, const uint8_t num, const apalTime_t timeout); |
82 |
apalExitStatus_t at24c01bn_lld_write_byte(const AT24C01BNDriver* const at24c01bn, const uint8_t addr, const uint8_t data, const apalTime_t timeout); |
83 |
apalExitStatus_t at24c01bn_lld_write_page(const AT24C01BNDriver* const at24c01bn, const uint8_t addr, const uint8_t* const data, const uint8_t num, const apalTime_t timeout); |
84 |
#ifdef __cplusplus
|
85 |
} |
86 |
#endif
|
87 |
|
88 |
#endif /* defined(AMIROLLD_CFG_USE_AT24C01BN) */ |
89 |
|
90 |
#endif /* _AMIROLLD_AT24C01BN_H_ */ |
91 |
|