📄 24c16.h
字号:
#include "gpio.h"
#define AT24C16_PORT GPIO_PORT_INDEX
#define WriteDeviceAddress 0xa0
#define ReadDviceAddress 0xa1
#define AT24C16_SEL GPIOC_SEL // 选择寄存器
#define AT24C16_CTL GPIOC_CTL // 控制寄存器
#define AT24C16_DAT GPIOC_DAT // 数据寄存器
#define AT24C16_1_SDA_H 0x80
#define AT24C16_1_SDA_L 0x7f
#define AT24C16_1_SCL_H 0x40
#define AT24C16_1_SCL_L 0xbf
#define AT24C16_2_SDA_H 0x20
#define AT24C16_2_SDA_L 0xdf
#define AT24C16_2_SCL_H 0x10
#define AT24C16_2_SCL_L 0xef
#define _nop_() { asm nop }
extern INT8U gpioc;
#define SCL_0 { \
gpioc &= at24c16_scl_l; \
outport(AT24C16_PORT, AT24C16_DAT + (gpioc<<8)); \
}
#define SCL_1 { \
gpioc |= at24c16_scl_h; \
outport(AT24C16_PORT, AT24C16_DAT + (gpioc<<8)); \
}
#define SDA_0 { \
gpioc &= at24c16_sda_l; \
outport(AT24C16_PORT, AT24C16_DAT + (gpioc<<8)); \
}
#define SDA_1 { \
gpioc |= at24c16_sda_h; \
outport(AT24C16_PORT, AT24C16_DAT + (gpioc<<8)); \
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -