GlobLib
HAL and API libraries for MCUs and hardware.
at24c256.h
Go to the documentation of this file.
1 
43 #ifndef AT24C256_H_
44 #define AT24C256_H_
45 #include <stdio.h>
46 
50 #define AT24C256_DEVICE_ADDRESS 0xA0
51 #define AT24C256_DEVICE_ADDRESS_ALT_1 0xA2
52 #define AT24C256_DEVICE_ADDRESS_ALT_2 0xA4
53 #define AT24C256_DEVICE_ADDRESS_ALT_3 0xA6
54 
55 #define AT24C256_PAGE_SIZE 64
56 #define AT24C256_PAGE_NUMBER 512
57 #define AT24C256_BYTE_NUMBER AT24C256_PAGE_SIZE*AT24C256_PAGE_NUMBER
58 
59 
60 typedef struct{
61 
65  uint8_t bus;
66  uint8_t address;
67 
68 }AT24C256;
69 
70 
80 void AT24C256_setup(AT24C256 *target, uint8_t i2c_number, uint8_t address);
81 
82 void AT24C256_writeByte(AT24C256 *target, uint16_t address, uint8_t byte);
83 
84 uint8_t AT24C256_readByte(AT24C256 *target, uint16_t address);
85 
88 #endif
89 
void AT24C256_setup(AT24C256 *target, uint8_t i2c_number, uint8_t address)
Initalizes the slave device and populates data structure variable.
Definition: at24c256.c:31
uint8_t bus
The I2C bus which the device is connected to.
Definition: at24c256.h:65