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