OSDN Git Service

[SCHEMATIC] Modify SW/MW/LW Preamp, insert galbanic-isolator replace of common-mode...
[openi2cradio/OpenI2CRadio.git] / iodef_lcd.h
1 /*
2  * OpenI2CRADIO
3  * I/O Port defines / LCD.
4  * Copyright (C) 2013-08-22 K.Ohta <whatisthis.sowhat ai gmail.com>
5  * License: GPL2+LE
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2,
10  *  or (at your option) any later version.
11  *  This library / program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  *  See the GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this library; see the file COPYING. If not, write to the
18  *  Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
19  *  MA 02110-1301, USA.
20  *
21  *  As a special exception, if you link this(includeed from sdcc) library
22  *  with other files, some of which are compiled with SDCC,
23  *  to produce an executable, this library does not by itself cause
24  *  the resulting executable to be covered by the GNU General Public License.
25  *  This exception does not however invalidate any other reasons why
26  *  the executable file might be covered by the GNU General Public License.
27  */
28
29 #ifndef IODEF_LCD_H
30 #define IODEF_LCD_H
31
32 #ifdef  __cplusplus
33 extern "C" {
34 #endif
35
36
37 #define _LCD_BACKLIGHT LATC
38 #define _LCD_BACKLIGHT_BIT b1
39 #define _LCD_BACKLIGHT_TRIS TRISC
40 //#else
41 //#define _LCD_BACKLIGHT _PORTC_RC2_MASK
42 //#endif // __SDCC
43
44 #define _LCD_PORT LATC
45
46 /*
47  * LCD Control: Default register values, You should re-define in iodef.h if you need.
48  */
49
50 #ifdef _LCD_IF_4BIT
51 /*
52  * 4bit Interface, Used Below:
53  * PORTD: RD0 : RS
54  *        RD1 : RW
55  *        RD2 : EN
56  *        RD4-RD7: DATA(4-7).
57  */
58 #ifndef _LCDPORT_DATA
59 #define _LCDPORT_DATA PORTD
60 #define _LCDPORT_TRIS_DATA TRISD
61 #define _LCDPORT_LATCH_DATA LATD
62 #define _LCDPORT_BUSYMASK 0b10000000
63 #define _LCDPORT_READMASK TRIS_D_RVAL
64 #define _LCDPORT_DATA_SHIFT 4
65 #endif
66
67 #ifndef _LCDPORT_CONT
68 #define _LCDPORT_CONT PORTD
69 #define _LCDPORT_TRIS_CONT TRISD
70 #define _LCDPORT_CONT_LATCH LATD
71 #define _LCDPORT_CONT_RSbit b0
72 #define _LCDPORT_CONT_RWbit b1
73 #define _LCDPORT_CONT_ENbit b2
74 #define _LCDPORT_CONT_BLbit b3
75 #define _LCDPORT_CONT_RS LATDbits.LATD0
76 #define _LCDPORT_CONT_RW LATDbits.LATD1
77 #define _LCDPORT_CONT_EN LATDbits.LATD2
78 #endif
79
80 #else
81 /*
82  * 8bit Interface, Used Below:
83  * PORTE: RE0 : RS
84  *        RE1 : RW
85  *        RE2 : EN
86  * PORTD: RD0-RD7: DATA(0-7).
87  */
88 // 8bit I/F
89  #ifndef _LCDPORT_DATA
90 #define _LCDPORT_DATA PORTD
91 #define _LCDPORT_TRIS_DATA TRISD
92 #define _LCDPORT_LATCH_DATA LATD
93 #define _LCDPORT_BUSYMASK 0b10000000
94 #define _LCDPORT_READMASK TRIS_D_RVAL
95  #endif
96
97  #ifndef _LCDPORT_CONT
98 #define _LCDPORT_CONT PORTE
99 #define _LCDPORT_TRIS_CONT TRISE
100 #define _LCDPORT_CONT_RSbit 0
101 #define _LCDPORT_CONT_RWbit 1
102 #define _LCDPORT_CONT_ENbit 2
103 #define _LCDPORT_CONT_RS _PORTE_RE0
104 #define _LCDPORT_CONT_RW _PORTE_RE1
105 #define _LCDPORT_CONT_EN _PORTE_RE2
106 #define _LCDPORT_CONT_LATCH LATE
107  #endif
108 #endif
109
110
111 #ifdef  __cplusplus
112 }
113 #endif
114
115 #endif  /* IODEF_LCD_H */
116