hal_i2c.h
来自「最新版IAR FOR ARM(EWARM)5.11中的代码例子」· C头文件 代码 · 共 54 行
H
54 行
/**********************************************************************************/
/* */
/* Copyright (C) 2006 Oki Electric Industry Co., LTD. */
/* */
/* System Name : ML675050 series */
/* Module Name : ML675050 system I2C-common definition include file */
/* File Name : hal_i2c.h */
/* Revision : 01.00 */
/* Date : 2006/1/27 initial version */
/* */
/**********************************************************************************/
#ifndef HAL_I2C_H
#define HAL_I2C_H
/***********************************/
/* type definition */
/***********************************/
#define FARST_MODE (0x0001) /* Fast-mode(400kHz) */
#define STANDARD_MODE (0x0000) /* Standard-mode(100kHz) */
#define WRITE_FLAG (0x0000) /* write flag */
#define READ_FLAG (0x0001) /* read flag */
#define CHANNEL_0 (0x0000) /* channel 0 */
#define CHANNEL_1 (0x0001) /* channel 1 */
#define MASTER_MODE (0x0000) /* Master mode */
#define SLAVE_MODE (0x0001) /* SLAVE mode */
#define HAL_I2C_OK (1) /* I2C No error */
#define HAL_I2C_BUS_ERROR (-101) /* I2C bus error */
#define HAL_I2C_ACK_ERROR (-102) /* I2C ACK error */
#define HAL_I2C_DIRECT_ERROR (-103) /* I2C DIRECT error */
#define HAL_I2C_DATA_ACK_ERROR (-104) /* I2C Data ACK error */
#define HAL_I2C_ADDR_ACK_ERROR (-105) /* I2C Address ACK error */
#define HAL_I2C_OTHER_ERROR (-199) /* I2C other error */
#define HAL_I2C_ACK (1) /* I2C ACK */
#define HAL_I2C_NO_ACK (2) /* I2C NO ACK */
#define HAL_I2C_NO_FREE_BUS (3) /* I2C NO FREE BUS */
#define HAL_I2C_MCF (4) /* I2C complete transmit */
#define HAL_I2C_STP (5) /* I2C Slave complete transmit */
/***********************************/
/* API Functions prototype */
/***********************************/
int16_t HalI2c_i2cInit( struct ml675050_i2cParam *param );
int16_t HalI2c_i2cMasTxDataStart(uint8_t *data, uint8_t scl_out);
int16_t HalI2c_i2cSlvRxDataStart(uint8_t *data);
int16_t HalI2c_i2cMasTxDataEnd(uint8_t *data);
int16_t HalI2c_i2cSlvRxDataEnd(uint8_t *data);
int16_t HalI2c_i2cMasReRxData(uint8_t *data);
int16_t HalI2c_i2cSlvReTxData(uint8_t *data);
#endif /* HAL_I2C_H */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?