Bouffalo SDK  1.0
Bouffalolab Software Development Kit
I2C
Collaboration diagram for I2C:

Modules

 i2c interrupt status definition
 
 i2c interrupt clear definition
 
 i2c interrupt enable definition
 
 i2c feature control cmd definition
 

Data Structures

struct  bflb_i2c_msg_s
 I2C message structure. More...
 

Macros

#define I2C_M_READ   0x0001 /* Read data, from slave to master */
 
#define I2C_M_TEN   0x0002 /* Ten bit address */
 
#define I2C_M_DMA   0x0004 /* Enable dma mode */
 
#define I2C_M_NOSTOP   0x0040 /* Message should not end with a STOP */
 
#define I2C_M_NOSTART   0x0080 /* Message should not begin with a START */
 

Functions

void bflb_i2c_init (struct bflb_device_s *dev, uint32_t frequency)
 Initialize i2c. More...
 
void bflb_i2c_deinit (struct bflb_device_s *dev)
 Deinitialize i2c. More...
 
void bflb_i2c_link_txdma (struct bflb_device_s *dev, bool enable)
 Enable i2c tx dma. More...
 
void bflb_i2c_link_rxdma (struct bflb_device_s *dev, bool enable)
 Enable i2c rx dma. More...
 
int bflb_i2c_transfer (struct bflb_device_s *dev, struct bflb_i2c_msg_s *msgs, int count)
 Start transferring i2c message. More...
 
void bflb_i2c_int_mask (struct bflb_device_s *dev, uint32_t int_type, bool mask)
 Enable or disable i2c interrupt. More...
 
void bflb_i2c_int_clear (struct bflb_device_s *dev, uint32_t int_clear)
 Clear i2c interrupt status. More...
 
uint32_t bflb_i2c_get_intstatus (struct bflb_device_s *dev)
 Get i2c interrupt status. More...
 
int bflb_i2c_feature_control (struct bflb_device_s *dev, int cmd, size_t arg)
 Control i2c feature. More...
 

Detailed Description

Macro Definition Documentation

◆ I2C_M_DMA

#define I2C_M_DMA   0x0004 /* Enable dma mode */

Definition at line 47 of file bflb_i2c.h.

◆ I2C_M_NOSTART

#define I2C_M_NOSTART   0x0080 /* Message should not begin with a START */

Definition at line 49 of file bflb_i2c.h.

◆ I2C_M_NOSTOP

#define I2C_M_NOSTOP   0x0040 /* Message should not end with a STOP */

Definition at line 48 of file bflb_i2c.h.

◆ I2C_M_READ

#define I2C_M_READ   0x0001 /* Read data, from slave to master */

Definition at line 45 of file bflb_i2c.h.

◆ I2C_M_TEN

#define I2C_M_TEN   0x0002 /* Ten bit address */

Definition at line 46 of file bflb_i2c.h.

Function Documentation

◆ bflb_i2c_deinit()

void bflb_i2c_deinit ( struct bflb_device_s dev)

Deinitialize i2c.

Parameters
[in]devdevice handle

◆ bflb_i2c_feature_control()

int bflb_i2c_feature_control ( struct bflb_device_s dev,
int  cmd,
size_t  arg 
)

Control i2c feature.

Parameters
[in]devdevice handle
[in]cmdfeature command
[in]arguser data
Returns
A negated errno value on failure.

◆ bflb_i2c_get_intstatus()

uint32_t bflb_i2c_get_intstatus ( struct bflb_device_s dev)

Get i2c interrupt status.

Parameters
[in]devdevice handle
Returns
interrupt status value, use i2c interrupt status definition

◆ bflb_i2c_init()

void bflb_i2c_init ( struct bflb_device_s dev,
uint32_t  frequency 
)

Initialize i2c.

Parameters
[in]devdevice handle
[in]frequencyi2c frequency, range from 305Hz to 400KHz

◆ bflb_i2c_int_clear()

void bflb_i2c_int_clear ( struct bflb_device_s dev,
uint32_t  int_clear 
)

Clear i2c interrupt status.

Parameters
[in]devdevice handle
[in]int_clearclear value, use i2c interrupt clear definition

◆ bflb_i2c_int_mask()

void bflb_i2c_int_mask ( struct bflb_device_s dev,
uint32_t  int_type,
bool  mask 
)

Enable or disable i2c interrupt.

Parameters
[in]devdevice handle
[in]int_typeinterrupt type ,use i2c interrupt enable definition
[in]masktrue means disable, false means enable

◆ bflb_i2c_link_rxdma()

void bflb_i2c_link_rxdma ( struct bflb_device_s dev,
bool  enable 
)

Enable i2c rx dma.

Parameters
[in]devdevice handle
[in]enabletrue means enable, otherwise disable.

◆ bflb_i2c_link_txdma()

void bflb_i2c_link_txdma ( struct bflb_device_s dev,
bool  enable 
)

Enable i2c tx dma.

Parameters
[in]devdevice handle
[in]enabletrue means enable, otherwise disable.

◆ bflb_i2c_transfer()

int bflb_i2c_transfer ( struct bflb_device_s dev,
struct bflb_i2c_msg_s msgs,
int  count 
)

Start transferring i2c message.

Parameters
[in]devdevice handle
[in]msgspointer to i2c message
[in]countmessage count
Returns
A negated errno value on failure.