lcd dimensions from configure
[kugel-rb.git] / firmware / export / generic_i2c.h
blobf71736acf0e7341f032cbe5d2dddc1e6d8ebb10c
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _GEN_I2C_
22 #define _GEN_I2C_
24 #include <stdbool.h>
26 struct i2c_interface
28 void (*scl_dir)(bool out); /* Set SCL as input or output */
29 void (*sda_dir)(bool out); /* Set SDA as input or output */
30 void (*scl_out)(bool high); /* Drive SCL, might sleep on clk stretch */
31 void (*sda_out)(bool high); /* Drive SDA */
32 bool (*scl_in)(void); /* Read SCL, returns true if high */
33 bool (*sda_in)(void); /* Read SDA, returns true if high */
34 void (*delay)(int delay); /* Delay for the specified amount */
36 /* These are the delays specified in the I2C specification, the
37 time pairs to the right are the minimum 100kHz and 400kHz specs */
38 int delay_hd_sta; /* START SDA hold (tHD:SDA) 4.0us/0.6us */
39 int delay_hd_dat; /* SDA hold (tHD:DAT) 5.0us/0us */
40 int delay_su_dat; /* SDA setup (tSU:DAT) 250ns/100ns */
41 int delay_su_sto; /* STOP setup (tSU:STO) 4.0us/0.6us */
42 int delay_su_sta; /* Rep. START setup (tSU:STA) 4.7us/0.6us */
43 int delay_thigh; /* SCL high period (tHIGH) 4.0us/0.6us */
46 int i2c_add_node(const struct i2c_interface *iface);
47 int i2c_write_data(int bus_index, int bus_address, int address,
48 const unsigned char* buf, int count);
49 int i2c_read_data(int bus_index, int bus_address, int address,
50 unsigned char* buf, int count);
52 #endif /* _GEN_I2C_ */