eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mqx_iic.h
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * Copyright 2014 by Petr Gargulak. eGUI Community.
4 * Copyright 2009-2013 by Petr Gargulak. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License Version 3
9 * or later (the "LGPL").
10 *
11 * As a special exception, the copyright holders of the eGUI project give you
12 * permission to link the eGUI sources with independent modules to produce an
13 * executable, regardless of the license terms of these independent modules,
14 * and to copy and distribute the resulting executable under terms of your
15 * choice, provided that you also meet, for each linked independent module,
16 * the terms and conditions of the license of that module.
17 * An independent module is a module which is not derived from or based
18 * on this library.
19 * If you modify the eGUI sources, you may extend this exception
20 * to your version of the eGUI sources, but you are not obligated
21 * to do so. If you do not wish to do so, delete this
22 * exception statement from your version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 *
28 * You should have received a copy of the GNU General Public License
29 * and the GNU Lesser General Public License along with this program.
30 * If not, see <http://www.gnu.org/licenses/>.
31 *
32 ***************************************************************************/
42 #ifndef _MQX_I2C_H
43 #define _MQX_I2C_H
44 
45 // copilation enable preprocessor condition
46 // the string d4dtch_k70_lcdc_ID must be replaced by define created one line up
47 #if (D4D_MK_STR(D4D_LLD_TCH_HW_CRTOUCH) == d4dtchhw_crtouch_iicMqx_ID)
48 
49  /******************************************************************************
50  * Constants
51  ******************************************************************************/
52 #ifndef I2C_OK
53  #define I2C_OK 0
54 #endif
55  #define I2C_FALSE 1
56  #define I2C_ACK I2C_OK
57  #define I2C_NACK 2
58 
59 
60  /******************************************************************************
61  * Macros
62  ******************************************************************************/
63 
64  #ifndef MQX_I2C_DEV
65  #define MQX_I2C_DEV "i2c0:"
66  #endif
67 
68  /******************************************************************************
69  * Types
70  ******************************************************************************/
71  typedef union
72  {
74  struct
75  {
78  }b;
80 
81  /******************************************************************************
82  * Global functions
83  ******************************************************************************/
84 
85  // Init Denit functions
86  Byte MqxIIC_Init(void);
87  Byte MqxIIC_DeInit(void);
88  // Address related functions
89  void MqxIIC_SetAddress(Byte address);
90  Byte MqxIIC_GetAddress(void);
91  // Single Byte read Write functions - 8 bit device address mode
92  Byte MqxIIC_ReadByte(Byte regAdr, Byte* pData);
93  Byte MqxIIC_WriteByte(Byte regAdr, Byte data);
94  // Multi Byte read Write functions - 8 bit device address mode
95  Byte MqxIIC_MultiReadBytes(Byte regAdr, Byte *pData, Byte cnt);
96  Byte MqxIIC_MultiWriteBytes(Byte regAdr, Byte *pData, Byte cnt);
97  Byte MqxIIC_ReadArrayDelayed(Byte regAdr, Byte* pData, Byte cnt, Word attemps);
98  // Single Byte read Write functions - 16 bit device address mode
99  Byte MqxIIC_ReadByte16(I2C_WORD_BYTE regAdr, Byte* pData);
101  // Multi Byte read Write functions - 16 bit device address mode
102  Byte MqxIIC_MultiReadBytes16(I2C_WORD_BYTE regAdr, Byte *pData, Byte cnt);
103  Byte MqxIIC_MultiWriteBytes16(I2C_WORD_BYTE regAdr, Byte *pData, Byte cnt);
104 
105  //Help functions
107  sLWord MqxIIC_SetBaudRate(LWord baudRate);
108 
109 
110  #endif
111 #endif
signed long sLWord
Type definition of sLWord (signed 32-bit).
Definition: d4d_types.h:171
Byte MqxIIC_ReadByte16(I2C_WORD_BYTE regAdr, Byte *pData)
Byte MqxIIC_WriteByte16(I2C_WORD_BYTE regAdr, Byte data)
Byte MqxIIC_MultiReadBytes16(I2C_WORD_BYTE regAdr, Byte *pData, Byte cnt)
Byte MqxIIC_LookForDevice(Byte adr)
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
unsigned long LWord
Type definition of LWord (unsigned 32-bit).
Definition: d4d_types.h:167
Byte MqxIIC_ReadArrayDelayed(Byte regAdr, Byte *pData, Byte cnt, Word attemps)
Byte MqxIIC_DeInit(void)
Byte MqxIIC_GetAddress(void)
Byte MqxIIC_WriteByte(Byte regAdr, Byte data)
Byte MqxIIC_ReadByte(Byte regAdr, Byte *pData)
Byte MqxIIC_MultiWriteBytes16(I2C_WORD_BYTE regAdr, Byte *pData, Byte cnt)
Byte MqxIIC_MultiWriteBytes(Byte regAdr, Byte *pData, Byte cnt)
Byte MqxIIC_MultiReadBytes(Byte regAdr, Byte *pData, Byte cnt)
unsigned short Word
Type definition of Word (unsigned 16-bit).
Definition: d4d_types.h:159
Byte MqxIIC_Init(void)
void MqxIIC_SetAddress(Byte address)
sLWord MqxIIC_SetBaudRate(LWord baudRate)