YUFEI JIANG / Mbed 2 deprecated CSSE4011_BLE_IMU

Dependencies:   BLE_API_Tiny_BLE MPU6050-DMP-Seeed-Tiny-BLE mbed

Embed: (wiki syntax)

« Back to documentation index

MBED System Layer

MBED System Layer

MBED System Layer APIs. More...

Files

file  mbed_i2c.h
 

Serial communication functions needed by eMPL to communicate to the MPU devices.


Functions

int mbed_i2c_enable (void)
 Set up the I2C port and configure the MBED as the master.
int mbed_i2c_disable (void)
 Disable I2C communication.
int mbed_i2c_write (unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char const *data)
 Write to a device register.
int mbed_i2c_read (unsigned char slave_addr, unsigned char reg_addr, unsigned char length, unsigned char *data)
 Read from a device.

Detailed Description

MBED System Layer APIs.

To interface with any platform, eMPL needs access to various system layer functions.


Function Documentation

int mbed_i2c_disable ( void   )

Disable I2C communication.

This function will disable the I2C hardware and should be called prior to entering low-power mode.

Returns:
0 if successful.
int mbed_i2c_enable ( void   )

Set up the I2C port and configure the MBED as the master.

Returns:
0 if successful.
int mbed_i2c_read ( unsigned char  slave_addr,
unsigned char  reg_addr,
unsigned char  length,
unsigned char *  data 
)

Read from a device.

Parameters:
[in]slave_addrSlave address of device.
[in]reg_addrSlave register to be read from.
[in]lengthNumber of bytes to read.
[out]dataData from register.
Returns:
0 if successful.

Definition at line 29 of file mbed_i2c.c.

int mbed_i2c_write ( unsigned char  slave_addr,
unsigned char  reg_addr,
unsigned char  length,
unsigned char const *  data 
)

Write to a device register.

Parameters:
[in]slave_addrSlave address of device.
[in]reg_addrSlave register to be written to.
[in]lengthNumber of bytes to write.
[out]dataData to be written to register.
Returns:
0 if successful.

Definition at line 12 of file mbed_i2c.c.