FRDM-K64F, Avnet M14A2A, Grove Shield, to create smart home system. In use with AT&Ts M2x & Flow.

Dependencies:   mbed FXOS8700CQ MODSERIAL

Committer:
jwhammel
Date:
Mon Apr 29 04:24:38 2019 +0000
Revision:
85:0cf65ceb4492
Parent:
84:fc8c9b39723a
We have added an alarm trigger that gets sent to AT&T Flow.

Who changed what in which revision?

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