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

Show/hide line numbers mbed_i2c.h Source File

mbed_i2c.h

Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003  * $Id: mbed_i2c.h $
00004  *****************************************************************************/
00005 /**
00006  *  @defgroup MBED_System_Layer MBED System Layer
00007  *  @brief  MBED System Layer APIs.
00008  *          To interface with any platform, eMPL needs access to various
00009  *          system layer functions.
00010  *
00011  *  @{
00012  *      @file       mbed_i2c.h
00013  *      @brief      Serial communication functions needed by eMPL to
00014  *                  communicate to the MPU devices.
00015  *      @details    This driver assumes that eMPL is with a sub-master clock set
00016  *                  to 20MHz. The following MBEDs are supported:
00017  */
00018 #ifndef _MBED_I2C_H_
00019 #define _MBED_I2C_H_
00020 
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 #include "i2c_api.h"
00026 
00027 void mbed_i2c_init(PinName sda, PinName scl);
00028 
00029 /**
00030  *  @brief  Set up the I2C port and configure the MBED as the master.
00031  *  @return 0 if successful.
00032  */
00033 int mbed_i2c_enable(void);
00034 /**
00035  *  @brief  Disable I2C communication.
00036  *  This function will disable the I2C hardware and should be called prior to
00037  *  entering low-power mode.
00038  *  @return 0 if successful.
00039  */
00040 int mbed_i2c_disable(void);
00041 /**
00042  *  @brief      Write to a device register.
00043  *
00044  *  @param[in]  slave_addr  Slave address of device.
00045  *  @param[in]  reg_addr    Slave register to be written to.
00046  *  @param[in]  length      Number of bytes to write.
00047  *  @param[out] data        Data to be written to register.
00048  *
00049  *  @return     0 if successful.
00050  */
00051 int mbed_i2c_write(unsigned char slave_addr,
00052                      unsigned char reg_addr,
00053                      unsigned char length,
00054                      unsigned char const *data);
00055 /**
00056  *  @brief      Read from a device.
00057  *
00058  *  @param[in]  slave_addr  Slave address of device.
00059  *  @param[in]  reg_addr    Slave register to be read from.
00060  *  @param[in]  length      Number of bytes to read.
00061  *  @param[out] data        Data from register.
00062  *
00063  *  @return     0 if successful.
00064  */
00065 int mbed_i2c_read(unsigned char slave_addr,
00066                     unsigned char reg_addr,
00067                     unsigned char length,
00068                     unsigned char *data);
00069                     
00070 #ifdef __cplusplus
00071 }
00072 #endif
00073 
00074 #endif  /* _MBED_I2C_H_ */
00075 
00076 /**
00077  * @}
00078  */