i2c.h

来自「H9200F(2.6.12)的音频接口驱动。 操作方法: 1、将驱动程」· C头文件 代码 · 共 44 行

H
44
字号
/*    i2c Support for Atmel's AT91RM9200 Two-Wire Interface    (c) Rick Bronson    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*/#ifndef AT91RM9200_I2C_H#define AT91RM9200_I2C_H#define AT91C_TWI_CLOCK         100000#define AT91C_TWI_SCLOCK        (10 * AT91C_MASTER_CLOCK / AT91C_TWI_CLOCK)//#define AT91C_TWI_CKDIV1        (1 << 16)       /* TWI clock divider */#define AT91C_TWI_CKDIV1        (2 << 16)	/* TWI clock divider */#if (AT91C_TWI_SCLOCK % 10) >= 5#define AT91C_TWI_CLDIV2 ((AT91C_TWI_SCLOCK / 10) - 5)#else#define AT91C_TWI_CLDIV2 ((AT91C_TWI_SCLOCK / 10) - 6)#endif#define AT91C_TWI_CLDIV3 ((AT91C_TWI_CLDIV2 + (4 - AT91C_TWI_CLDIV2 % 4)) >> 2)#define AT91C_EEPROM_I2C_ADDRESS        (0x50 << 16)extern void port_init_I2C(void);extern int I2C_write(char reg_address, unsigned short data_out, int);extern int I2C_read(char reg_address, unsigned short *data_in, int);extern unsigned int I2C_test(void);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?