Mangue Baja Box

Dependencies:   mbed

Committer:
einsteingustavo
Date:
Mon Jul 29 20:38:00 2019 +0000
Revision:
0:0dee8840a1c0
Mangue Baja Box

Who changed what in which revision?

UserRevisionLine numberNew contents of line
einsteingustavo 0:0dee8840a1c0 1 /* mbed Microcontroller Library
einsteingustavo 0:0dee8840a1c0 2 * Copyright (c) 2006-2013 ARM Limited
einsteingustavo 0:0dee8840a1c0 3 *
einsteingustavo 0:0dee8840a1c0 4 * Licensed under the Apache License, Version 2.0 (the "License");
einsteingustavo 0:0dee8840a1c0 5 * you may not use this file except in compliance with the License.
einsteingustavo 0:0dee8840a1c0 6 * You may obtain a copy of the License at
einsteingustavo 0:0dee8840a1c0 7 *
einsteingustavo 0:0dee8840a1c0 8 * http://www.apache.org/licenses/LICENSE-2.0
einsteingustavo 0:0dee8840a1c0 9 *
einsteingustavo 0:0dee8840a1c0 10 * Unless required by applicable law or agreed to in writing, software
einsteingustavo 0:0dee8840a1c0 11 * distributed under the License is distributed on an "AS IS" BASIS,
einsteingustavo 0:0dee8840a1c0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
einsteingustavo 0:0dee8840a1c0 13 * See the License for the specific language governing permissions and
einsteingustavo 0:0dee8840a1c0 14 * limitations under the License.
einsteingustavo 0:0dee8840a1c0 15 */
einsteingustavo 0:0dee8840a1c0 16 #ifndef MBED_I2C_API_H
einsteingustavo 0:0dee8840a1c0 17 #define MBED_I2C_API_H
einsteingustavo 0:0dee8840a1c0 18
einsteingustavo 0:0dee8840a1c0 19 #include "device.h"
einsteingustavo 0:0dee8840a1c0 20
einsteingustavo 0:0dee8840a1c0 21 #if DEVICE_I2C
einsteingustavo 0:0dee8840a1c0 22
einsteingustavo 0:0dee8840a1c0 23 #ifdef __cplusplus
einsteingustavo 0:0dee8840a1c0 24 extern "C" {
einsteingustavo 0:0dee8840a1c0 25 #endif
einsteingustavo 0:0dee8840a1c0 26
einsteingustavo 0:0dee8840a1c0 27 typedef struct i2c_s i2c_t;
einsteingustavo 0:0dee8840a1c0 28
einsteingustavo 0:0dee8840a1c0 29 enum {
einsteingustavo 0:0dee8840a1c0 30 I2C_ERROR_NO_SLAVE = -1,
einsteingustavo 0:0dee8840a1c0 31 I2C_ERROR_BUS_BUSY = -2
einsteingustavo 0:0dee8840a1c0 32 };
einsteingustavo 0:0dee8840a1c0 33
einsteingustavo 0:0dee8840a1c0 34 void i2c_init (i2c_t *obj, PinName sda, PinName scl);
einsteingustavo 0:0dee8840a1c0 35 void i2c_frequency (i2c_t *obj, int hz);
einsteingustavo 0:0dee8840a1c0 36 int i2c_start (i2c_t *obj);
einsteingustavo 0:0dee8840a1c0 37 int i2c_stop (i2c_t *obj);
einsteingustavo 0:0dee8840a1c0 38 int i2c_read (i2c_t *obj, int address, char *data, int length, int stop);
einsteingustavo 0:0dee8840a1c0 39 int i2c_write (i2c_t *obj, int address, const char *data, int length, int stop);
einsteingustavo 0:0dee8840a1c0 40 void i2c_reset (i2c_t *obj);
einsteingustavo 0:0dee8840a1c0 41 int i2c_byte_read (i2c_t *obj, int last);
einsteingustavo 0:0dee8840a1c0 42 int i2c_byte_write (i2c_t *obj, int data);
einsteingustavo 0:0dee8840a1c0 43
einsteingustavo 0:0dee8840a1c0 44 #if DEVICE_I2CSLAVE
einsteingustavo 0:0dee8840a1c0 45 void i2c_slave_mode (i2c_t *obj, int enable_slave);
einsteingustavo 0:0dee8840a1c0 46 int i2c_slave_receive(i2c_t *obj);
einsteingustavo 0:0dee8840a1c0 47 int i2c_slave_read (i2c_t *obj, char *data, int length);
einsteingustavo 0:0dee8840a1c0 48 int i2c_slave_write (i2c_t *obj, const char *data, int length);
einsteingustavo 0:0dee8840a1c0 49 int i2c_slave_byte_read(i2c_t *obj, int last);
einsteingustavo 0:0dee8840a1c0 50 int i2c_slave_byte_write(i2c_t *obj, int data);
einsteingustavo 0:0dee8840a1c0 51 void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask);
einsteingustavo 0:0dee8840a1c0 52 #endif
einsteingustavo 0:0dee8840a1c0 53
einsteingustavo 0:0dee8840a1c0 54 #ifdef __cplusplus
einsteingustavo 0:0dee8840a1c0 55 }
einsteingustavo 0:0dee8840a1c0 56 #endif
einsteingustavo 0:0dee8840a1c0 57
einsteingustavo 0:0dee8840a1c0 58 #endif
einsteingustavo 0:0dee8840a1c0 59
einsteingustavo 0:0dee8840a1c0 60 #endif
einsteingustavo 0:0dee8840a1c0 61