You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
814 B
48 lines
814 B
#ifndef __STM32_IIC_H__
|
|
#define __STM32_IIC_H__
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "config.h"
|
|
|
|
typedef struct iic_descr * iic_t;
|
|
|
|
/*
|
|
* enable the i2c with speed.
|
|
*/
|
|
int iic_setup(iic_t i2c, int speed);
|
|
|
|
/* close the iic object */
|
|
void iic_close(iic_t i2c);
|
|
|
|
/* send start condition */
|
|
int iic_start(iic_t i2c);
|
|
|
|
/* send stop condition */
|
|
int iic_stop(iic_t i2c);
|
|
|
|
/* enable / disable ack */
|
|
int iic_ack(iic_t i2c, int enable);
|
|
|
|
/* start slave address (8bits address with r/#w bit) */
|
|
int iic_send_slave_address(iic_t i2c, uint8_t address);
|
|
|
|
/* send 8bit data */
|
|
int iic_send_byte(iic_t i2c, uint8_t data);
|
|
|
|
uint8_t iic_recv_byte(iic_t i2c);
|
|
|
|
#if (TARGET_HAS_I2C1)
|
|
extern struct iic_descr i2c0;
|
|
#endif
|
|
|
|
#if (TARGET_HAS_I2C3)
|
|
extern struct iic_descr i2c2;
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
|