GLCD Library
A C Library for Embedded Applications
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
LPC111x.h
Go to the documentation of this file.
1 
7 /*
8 
9  Copyright (c) 2012 Andy Gock
10 
11  Permission is hereby granted, free of charge, to any person obtaining
12  a copy of this software and associated documentation files (the
13  "Software"), to deal in the Software without restriction, including
14  without limitation the rights to use, copy, modify, merge, publish,
15  distribute, sublicense, and/or sell copies of the Software, and to
16  permit persons to whom the Software is furnished to do so, subject to
17  the following conditions:
18 
19  The above copyright notice and this permission notice shall be
20  included in all copies or substantial portions of the Software.
21 
22  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 
30  */
31 
32 #ifndef LPC111X_H_
33 #define LPC111X_H_
34 
35 #if defined(GLCD_DEVICE_LPC111X)
36 
37 /*
38  * Set up SSP and GPIO drivers (GPIO drivers required for SSP)
39  * Change these paths if the files are located elsewhere
40  */
41 #include "../../drivers/ssp.h"
42 #include "../../drivers/gpio.h"
43 
44 #define swap(a, b) { uint8_t t = a; a = b; b = t; }
45 
46 /* Define port and pins used to connecto LCD */
47 #define CONTROLLER_SPI_PORT_NUMBER 1
48 #define CONTROLLER_MOSI_PORT LPC_GPIO2
49 #define CONTROLLER_MOSI_PIN 3
50 #define CONTROLLER_MISO_PORT LPC_GPIO2
51 #define CONTROLLER_MISO_PIN 2
52 #define CONTROLLER_SCK_PORT LPC_GPIO2
53 #define CONTROLLER_SCK_PIN 1
54 #define CONTROLLER_SS_PORT LPC_GPIO2
55 #define CONTROLLER_SS_PIN 0
56 #define CONTROLLER_DC_PORT LPC_GPIO2
57 #define CONTROLLER_DC_PIN 4
58 #define CONTROLLER_RST_PORT LPC_GPIO2
59 #define CONTROLLER_RST_PIN 5
60 
61 /* Preprocessor macros */
62 #define GLCD_SELECT() CONTROLLER_SS_PORT->DATA &= ~(1 << CONTROLLER_SS_PIN)
63 #define GLCD_DESELECT() CONTROLLER_SS_PORT->DATA |= (1 << CONTROLLER_SS_PIN)
64 #define GLCD_DC_LOW() CONTROLLER_DC_PORT->DATA &= ~(1 << CONTROLLER_DC_PIN)
65 #define GLCD_DC_HIGH() CONTROLLER_DC_PORT->DATA |= (1 << CONTROLLER_DC_PIN)
66 #define GLCD_RESET_LOW() CONTROLLER_RST_PORT->DATA &= ~(1 << CONTROLLER_RST_PIN)
67 #define GLCD_RESET_HIGH() CONTROLLER_RST_PORT->DATA |= (1 << CONTROLLER_RST_PIN)
68 
69 #endif /* GLCD_DEVICE_LPC111X */
70 
71 #endif /* LPC111X_H_ */