PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
Dependents: YATTT sd_map_test cPong SnowDemo ... more
Macros_LCD.h
00001 /**************************************************************************/ 00002 /*! 00003 @file Macros_LCD.h 00004 @author Jonne Valola 00005 00006 @section LICENSE 00007 00008 Software License Agreement (BSD License) 00009 00010 Copyright (c) 2015, Jonne Valola 00011 All rights reserved. 00012 00013 Redistribution and use in source and binary forms, with or without 00014 modification, are permitted provided that the following conditions are met: 00015 1. Redistributions of source code must retain the above copyright 00016 notice, this list of conditions and the following disclaimer. 00017 2. Redistributions in binary form must reproduce the above copyright 00018 notice, this list of conditions and the following disclaimer in the 00019 documentation and/or other materials provided with the distribution. 00020 3. Neither the name of the copyright holders nor the 00021 names of its contributors may be used to endorse or promote products 00022 derived from this software without specific prior written permission. 00023 00024 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 00025 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00026 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 00028 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00029 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00031 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00033 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 /**************************************************************************/ 00036 00037 #ifndef LCDMACROS_H 00038 #define LCDMACROS_H 00039 00040 /**************************************************************************/ 00041 /** PINS AND PORTS **/ 00042 /**************************************************************************/ 00043 00044 #if POK_BOARDREV == 1 00045 /** 2-layer board version 1.3 **/ 00046 #define LCD_CD_PORT 0 00047 #define LCD_CD_PIN 2 00048 #define LCD_WR_PORT 1 00049 #define LCD_WR_PIN 23 00050 #define LCD_RD_PORT 1 00051 #define LCD_RD_PIN 24 00052 #define LCD_RES_PORT 1 00053 #define LCD_RES_PIN 28 00054 #else 00055 /** 4-layer board version 2.1 **/ 00056 #define LCD_CD_PORT 0 00057 #define LCD_CD_PIN 2 00058 #define LCD_WR_PORT 1 00059 #define LCD_WR_PIN 12 00060 #define LCD_RD_PORT 1 00061 #define LCD_RD_PIN 24 00062 #define LCD_RES_PORT 1 00063 #define LCD_RES_PIN 0 00064 #endif 00065 00066 /**************************************************************************/ 00067 /** LCD CONTROL MACROS **/ 00068 /**************************************************************************/ 00069 00070 #define CLR_RESET LPC_GPIO_PORT->CLR[LCD_RES_PORT] = 1 << LCD_RES_PIN; //RST = (0); // Clear pin 00071 #define SET_RESET LPC_GPIO_PORT->SET[LCD_RES_PORT] = 1 << LCD_RES_PIN; // RST = (1); // Set pin 00072 00073 #define CLR_CD LPC_GPIO_PORT->CLR[LCD_CD_PORT] = 1 << LCD_CD_PIN; // RS = (0); // Clear pin 00074 #define SET_CD LPC_GPIO_PORT->SET[LCD_CD_PORT] = 1 << LCD_CD_PIN; // RS = (1); // Set pin 00075 00076 #define CLR_WR { LPC_GPIO_PORT->CLR[LCD_WR_PORT] = 1 << LCD_WR_PIN; __asm("nop");}//WR = (0); // Clear pin 00077 #define SET_WR LPC_GPIO_PORT->SET[LCD_WR_PORT] = 1 << LCD_WR_PIN; //WR = (1); // Set pin 00078 00079 #define CLR_RD LPC_GPIO_PORT->CLR[LCD_RD_PORT] = 1 << LCD_RD_PIN; //RD = (0); // Clear pin 00080 #define SET_RD LPC_GPIO_PORT->SET[LCD_RD_PORT] = 1 << LCD_RD_PIN; //RD = (1); // Set pin 00081 00082 #define SET_CS //CS tied to ground 00083 #define CLR_CS 00084 00085 #define CLR_CS_CD_SET_RD_WR {CLR_CD; SET_RD; SET_WR;} 00086 #define CLR_CS_SET_CD_RD_WR {SET_CD; SET_RD; SET_WR;} 00087 #define SET_CD_RD_WR {SET_CD; SET_RD; SET_WR;} 00088 #define SET_WR_CS SET_WR; 00089 00090 #define SET_MASK_P2 LPC_GPIO_PORT->MASK[2] = ~(0x7FFF8); //mask P2_3 ...P2_18 00091 #define CLR_MASK_P2 LPC_GPIO_PORT->MASK[2] = 0; // all on 00092 00093 /**************************************************************************/ 00094 /** OTHER MACROS **/ 00095 /**************************************************************************/ 00096 00097 #define write_command w_cmd_16 00098 #define write_data w_data_16 00099 00100 #define AB_JUMP 1024 // jump one 1-bit Arduboy screen forward to get next color bit 00101 #define GB_JUMP 504 // jump one 1-bit Gamebuino screen forward to get next color bit 00102 00103 #endif // LCDMACROS_H 00104 00105
Generated on Tue Jul 12 2022 11:20:33 by 1.7.2