SDK4.0 This document shows Ameba SDK 4.0 APIs

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

i2c_api.h File Reference

This file provides following mbed I2C API. More...

`#include "device.h"`

## Functions
AmebaZ Only
int | i2c_repeatread (i2c_t *obj, int address, u8 *pWriteBuf, int Writelen, u8 *pReadBuf, int Readlen)
| I2C master send data and read data in poll mode. More...

## Ameba Common
enum | { I2C_ERROR_NO_SLAVE = -1, I2C_ERROR_BUS_BUSY = -2 }
typedef struct i2c_s | i2c_t
void | i2c_init (i2c_t *obj, PinName sda, PinName scl)
| Initializes the I2C device, include clock/function/I2C registers. More...
void | i2c_frequency (i2c_t *obj, int hz)
| Set i2c frequency. More...
int | i2c_start (i2c_t *obj)
| Start i2c device. More...
int | i2c_stop (i2c_t *obj)
| Stop i2c device. More...
void | i2c_reset (i2c_t *obj)
| Deinitializes the I2C device. More...
int | i2c_byte_read (i2c_t *obj, int last)
| I2C master receive single byte. More...
int | i2c_byte_write (i2c_t *obj, int data)
| I2C master send single byte. More...
void | i2c_slave_mode (i2c_t *obj, int enable_slave)
| Set i2c device to be slave. More...
int | i2c_slave_receive (i2c_t *obj)
| Get i2c slave state. More...
void | i2c_slave_address (i2c_t *obj, int idx, uint32_t address, uint32_t mask)
| Set i2c slave address. More...
int | i2c_read (i2c_t *obj, int address, char *data, int length, int stop)
| I2C master read in poll mode. More...
int | i2c_write (i2c_t *obj, int address, const char *data, int length, int stop)
| I2C master write in poll mode. More...
int | i2c_slave_read (i2c_t *obj, char *data, int length)
| I2C slave read in poll mode. More...
int | i2c_slave_write (i2c_t *obj, const char *data, int length)
| I2C slave write in poll mode. More...
int | i2c_slave_set_for_rd_req (i2c_t *obj, int set)
| Set/clear i2c slave RD_REQ interrupt mask. More...
int | i2c_slave_set_for_data_nak (i2c_t *obj, int set_nak)
| Set/clear i2c slave NAK or ACK data part in transfer. More...

## Detailed Description

This file provides following mbed I2C API.

mbed Microcontroller Library

Author

Version
  V1.0.0

Attention

Copyright (c) 2006-2013 ARM Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.