PokittoLib with changes to lcd refresh etc.
Fork of Pokitto by
This is a fork by user @Spinal, and is used in Pokittris for testing. Do not import this to your own program.
POKITTO_HW/HWLCD.cpp@10:8cde5d0bafad, 2017-10-15 (annotated)
- Committer:
- spinal
- Date:
- Sun Oct 15 16:50:56 2017 +0000
- Revision:
- 10:8cde5d0bafad
- Parent:
- 9:570fdd653f1d
- Child:
- 11:02ad9c807a21
updated the draw routines a little in pokitto lib, I hope it didn't break anything else
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pokitto | 0:e8b8f36b4505 | 1 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 2 | /*! |
Pokitto | 0:e8b8f36b4505 | 3 | @file HWLCD.cpp |
Pokitto | 0:e8b8f36b4505 | 4 | @author Jonne Valola |
Pokitto | 0:e8b8f36b4505 | 5 | |
Pokitto | 0:e8b8f36b4505 | 6 | @section LICENSE |
Pokitto | 0:e8b8f36b4505 | 7 | |
Pokitto | 0:e8b8f36b4505 | 8 | Software License Agreement (BSD License) |
Pokitto | 0:e8b8f36b4505 | 9 | |
Pokitto | 0:e8b8f36b4505 | 10 | Copyright (c) 2016, Jonne Valola |
Pokitto | 0:e8b8f36b4505 | 11 | All rights reserved. |
Pokitto | 0:e8b8f36b4505 | 12 | |
Pokitto | 0:e8b8f36b4505 | 13 | Redistribution and use in source and binary forms, with or without |
Pokitto | 0:e8b8f36b4505 | 14 | modification, are permitted provided that the following conditions are met: |
Pokitto | 0:e8b8f36b4505 | 15 | 1. Redistributions of source code must retain the above copyright |
Pokitto | 0:e8b8f36b4505 | 16 | notice, this list of conditions and the following disclaimer. |
Pokitto | 0:e8b8f36b4505 | 17 | 2. Redistributions in binary form must reproduce the above copyright |
Pokitto | 0:e8b8f36b4505 | 18 | notice, this list of conditions and the following disclaimer in the |
Pokitto | 0:e8b8f36b4505 | 19 | documentation and/or other materials provided with the distribution. |
Pokitto | 0:e8b8f36b4505 | 20 | 3. Neither the name of the copyright holders nor the |
Pokitto | 0:e8b8f36b4505 | 21 | names of its contributors may be used to endorse or promote products |
Pokitto | 0:e8b8f36b4505 | 22 | derived from this software without specific prior written permission. |
Pokitto | 0:e8b8f36b4505 | 23 | |
Pokitto | 0:e8b8f36b4505 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY |
Pokitto | 0:e8b8f36b4505 | 25 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
Pokitto | 0:e8b8f36b4505 | 26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Pokitto | 0:e8b8f36b4505 | 27 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY |
Pokitto | 0:e8b8f36b4505 | 28 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
Pokitto | 0:e8b8f36b4505 | 29 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
Pokitto | 0:e8b8f36b4505 | 30 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
Pokitto | 0:e8b8f36b4505 | 31 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
Pokitto | 0:e8b8f36b4505 | 32 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
Pokitto | 0:e8b8f36b4505 | 33 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Pokitto | 0:e8b8f36b4505 | 34 | */ |
Pokitto | 0:e8b8f36b4505 | 35 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 36 | |
Pokitto | 0:e8b8f36b4505 | 37 | #include "HWLCD.h" //HWLCD.h" #include "HWLCD.h" |
Pokitto | 0:e8b8f36b4505 | 38 | #include "Pokitto_settings.h" |
Pokitto | 0:e8b8f36b4505 | 39 | |
Pokitto | 0:e8b8f36b4505 | 40 | #define AB_JUMP 1024 // jump one 1-bit Arduboy screen forward to get next color bit |
Pokitto | 0:e8b8f36b4505 | 41 | #define GB_JUMP 504 // jump one 1-bit Gamebuino screen forward to get next color bit |
Pokitto | 0:e8b8f36b4505 | 42 | |
Pokitto | 0:e8b8f36b4505 | 43 | using namespace Pokitto; |
Pokitto | 0:e8b8f36b4505 | 44 | |
Pokitto | 0:e8b8f36b4505 | 45 | uint16_t prevdata=0; // if data does not change, do not adjust LCD bus lines |
Pokitto | 0:e8b8f36b4505 | 46 | |
Pokitto | 0:e8b8f36b4505 | 47 | #if POK_BOARDREV == 2 |
Pokitto | 0:e8b8f36b4505 | 48 | pwmout_t backlightpwm; |
Pokitto | 0:e8b8f36b4505 | 49 | #endif |
Pokitto | 0:e8b8f36b4505 | 50 | |
Pokitto | 0:e8b8f36b4505 | 51 | |
Pokitto | 0:e8b8f36b4505 | 52 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 53 | /*! |
Pokitto | 0:e8b8f36b4505 | 54 | @brief set up the 16-bit bus |
Pokitto | 0:e8b8f36b4505 | 55 | */ |
Pokitto | 0:e8b8f36b4505 | 56 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 57 | |
Pokitto | 0:e8b8f36b4505 | 58 | static inline void setup_data_16(uint16_t data) |
Pokitto | 0:e8b8f36b4505 | 59 | { |
Pokitto | 0:e8b8f36b4505 | 60 | uint32_t p2=0; |
Pokitto | 0:e8b8f36b4505 | 61 | |
Pokitto | 0:e8b8f36b4505 | 62 | if (data != prevdata) { |
Pokitto | 0:e8b8f36b4505 | 63 | |
Pokitto | 0:e8b8f36b4505 | 64 | prevdata=data; |
Pokitto | 0:e8b8f36b4505 | 65 | |
Pokitto | 0:e8b8f36b4505 | 66 | /** D0...D16 = P2_3 ... P2_18 **/ |
Pokitto | 0:e8b8f36b4505 | 67 | p2 = data << 3; |
Pokitto | 0:e8b8f36b4505 | 68 | |
Pokitto | 0:e8b8f36b4505 | 69 | //__disable_irq(); // Disable Interrupts |
Pokitto | 0:e8b8f36b4505 | 70 | SET_MASK_P2; |
Pokitto | 0:e8b8f36b4505 | 71 | LPC_GPIO_PORT->MPIN[2] = p2; // write bits to port |
Pokitto | 0:e8b8f36b4505 | 72 | CLR_MASK_P2; |
Pokitto | 0:e8b8f36b4505 | 73 | //__enable_irq(); // Enable Interrupts |
Pokitto | 0:e8b8f36b4505 | 74 | } |
Pokitto | 0:e8b8f36b4505 | 75 | } |
Pokitto | 0:e8b8f36b4505 | 76 | |
Pokitto | 0:e8b8f36b4505 | 77 | |
Pokitto | 0:e8b8f36b4505 | 78 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 79 | /*! |
Pokitto | 0:e8b8f36b4505 | 80 | @brief Write a command to the lcd, 16-bit bus |
Pokitto | 0:e8b8f36b4505 | 81 | */ |
Pokitto | 0:e8b8f36b4505 | 82 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 83 | inline void write_command_16(uint16_t data) |
Pokitto | 0:e8b8f36b4505 | 84 | { |
Pokitto | 0:e8b8f36b4505 | 85 | CLR_CS; // select lcd |
Pokitto | 0:e8b8f36b4505 | 86 | CLR_CD; // clear CD = command |
Pokitto | 0:e8b8f36b4505 | 87 | SET_RD; // RD high, do not read |
Pokitto | 0:e8b8f36b4505 | 88 | setup_data_16(data); // function that inputs the data into the relevant bus lines |
Pokitto | 0:e8b8f36b4505 | 89 | CLR_WR; // WR low |
Pokitto | 0:e8b8f36b4505 | 90 | SET_WR; // WR low, then high = write strobe |
Pokitto | 0:e8b8f36b4505 | 91 | SET_CS; // de-select lcd |
Pokitto | 0:e8b8f36b4505 | 92 | } |
Pokitto | 0:e8b8f36b4505 | 93 | |
Pokitto | 0:e8b8f36b4505 | 94 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 95 | /*! |
Pokitto | 0:e8b8f36b4505 | 96 | @brief Write data to the lcd, 16-bit bus |
Pokitto | 0:e8b8f36b4505 | 97 | */ |
Pokitto | 0:e8b8f36b4505 | 98 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 99 | inline void write_data_16(uint16_t data) |
Pokitto | 0:e8b8f36b4505 | 100 | { |
Pokitto | 0:e8b8f36b4505 | 101 | CLR_CS; |
Pokitto | 0:e8b8f36b4505 | 102 | SET_CD; |
Pokitto | 0:e8b8f36b4505 | 103 | SET_RD; |
Pokitto | 0:e8b8f36b4505 | 104 | setup_data_16(data); |
Pokitto | 0:e8b8f36b4505 | 105 | CLR_WR; |
Pokitto | 0:e8b8f36b4505 | 106 | SET_WR; |
Pokitto | 0:e8b8f36b4505 | 107 | SET_CS; |
Pokitto | 0:e8b8f36b4505 | 108 | } |
Pokitto | 0:e8b8f36b4505 | 109 | |
Pokitto | 0:e8b8f36b4505 | 110 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 111 | /*! |
Pokitto | 0:e8b8f36b4505 | 112 | @brief Point to a (x,y) location in the LCD DRAM |
Pokitto | 0:e8b8f36b4505 | 113 | */ |
Pokitto | 0:e8b8f36b4505 | 114 | /**************************************************************************/ |
Pokitto | 0:e8b8f36b4505 | 115 | static inline void setDRAMptr(uint8_t xptr, uint8_t yoffset) |
Pokitto | 0:e8b8f36b4505 | 116 | { |
Pokitto | 0:e8b8f36b4505 | 117 | write_command(0x20); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 118 | write_data(yoffset); |
Pokitto | 0:e8b8f36b4505 | 119 | write_command(0x21); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 120 | write_data(xptr); // |
Pokitto | 0:e8b8f36b4505 | 121 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 122 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 123 | } |
Pokitto | 0:e8b8f36b4505 | 124 | |
Pokitto | 0:e8b8f36b4505 | 125 | void Pokitto::initBacklight() { |
Pokitto | 0:e8b8f36b4505 | 126 | #if POK_BOARDREV == 2 |
Pokitto | 0:e8b8f36b4505 | 127 | pwmout_init(&backlightpwm,POK_BACKLIGHT_PIN); |
Pokitto | 0:e8b8f36b4505 | 128 | pwmout_period_us(&backlightpwm,5); |
Pokitto | 0:e8b8f36b4505 | 129 | pwmout_write(&backlightpwm,POK_BACKLIGHT_INITIALVALUE); |
Pokitto | 0:e8b8f36b4505 | 130 | #endif |
Pokitto | 0:e8b8f36b4505 | 131 | } |
Pokitto | 0:e8b8f36b4505 | 132 | |
Pokitto | 0:e8b8f36b4505 | 133 | void Pokitto::setBacklight(float value) { |
Pokitto | 0:e8b8f36b4505 | 134 | if (value>0.999f) value = 0.999f; |
Pokitto | 0:e8b8f36b4505 | 135 | pwmout_write(&backlightpwm,value); |
Pokitto | 0:e8b8f36b4505 | 136 | } |
Pokitto | 0:e8b8f36b4505 | 137 | |
Pokitto | 0:e8b8f36b4505 | 138 | void Pokitto::lcdInit() { |
Pokitto | 0:e8b8f36b4505 | 139 | initBacklight(); |
Pokitto | 0:e8b8f36b4505 | 140 | |
Pokitto | 0:e8b8f36b4505 | 141 | SET_RESET; |
Pokitto | 0:e8b8f36b4505 | 142 | wait_ms(10); |
Pokitto | 0:e8b8f36b4505 | 143 | CLR_RESET; |
Pokitto | 0:e8b8f36b4505 | 144 | wait_ms(10); |
Pokitto | 0:e8b8f36b4505 | 145 | SET_RESET; |
Pokitto | 0:e8b8f36b4505 | 146 | wait_ms(10); |
Pokitto | 0:e8b8f36b4505 | 147 | //************* Start Initial Sequence **********// |
Pokitto | 0:e8b8f36b4505 | 148 | write_command(0x01); // driver output control, this also affects direction |
Pokitto | 0:e8b8f36b4505 | 149 | write_data(0x11C); // originally: 0x11C 100011100 SS,NL4,NL3,NL2 |
Pokitto | 0:e8b8f36b4505 | 150 | // NL4...0 is the number of scan lines to drive the screen !!! |
Pokitto | 0:e8b8f36b4505 | 151 | // so 11100 is 1c = 220 lines, correct |
Pokitto | 0:e8b8f36b4505 | 152 | // test 1: 0x1C 11100 SS=0,NL4,NL3,NL2 -> no effect |
Pokitto | 0:e8b8f36b4505 | 153 | // test 2: 0x31C 1100011100 GS=1,SS=1,NL4,NL3,NL2 -> no effect |
Pokitto | 0:e8b8f36b4505 | 154 | // test 3: 0x51C 10100011100 SM=1,GS=0,SS=1,NL4,NL3,NL2 -> no effect |
Pokitto | 0:e8b8f36b4505 | 155 | // test 4: 0x71C SM=1,GS=1,SS=1,NL4,NL3,NL2 |
Pokitto | 0:e8b8f36b4505 | 156 | // test 5: 0x |
Pokitto | 0:e8b8f36b4505 | 157 | // seems to have no effect... is this perhaps only for RGB mode ? |
Pokitto | 0:e8b8f36b4505 | 158 | |
Pokitto | 0:e8b8f36b4505 | 159 | write_command(0x02); // LCD driving control |
Pokitto | 0:e8b8f36b4505 | 160 | write_data(0x0100); // INV = 1 |
Pokitto | 0:e8b8f36b4505 | 161 | |
Pokitto | 0:e8b8f36b4505 | 162 | write_command(0x03); // Entry mode... lets try if this affects the direction |
spinal | 10:8cde5d0bafad | 163 | write_data(0x1038); // originally 0x1030 1000000110000 BGR,ID1,ID0 |
Pokitto | 0:e8b8f36b4505 | 164 | // test 1: 0x1038 1000000111000 BGR,ID1,ID0,AM=1 ->drawing DRAM horizontally |
Pokitto | 0:e8b8f36b4505 | 165 | // test 4: am=1, id0=0, id1=0, 1000000001000,0x1008 -> same as above, but flipped on long |
Pokitto | 0:e8b8f36b4505 | 166 | // test 2: am=0, id0=0, 1000000100000, 0x1020 -> flipped on long axis |
Pokitto | 0:e8b8f36b4505 | 167 | // test 3: am=0, id1=0, 1000000010000, 0x1010 -> picture flowed over back to screen |
Pokitto | 0:e8b8f36b4505 | 168 | |
Pokitto | 0:e8b8f36b4505 | 169 | |
Pokitto | 0:e8b8f36b4505 | 170 | write_command(0x08); // Display control 2 |
Pokitto | 0:e8b8f36b4505 | 171 | write_data(0x0808); // 100000001000 FP2,BP2 |
Pokitto | 0:e8b8f36b4505 | 172 | |
Pokitto | 0:e8b8f36b4505 | 173 | write_command(0x0C); // RGB display interface |
Pokitto | 0:e8b8f36b4505 | 174 | write_data(0x0000); // all off |
Pokitto | 0:e8b8f36b4505 | 175 | |
Pokitto | 0:e8b8f36b4505 | 176 | write_command(0x0F); // Frame marker position |
Pokitto | 0:e8b8f36b4505 | 177 | write_data(0x0001); // OSC_EN |
Pokitto | 0:e8b8f36b4505 | 178 | |
Pokitto | 0:e8b8f36b4505 | 179 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 180 | write_data(0x0000); // 0 |
Pokitto | 0:e8b8f36b4505 | 181 | |
Pokitto | 0:e8b8f36b4505 | 182 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 183 | write_data(0x0000); // 0 |
Pokitto | 0:e8b8f36b4505 | 184 | |
Pokitto | 0:e8b8f36b4505 | 185 | //*************Power On sequence ****************// |
Pokitto | 0:e8b8f36b4505 | 186 | write_command(0x10); |
Pokitto | 0:e8b8f36b4505 | 187 | write_data(0x0000); |
Pokitto | 0:e8b8f36b4505 | 188 | |
Pokitto | 0:e8b8f36b4505 | 189 | write_command(0x11); |
Pokitto | 0:e8b8f36b4505 | 190 | write_data(0x1000); |
Pokitto | 0:e8b8f36b4505 | 191 | wait_ms(10); |
Pokitto | 0:e8b8f36b4505 | 192 | //------------------------ Set GRAM area --------------------------------// |
Pokitto | 0:e8b8f36b4505 | 193 | write_command(0x30); // Gate scan position |
Pokitto | 0:e8b8f36b4505 | 194 | write_data(0x0000); // if GS=0, 00h=G1, else 00h=G220 |
Pokitto | 0:e8b8f36b4505 | 195 | |
Pokitto | 0:e8b8f36b4505 | 196 | write_command(0x31); // Vertical scroll control |
Pokitto | 0:e8b8f36b4505 | 197 | write_data(0x00DB); // scroll start line 11011011 = 219 |
Pokitto | 0:e8b8f36b4505 | 198 | |
Pokitto | 0:e8b8f36b4505 | 199 | write_command(0x32); // Vertical scroll control |
Pokitto | 0:e8b8f36b4505 | 200 | write_data(0x0000); // scroll end line 0 |
Pokitto | 0:e8b8f36b4505 | 201 | |
Pokitto | 0:e8b8f36b4505 | 202 | write_command(0x33); // Vertical scroll control |
Pokitto | 0:e8b8f36b4505 | 203 | write_data(0x0000); // 0=vertical scroll disabled |
Pokitto | 0:e8b8f36b4505 | 204 | |
Pokitto | 0:e8b8f36b4505 | 205 | write_command(0x34); // Partial screen driving control |
Pokitto | 0:e8b8f36b4505 | 206 | write_data(0x00DB); // db = full screen (end) |
Pokitto | 0:e8b8f36b4505 | 207 | |
Pokitto | 0:e8b8f36b4505 | 208 | write_command(0x35); // partial screen |
Pokitto | 0:e8b8f36b4505 | 209 | write_data(0x0000); // 0 = start |
Pokitto | 0:e8b8f36b4505 | 210 | |
Pokitto | 0:e8b8f36b4505 | 211 | write_command(0x36); // Horizontal and vertical RAM position |
Pokitto | 0:e8b8f36b4505 | 212 | write_data(0x00AF); //end address 175 |
Pokitto | 0:e8b8f36b4505 | 213 | |
Pokitto | 0:e8b8f36b4505 | 214 | write_command(0x37); |
Pokitto | 0:e8b8f36b4505 | 215 | write_data(0x0000); // start address 0 |
Pokitto | 0:e8b8f36b4505 | 216 | |
Pokitto | 0:e8b8f36b4505 | 217 | write_command(0x38); |
Pokitto | 0:e8b8f36b4505 | 218 | write_data(0x00DB); //end address 219 |
Pokitto | 0:e8b8f36b4505 | 219 | |
Pokitto | 0:e8b8f36b4505 | 220 | write_command(0x39); // start address 0 |
Pokitto | 0:e8b8f36b4505 | 221 | write_data(0x0000); |
Pokitto | 0:e8b8f36b4505 | 222 | wait_ms(10); |
Pokitto | 0:e8b8f36b4505 | 223 | write_command(0xff); // start gamma register control |
Pokitto | 0:e8b8f36b4505 | 224 | write_data(0x0003); |
Pokitto | 0:e8b8f36b4505 | 225 | |
Pokitto | 0:e8b8f36b4505 | 226 | // ----------- Adjust the Gamma Curve ----------// |
Pokitto | 0:e8b8f36b4505 | 227 | write_command(0x50); |
Pokitto | 0:e8b8f36b4505 | 228 | write_data(0x0203); |
Pokitto | 0:e8b8f36b4505 | 229 | |
Pokitto | 0:e8b8f36b4505 | 230 | write_command(0x051); |
Pokitto | 0:e8b8f36b4505 | 231 | write_data(0x0A09); |
Pokitto | 0:e8b8f36b4505 | 232 | |
Pokitto | 0:e8b8f36b4505 | 233 | write_command(0x52); |
Pokitto | 0:e8b8f36b4505 | 234 | write_data(0x0005); |
Pokitto | 0:e8b8f36b4505 | 235 | |
Pokitto | 0:e8b8f36b4505 | 236 | write_command(0x53); |
Pokitto | 0:e8b8f36b4505 | 237 | write_data(0x1021); |
Pokitto | 0:e8b8f36b4505 | 238 | |
Pokitto | 0:e8b8f36b4505 | 239 | write_command(0x54); |
Pokitto | 0:e8b8f36b4505 | 240 | write_data(0x0602); |
Pokitto | 0:e8b8f36b4505 | 241 | |
Pokitto | 0:e8b8f36b4505 | 242 | write_command(0x55); |
Pokitto | 0:e8b8f36b4505 | 243 | write_data(0x0003); |
Pokitto | 0:e8b8f36b4505 | 244 | |
Pokitto | 0:e8b8f36b4505 | 245 | write_command(0x56); |
Pokitto | 0:e8b8f36b4505 | 246 | write_data(0x0703); |
Pokitto | 0:e8b8f36b4505 | 247 | |
Pokitto | 0:e8b8f36b4505 | 248 | write_command(0x57); |
Pokitto | 0:e8b8f36b4505 | 249 | write_data(0x0507); |
Pokitto | 0:e8b8f36b4505 | 250 | |
Pokitto | 0:e8b8f36b4505 | 251 | write_command(0x58); |
Pokitto | 0:e8b8f36b4505 | 252 | write_data(0x1021); |
Pokitto | 0:e8b8f36b4505 | 253 | |
Pokitto | 0:e8b8f36b4505 | 254 | write_command(0x59); |
Pokitto | 0:e8b8f36b4505 | 255 | write_data(0x0703); |
Pokitto | 0:e8b8f36b4505 | 256 | |
Pokitto | 0:e8b8f36b4505 | 257 | write_command(0xB0); |
Pokitto | 0:e8b8f36b4505 | 258 | write_data(0x2501); |
Pokitto | 0:e8b8f36b4505 | 259 | |
Pokitto | 0:e8b8f36b4505 | 260 | write_command(0xFF); |
Pokitto | 0:e8b8f36b4505 | 261 | write_data(0x0000); |
Pokitto | 0:e8b8f36b4505 | 262 | |
Pokitto | 0:e8b8f36b4505 | 263 | write_command(0x07); |
Pokitto | 0:e8b8f36b4505 | 264 | write_data(0x1017); |
Pokitto | 0:e8b8f36b4505 | 265 | wait_ms(200); |
Pokitto | 0:e8b8f36b4505 | 266 | write_command(0x22); |
Pokitto | 0:e8b8f36b4505 | 267 | |
Pokitto | 0:e8b8f36b4505 | 268 | lcdClear(); |
Pokitto | 0:e8b8f36b4505 | 269 | } |
Pokitto | 0:e8b8f36b4505 | 270 | |
Pokitto | 0:e8b8f36b4505 | 271 | void Pokitto::lcdSleep(void){ |
Pokitto | 0:e8b8f36b4505 | 272 | write_command(0xFF); |
Pokitto | 0:e8b8f36b4505 | 273 | write_data(0x0000); |
Pokitto | 0:e8b8f36b4505 | 274 | |
Pokitto | 0:e8b8f36b4505 | 275 | write_command(0x07); |
Pokitto | 0:e8b8f36b4505 | 276 | write_data(0x0000); |
Pokitto | 0:e8b8f36b4505 | 277 | wait_ms(50); |
Pokitto | 0:e8b8f36b4505 | 278 | write_command(0x10);// Enter Standby mode |
Pokitto | 0:e8b8f36b4505 | 279 | write_data(0x0003); |
Pokitto | 0:e8b8f36b4505 | 280 | wait_ms(200); |
Pokitto | 0:e8b8f36b4505 | 281 | |
Pokitto | 0:e8b8f36b4505 | 282 | } |
Pokitto | 0:e8b8f36b4505 | 283 | |
Pokitto | 0:e8b8f36b4505 | 284 | void Pokitto::lcdWakeUp (void){ |
Pokitto | 0:e8b8f36b4505 | 285 | |
Pokitto | 0:e8b8f36b4505 | 286 | wait_ms(200); |
Pokitto | 0:e8b8f36b4505 | 287 | write_command(0xFF); |
Pokitto | 0:e8b8f36b4505 | 288 | write_data(0x0000); |
Pokitto | 0:e8b8f36b4505 | 289 | |
Pokitto | 0:e8b8f36b4505 | 290 | write_command(0x10);// Exit Sleep/ Standby mode |
Pokitto | 0:e8b8f36b4505 | 291 | write_data(0x0000); |
Pokitto | 0:e8b8f36b4505 | 292 | wait_ms(50); |
Pokitto | 0:e8b8f36b4505 | 293 | write_command(0x07); |
Pokitto | 0:e8b8f36b4505 | 294 | write_data(0x0117); |
Pokitto | 0:e8b8f36b4505 | 295 | wait_ms(200); |
Pokitto | 0:e8b8f36b4505 | 296 | } |
Pokitto | 0:e8b8f36b4505 | 297 | |
Pokitto | 0:e8b8f36b4505 | 298 | void Pokitto::lcdFillSurface(uint16_t c) { |
Pokitto | 0:e8b8f36b4505 | 299 | uint32_t i; |
Pokitto | 0:e8b8f36b4505 | 300 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 301 | write_data(0x0000); // 0 |
Pokitto | 0:e8b8f36b4505 | 302 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 303 | write_data(0); |
Pokitto | 0:e8b8f36b4505 | 304 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 305 | setup_data_16(c); |
Pokitto | 0:e8b8f36b4505 | 306 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 307 | for(i=0;i<220*176;i++) |
Pokitto | 0:e8b8f36b4505 | 308 | { |
Pokitto | 0:e8b8f36b4505 | 309 | CLR_WR; |
Pokitto | 0:e8b8f36b4505 | 310 | SET_WR; |
Pokitto | 0:e8b8f36b4505 | 311 | } |
Pokitto | 0:e8b8f36b4505 | 312 | } |
Pokitto | 0:e8b8f36b4505 | 313 | |
Pokitto | 0:e8b8f36b4505 | 314 | void Pokitto::lcdClear() { |
Pokitto | 0:e8b8f36b4505 | 315 | uint32_t i; |
Pokitto | 0:e8b8f36b4505 | 316 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 317 | write_data(0x0000); // 0 |
Pokitto | 0:e8b8f36b4505 | 318 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 319 | write_data(0); |
Pokitto | 0:e8b8f36b4505 | 320 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 321 | setup_data_16(0x0000); |
Pokitto | 0:e8b8f36b4505 | 322 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 323 | for(i=0;i<220*176;i++) |
Pokitto | 0:e8b8f36b4505 | 324 | { |
Pokitto | 0:e8b8f36b4505 | 325 | CLR_WR; |
Pokitto | 0:e8b8f36b4505 | 326 | SET_WR; |
Pokitto | 0:e8b8f36b4505 | 327 | } |
Pokitto | 0:e8b8f36b4505 | 328 | } |
Pokitto | 0:e8b8f36b4505 | 329 | |
spinal | 9:570fdd653f1d | 330 | void Pokitto::setWindow(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) { |
spinal | 9:570fdd653f1d | 331 | write_command(0x37); write_data(x1); |
spinal | 9:570fdd653f1d | 332 | write_command(0x36); write_data(x2); |
spinal | 9:570fdd653f1d | 333 | write_command(0x39); write_data(y1); |
spinal | 9:570fdd653f1d | 334 | write_command(0x38); write_data(y2); |
spinal | 9:570fdd653f1d | 335 | write_command(0x20); write_data(x1); |
spinal | 9:570fdd653f1d | 336 | write_command(0x21); write_data(y1); |
spinal | 9:570fdd653f1d | 337 | } |
spinal | 9:570fdd653f1d | 338 | |
spinal | 9:570fdd653f1d | 339 | void Pokitto::lcdTile(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t* gfx){ |
spinal | 9:570fdd653f1d | 340 | int width=x1-x0; |
spinal | 9:570fdd653f1d | 341 | int height=y1-y0; |
spinal | 9:570fdd653f1d | 342 | if (x0 > POK_LCD_W) return; |
spinal | 9:570fdd653f1d | 343 | if (y0 > POK_LCD_H) return; |
spinal | 9:570fdd653f1d | 344 | if (x0 < 0) x0=0; |
spinal | 9:570fdd653f1d | 345 | if (y0 < 0) y0=0; |
spinal | 9:570fdd653f1d | 346 | |
spinal | 9:570fdd653f1d | 347 | setWindow(y0, x0, y1-1, x1-1); |
spinal | 9:570fdd653f1d | 348 | write_command(0x22); |
spinal | 9:570fdd653f1d | 349 | |
spinal | 9:570fdd653f1d | 350 | for (int x=0; x<=width*height-1;x++) { |
spinal | 9:570fdd653f1d | 351 | write_data(gfx[x]); |
spinal | 9:570fdd653f1d | 352 | } |
spinal | 9:570fdd653f1d | 353 | setWindow(0, 0, 175, 219); |
spinal | 9:570fdd653f1d | 354 | } |
spinal | 9:570fdd653f1d | 355 | |
Pokitto | 0:e8b8f36b4505 | 356 | void Pokitto::lcdPixel(int16_t x, int16_t y, uint16_t color) { |
Pokitto | 0:e8b8f36b4505 | 357 | if ((x < 0) || (x >= POK_LCD_W) || (y < 0) || (y >= POK_LCD_H)) |
Pokitto | 0:e8b8f36b4505 | 358 | return; |
spinal | 9:570fdd653f1d | 359 | write_command(0x20); write_data(y); |
spinal | 9:570fdd653f1d | 360 | write_command(0x21); write_data(x); |
spinal | 9:570fdd653f1d | 361 | write_command(0x22); write_data(color); |
spinal | 9:570fdd653f1d | 362 | |
Pokitto | 0:e8b8f36b4505 | 363 | } |
Pokitto | 0:e8b8f36b4505 | 364 | |
Pokitto | 0:e8b8f36b4505 | 365 | void Pokitto::lcdRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) { |
spinal | 9:570fdd653f1d | 366 | if(x1<=x0)x1=x0+1; |
spinal | 9:570fdd653f1d | 367 | if(y1<=y0)y1=y0+1; |
spinal | 9:570fdd653f1d | 368 | setWindow(y0, x0, y1-1, x1-1); |
spinal | 9:570fdd653f1d | 369 | write_command(0x22); |
spinal | 9:570fdd653f1d | 370 | int width=x1-x0; |
spinal | 9:570fdd653f1d | 371 | int height=y1-y0; |
spinal | 9:570fdd653f1d | 372 | int i=width*height; |
spinal | 9:570fdd653f1d | 373 | while (i--) { |
spinal | 9:570fdd653f1d | 374 | write_data(color); |
spinal | 9:570fdd653f1d | 375 | } |
Pokitto | 0:e8b8f36b4505 | 376 | } |
Pokitto | 0:e8b8f36b4505 | 377 | |
spinal | 10:8cde5d0bafad | 378 | void Pokitto::lcdRefreshRegionMode1(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint8_t * scrbuf, uint16_t * paletteptr){ |
spinal | 10:8cde5d0bafad | 379 | if(x1<=x0)x1=x0+1; |
spinal | 10:8cde5d0bafad | 380 | if(y1<=y0)y1=y0+1; |
spinal | 10:8cde5d0bafad | 381 | setWindow(y0, x0, y1-1, x1-1); |
spinal | 10:8cde5d0bafad | 382 | write_command(0x22); |
spinal | 10:8cde5d0bafad | 383 | uint8_t pix; |
spinal | 10:8cde5d0bafad | 384 | uint8_t quartWide=(x1-x0)/4;; |
spinal | 10:8cde5d0bafad | 385 | uint8_t pic; |
spinal | 10:8cde5d0bafad | 386 | for(int y=y0; y<y1; y++){ |
spinal | 10:8cde5d0bafad | 387 | for(int x=x0; x<x0+quartWide; x++){ |
spinal | 10:8cde5d0bafad | 388 | pic = scrbuf[x+quartWide*y]; |
spinal | 10:8cde5d0bafad | 389 | pix = (pic >> 6)&3; write_data(paletteptr[pix]); |
spinal | 10:8cde5d0bafad | 390 | pix = (pic >> 4)&3; write_data(paletteptr[pix]); |
spinal | 10:8cde5d0bafad | 391 | pix = (pic >> 2)&3; write_data(paletteptr[pix]); |
spinal | 10:8cde5d0bafad | 392 | pix = pic &3; write_data(paletteptr[pix]); |
spinal | 10:8cde5d0bafad | 393 | } |
spinal | 10:8cde5d0bafad | 394 | } |
spinal | 10:8cde5d0bafad | 395 | } |
spinal | 10:8cde5d0bafad | 396 | |
Pokitto | 0:e8b8f36b4505 | 397 | void Pokitto::lcdRefreshMode1(uint8_t * scrbuf, uint16_t* paletteptr) { |
Pokitto | 0:e8b8f36b4505 | 398 | uint16_t x,y,xptr; |
Pokitto | 0:e8b8f36b4505 | 399 | uint16_t scanline[4][176]; // read 4 half-nibbles = 4 pixels at a time |
Pokitto | 0:e8b8f36b4505 | 400 | uint8_t *d, yoffset=0; |
Pokitto | 0:e8b8f36b4505 | 401 | |
Pokitto | 0:e8b8f36b4505 | 402 | xptr = 0; |
Pokitto | 0:e8b8f36b4505 | 403 | setDRAMptr(xptr,yoffset); |
Pokitto | 0:e8b8f36b4505 | 404 | |
Pokitto | 0:e8b8f36b4505 | 405 | |
Pokitto | 0:e8b8f36b4505 | 406 | for(x=0;x<220;x+=4) |
Pokitto | 0:e8b8f36b4505 | 407 | { |
Pokitto | 0:e8b8f36b4505 | 408 | d = scrbuf+(x>>2);// point to beginning of line in data |
Pokitto | 0:e8b8f36b4505 | 409 | /** find colours in one scanline **/ |
Pokitto | 0:e8b8f36b4505 | 410 | uint8_t s=0; |
Pokitto | 0:e8b8f36b4505 | 411 | for(y=0;y<176;y++) |
Pokitto | 0:e8b8f36b4505 | 412 | { |
Pokitto | 0:e8b8f36b4505 | 413 | uint8_t tdata = *d; |
Pokitto | 0:e8b8f36b4505 | 414 | uint8_t t4 = tdata & 0x03; tdata >>= 2;// lowest half-nibble |
Pokitto | 0:e8b8f36b4505 | 415 | uint8_t t3 = tdata & 0x03; tdata >>= 2;// second lowest half-nibble |
Pokitto | 0:e8b8f36b4505 | 416 | uint8_t t2 = tdata & 0x03; tdata >>= 2;// second highest half-nibble |
Pokitto | 0:e8b8f36b4505 | 417 | uint8_t t = tdata & 0x03;// highest half-nibble |
Pokitto | 0:e8b8f36b4505 | 418 | |
Pokitto | 0:e8b8f36b4505 | 419 | /** put nibble values in the scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 420 | scanline[0][s] = paletteptr[t]; |
Pokitto | 0:e8b8f36b4505 | 421 | scanline[1][s] = paletteptr[t2]; |
Pokitto | 0:e8b8f36b4505 | 422 | scanline[2][s] = paletteptr[t3]; |
Pokitto | 0:e8b8f36b4505 | 423 | scanline[3][s++] = paletteptr[t4]; |
Pokitto | 0:e8b8f36b4505 | 424 | |
Pokitto | 0:e8b8f36b4505 | 425 | d+=220/4; // jump to read byte directly below in screenbuffer |
Pokitto | 0:e8b8f36b4505 | 426 | } |
Pokitto | 0:e8b8f36b4505 | 427 | s=0; |
Pokitto | 0:e8b8f36b4505 | 428 | /** draw scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 429 | for (s=0;s<176;) { |
Pokitto | 0:e8b8f36b4505 | 430 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 431 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 432 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 433 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 434 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 435 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 436 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 437 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 438 | } |
Pokitto | 0:e8b8f36b4505 | 439 | for (s=0;s<176;) { |
Pokitto | 0:e8b8f36b4505 | 440 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 441 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 442 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 443 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 444 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 445 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 446 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 447 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 448 | } |
Pokitto | 0:e8b8f36b4505 | 449 | for (s=0;s<176;) { |
Pokitto | 0:e8b8f36b4505 | 450 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 451 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 452 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 453 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 454 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 455 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 456 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 457 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 458 | } |
Pokitto | 0:e8b8f36b4505 | 459 | for (s=0;s<176;) { |
Pokitto | 0:e8b8f36b4505 | 460 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 461 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 462 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 463 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 464 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 465 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 466 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 467 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 468 | } |
Pokitto | 0:e8b8f36b4505 | 469 | } |
Pokitto | 0:e8b8f36b4505 | 470 | } |
Pokitto | 0:e8b8f36b4505 | 471 | |
Pokitto | 0:e8b8f36b4505 | 472 | void Pokitto::lcdRefreshMode2(uint8_t * scrbuf, uint16_t* paletteptr) { |
Pokitto | 0:e8b8f36b4505 | 473 | uint16_t x,y; |
Pokitto | 0:e8b8f36b4505 | 474 | uint16_t scanline[2][88]; // read two nibbles = pixels at a time |
Pokitto | 2:968589ca3484 | 475 | uint8_t *d; |
Pokitto | 0:e8b8f36b4505 | 476 | |
Pokitto | 0:e8b8f36b4505 | 477 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 478 | write_data(0); // 0 |
Pokitto | 0:e8b8f36b4505 | 479 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 480 | write_data(0); |
Pokitto | 0:e8b8f36b4505 | 481 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 482 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 483 | |
Pokitto | 0:e8b8f36b4505 | 484 | for(x=0;x<110;x+=2) |
Pokitto | 0:e8b8f36b4505 | 485 | { |
Pokitto | 0:e8b8f36b4505 | 486 | d = scrbuf+(x>>1);// point to beginning of line in data |
Pokitto | 0:e8b8f36b4505 | 487 | /** find colours in one scanline **/ |
Pokitto | 0:e8b8f36b4505 | 488 | uint8_t s=0; |
Pokitto | 0:e8b8f36b4505 | 489 | for(y=0;y<88;y++) |
Pokitto | 0:e8b8f36b4505 | 490 | { |
Pokitto | 0:e8b8f36b4505 | 491 | uint8_t t = *d >> 4; // higher nibble |
Pokitto | 0:e8b8f36b4505 | 492 | uint8_t t2 = *d & 0xF; // lower nibble |
Pokitto | 0:e8b8f36b4505 | 493 | /** higher nibble = left pixel in pixel pair **/ |
Pokitto | 0:e8b8f36b4505 | 494 | scanline[0][s] = paletteptr[t]; |
Pokitto | 0:e8b8f36b4505 | 495 | scanline[1][s++] = paletteptr[t2]; |
Pokitto | 0:e8b8f36b4505 | 496 | /** testing only **/ |
Pokitto | 0:e8b8f36b4505 | 497 | //scanline[0][s] = 0xFFFF*(s&1); |
Pokitto | 0:e8b8f36b4505 | 498 | //scanline[1][s] = 0xFFFF*(!(s&1)); |
Pokitto | 0:e8b8f36b4505 | 499 | //s++; |
Pokitto | 0:e8b8f36b4505 | 500 | /** until here **/ |
Pokitto | 0:e8b8f36b4505 | 501 | d+=110/2; // jump to read byte directly below in screenbuffer |
Pokitto | 0:e8b8f36b4505 | 502 | } |
Pokitto | 0:e8b8f36b4505 | 503 | s=0; |
Pokitto | 0:e8b8f36b4505 | 504 | /** draw scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 505 | /** leftmost scanline twice**/ |
Pokitto | 0:e8b8f36b4505 | 506 | |
Pokitto | 0:e8b8f36b4505 | 507 | for (s=0;s<88;) { |
Pokitto | 0:e8b8f36b4505 | 508 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 509 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 510 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 511 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 512 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 513 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 514 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 515 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 516 | } |
Pokitto | 0:e8b8f36b4505 | 517 | |
Pokitto | 0:e8b8f36b4505 | 518 | for (s=0;s<88;) { |
Pokitto | 0:e8b8f36b4505 | 519 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 520 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 521 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 522 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 523 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 524 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 525 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 526 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 527 | } |
Pokitto | 0:e8b8f36b4505 | 528 | /** rightmost scanline twice**/ |
Pokitto | 0:e8b8f36b4505 | 529 | //setDRAMptr(xptr++,yoffset); |
Pokitto | 0:e8b8f36b4505 | 530 | for (s=0;s<88;) { |
Pokitto | 0:e8b8f36b4505 | 531 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 532 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 533 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 534 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 535 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 536 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 537 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 538 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 539 | } |
Pokitto | 0:e8b8f36b4505 | 540 | |
Pokitto | 0:e8b8f36b4505 | 541 | for (s=0;s<88;) { |
Pokitto | 0:e8b8f36b4505 | 542 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 543 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 544 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 545 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 546 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 547 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 548 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 549 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 550 | } |
Pokitto | 0:e8b8f36b4505 | 551 | } |
Pokitto | 0:e8b8f36b4505 | 552 | } |
Pokitto | 0:e8b8f36b4505 | 553 | |
Pokitto | 0:e8b8f36b4505 | 554 | void Pokitto::lcdRefreshMode3(uint8_t * scrbuf, uint16_t* paletteptr) { |
Pokitto | 2:968589ca3484 | 555 | uint16_t x,y; |
Pokitto | 0:e8b8f36b4505 | 556 | uint16_t scanline[2][176]; // read two nibbles = pixels at a time |
Pokitto | 2:968589ca3484 | 557 | uint8_t *d; |
Pokitto | 0:e8b8f36b4505 | 558 | |
Pokitto | 0:e8b8f36b4505 | 559 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 560 | write_data(0); // 0 |
Pokitto | 0:e8b8f36b4505 | 561 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 562 | write_data(0); |
Pokitto | 0:e8b8f36b4505 | 563 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 564 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 565 | |
Pokitto | 0:e8b8f36b4505 | 566 | for(x=0;x<220;x+=2) |
Pokitto | 0:e8b8f36b4505 | 567 | { |
Pokitto | 0:e8b8f36b4505 | 568 | d = scrbuf+(x>>1);// point to beginning of line in data |
Pokitto | 0:e8b8f36b4505 | 569 | /** find colours in one scanline **/ |
Pokitto | 0:e8b8f36b4505 | 570 | uint8_t s=0; |
Pokitto | 0:e8b8f36b4505 | 571 | for(y=0;y<176;y++) |
Pokitto | 0:e8b8f36b4505 | 572 | { |
Pokitto | 0:e8b8f36b4505 | 573 | uint8_t t = *d >> 4; // higher nibble |
Pokitto | 0:e8b8f36b4505 | 574 | uint8_t t2 = *d & 0xF; // lower nibble |
Pokitto | 0:e8b8f36b4505 | 575 | /** higher nibble = left pixel in pixel pair **/ |
Pokitto | 0:e8b8f36b4505 | 576 | scanline[0][s] = paletteptr[t]; |
Pokitto | 0:e8b8f36b4505 | 577 | scanline[1][s++] = paletteptr[t2]; |
Pokitto | 0:e8b8f36b4505 | 578 | /** testing only **/ |
Pokitto | 0:e8b8f36b4505 | 579 | //scanline[0][s] = 0xFFFF*(s&1); |
Pokitto | 0:e8b8f36b4505 | 580 | //scanline[1][s] = 0xFFFF*(!(s&1)); |
Pokitto | 0:e8b8f36b4505 | 581 | //s++; |
Pokitto | 0:e8b8f36b4505 | 582 | /** until here **/ |
Pokitto | 0:e8b8f36b4505 | 583 | d+=220/2; // jump to read byte directly below in screenbuffer |
Pokitto | 0:e8b8f36b4505 | 584 | } |
Pokitto | 0:e8b8f36b4505 | 585 | s=0; |
Pokitto | 0:e8b8f36b4505 | 586 | /** draw scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 587 | /** leftmost scanline**/ |
Pokitto | 0:e8b8f36b4505 | 588 | |
Pokitto | 0:e8b8f36b4505 | 589 | for (s=0;s<176;) { |
Pokitto | 0:e8b8f36b4505 | 590 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 591 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 592 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 593 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 594 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 595 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 596 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 597 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 598 | } |
Pokitto | 0:e8b8f36b4505 | 599 | |
Pokitto | 0:e8b8f36b4505 | 600 | /** rightmost scanline**/ |
Pokitto | 0:e8b8f36b4505 | 601 | //setDRAMptr(xptr++,yoffset); |
Pokitto | 0:e8b8f36b4505 | 602 | for (s=0;s<176;) { |
Pokitto | 0:e8b8f36b4505 | 603 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 604 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 605 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 606 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 607 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 608 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 609 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 610 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 611 | } |
Pokitto | 0:e8b8f36b4505 | 612 | } |
Pokitto | 0:e8b8f36b4505 | 613 | } |
Pokitto | 0:e8b8f36b4505 | 614 | |
Pokitto | 0:e8b8f36b4505 | 615 | void Pokitto::lcdRefreshGB(uint8_t * scrbuf, uint16_t* paletteptr) { |
Pokitto | 2:968589ca3484 | 616 | uint16_t x,y; |
Pokitto | 0:e8b8f36b4505 | 617 | uint16_t scanline[48]; |
Pokitto | 0:e8b8f36b4505 | 618 | uint8_t * d; |
Pokitto | 0:e8b8f36b4505 | 619 | |
Pokitto | 0:e8b8f36b4505 | 620 | #if POK_STRETCH |
Pokitto | 2:968589ca3484 | 621 | //uint16_t xptr = 8; |
Pokitto | 0:e8b8f36b4505 | 622 | #else |
Pokitto | 2:968589ca3484 | 623 | //xptr = 26; |
Pokitto | 0:e8b8f36b4505 | 624 | #endif |
Pokitto | 0:e8b8f36b4505 | 625 | |
Pokitto | 0:e8b8f36b4505 | 626 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 627 | write_data(0); // 0 |
Pokitto | 0:e8b8f36b4505 | 628 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 629 | write_data(0); |
Pokitto | 0:e8b8f36b4505 | 630 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 631 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 632 | |
Pokitto | 0:e8b8f36b4505 | 633 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 634 | for (int s=0;s<5*176;) { |
Pokitto | 0:e8b8f36b4505 | 635 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;s++; |
Pokitto | 0:e8b8f36b4505 | 636 | } |
Pokitto | 0:e8b8f36b4505 | 637 | |
Pokitto | 0:e8b8f36b4505 | 638 | for(x=0;x<84;x++) |
Pokitto | 0:e8b8f36b4505 | 639 | { |
Pokitto | 0:e8b8f36b4505 | 640 | |
Pokitto | 0:e8b8f36b4505 | 641 | d = scrbuf + x;// point to beginning of line in data |
Pokitto | 0:e8b8f36b4505 | 642 | |
Pokitto | 0:e8b8f36b4505 | 643 | /** find colours in one scanline **/ |
Pokitto | 0:e8b8f36b4505 | 644 | uint8_t s=0; |
Pokitto | 0:e8b8f36b4505 | 645 | for(y=0;y<6;y++) |
Pokitto | 0:e8b8f36b4505 | 646 | { |
Pokitto | 0:e8b8f36b4505 | 647 | uint8_t t = *d; |
Pokitto | 0:e8b8f36b4505 | 648 | #if POK_COLORDEPTH > 1 |
Pokitto | 0:e8b8f36b4505 | 649 | uint8_t t2 = *(d+504); |
Pokitto | 0:e8b8f36b4505 | 650 | #endif |
Pokitto | 0:e8b8f36b4505 | 651 | #if POK_COLORDEPTH > 2 |
Pokitto | 0:e8b8f36b4505 | 652 | uint8_t t3 = *(d+504+504); |
Pokitto | 0:e8b8f36b4505 | 653 | #endif |
Pokitto | 0:e8b8f36b4505 | 654 | #if POK_COLORDEPTH > 3 |
Pokitto | 0:e8b8f36b4505 | 655 | uint8_t t4 = *(d+504+504+504); |
Pokitto | 0:e8b8f36b4505 | 656 | #endif |
Pokitto | 0:e8b8f36b4505 | 657 | uint8_t paletteindex = 0; |
Pokitto | 0:e8b8f36b4505 | 658 | |
Pokitto | 0:e8b8f36b4505 | 659 | /** bit 1 **/ |
Pokitto | 0:e8b8f36b4505 | 660 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 661 | paletteindex = (t & 0x1); |
Pokitto | 0:e8b8f36b4505 | 662 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 663 | paletteindex = ((t & 0x1)) | ((t2 & 0x01)<<1); |
Pokitto | 0:e8b8f36b4505 | 664 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 665 | paletteindex = (t & 0x1) | ((t2 & 0x1)<<1) | ((t3 & 0x1)<<2); |
Pokitto | 0:e8b8f36b4505 | 666 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 667 | paletteindex = (t & 0x1) | ((t2 & 0x1)<<1) | ((t3 & 0x1)<<2) | ((t4 & 0x1)<<3); |
Pokitto | 0:e8b8f36b4505 | 668 | #endif |
Pokitto | 0:e8b8f36b4505 | 669 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 670 | |
Pokitto | 0:e8b8f36b4505 | 671 | /** bit 2 **/ |
Pokitto | 0:e8b8f36b4505 | 672 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 673 | paletteindex = (t & 0x2)>>1; |
Pokitto | 0:e8b8f36b4505 | 674 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 675 | paletteindex = ((t & 0x2)>>1) | ((t2 & 0x02)); |
Pokitto | 0:e8b8f36b4505 | 676 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 677 | paletteindex = ((t & 0x2)>>1) | ((t2 & 0x2)) | ((t3 & 0x2)<<1); |
Pokitto | 0:e8b8f36b4505 | 678 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 679 | paletteindex = ((t & 0x2)>>1) | ((t2 & 0x2)) | ((t3 & 0x2)<<1) | ((t4 & 0x2)<<2); |
Pokitto | 0:e8b8f36b4505 | 680 | #endif |
Pokitto | 0:e8b8f36b4505 | 681 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 682 | |
Pokitto | 0:e8b8f36b4505 | 683 | /** bit 3 **/ |
Pokitto | 0:e8b8f36b4505 | 684 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 685 | paletteindex = (t & 0x4)>>2; |
Pokitto | 0:e8b8f36b4505 | 686 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 687 | paletteindex = ((t & 4)>>2) | ((t2 & 0x04)>>1); |
Pokitto | 0:e8b8f36b4505 | 688 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 689 | paletteindex = ((t & 0x4)>>2) | ((t2 & 0x4)>>1) | (t3 & 0x4); |
Pokitto | 0:e8b8f36b4505 | 690 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 691 | paletteindex = ((t & 0x4)>>2) | ((t2 & 0x4)>>1) | (t3 & 0x4) | ((t4 & 0x4)<<1); |
Pokitto | 0:e8b8f36b4505 | 692 | #endif |
Pokitto | 0:e8b8f36b4505 | 693 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 694 | |
Pokitto | 0:e8b8f36b4505 | 695 | /** bit 4 **/ |
Pokitto | 0:e8b8f36b4505 | 696 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 697 | paletteindex = (t & 0x8)>>3; |
Pokitto | 0:e8b8f36b4505 | 698 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 699 | paletteindex = ((t & 0x8)>>3) | ((t2 & 0x08)>>2); |
Pokitto | 0:e8b8f36b4505 | 700 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 701 | paletteindex = ((t & 0x8)>>3) | ((t2 & 0x8)>>2) | ((t3 & 0x8)>>1); |
Pokitto | 0:e8b8f36b4505 | 702 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 703 | paletteindex = ((t & 0x8)>>3) | ((t2 & 0x8)>>2) | ((t3 & 0x8)>>1) | (t4 & 0x8); |
Pokitto | 0:e8b8f36b4505 | 704 | #endif |
Pokitto | 0:e8b8f36b4505 | 705 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 706 | |
Pokitto | 0:e8b8f36b4505 | 707 | /** bit 5 **/ |
Pokitto | 0:e8b8f36b4505 | 708 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 709 | paletteindex = (t & 0x10)>>4; |
Pokitto | 0:e8b8f36b4505 | 710 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 711 | paletteindex = ((t & 0x10)>>4) | ((t2 & 0x10)>>3); |
Pokitto | 0:e8b8f36b4505 | 712 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 713 | paletteindex = ((t & 0x10)>>4) | ((t2 & 0x10)>>3) | ((t3 & 0x10)>>2); |
Pokitto | 0:e8b8f36b4505 | 714 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 715 | paletteindex = ((t & 0x10)>>4) | ((t2 & 0x10)>>3) | ((t3 & 0x10)>>2) | ((t4 & 0x10)>>1); |
Pokitto | 0:e8b8f36b4505 | 716 | #endif |
Pokitto | 0:e8b8f36b4505 | 717 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 718 | |
Pokitto | 0:e8b8f36b4505 | 719 | /** bit 6 **/ |
Pokitto | 0:e8b8f36b4505 | 720 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 721 | paletteindex = (t & 0x20)>>5; |
Pokitto | 0:e8b8f36b4505 | 722 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 723 | paletteindex = ((t & 0x20)>>5) | ((t2 & 0x20)>>4); |
Pokitto | 0:e8b8f36b4505 | 724 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 725 | paletteindex = ((t & 0x20)>>5) | ((t2 & 0x20)>>4) | ((t3 & 0x20)>>3); |
Pokitto | 0:e8b8f36b4505 | 726 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 727 | paletteindex = ((t & 0x20)>>5) | ((t2 & 0x20)>>4) | ((t3 & 0x20)>>3) | ((t4 & 0x20)>>2); |
Pokitto | 0:e8b8f36b4505 | 728 | #endif |
Pokitto | 0:e8b8f36b4505 | 729 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 730 | |
Pokitto | 0:e8b8f36b4505 | 731 | /** bit 7 **/ |
Pokitto | 0:e8b8f36b4505 | 732 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 733 | paletteindex = (t & 0x40)>>6; |
Pokitto | 0:e8b8f36b4505 | 734 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 735 | paletteindex = ((t & 0x40)>>6) | ((t2 & 0x40)>>5); |
Pokitto | 0:e8b8f36b4505 | 736 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 737 | paletteindex = ((t & 0x40)>>6) | ((t2 & 0x40)>>5) | ((t3 & 0x40)>>4) ; |
Pokitto | 0:e8b8f36b4505 | 738 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 739 | paletteindex = ((t & 0x40)>>6) | ((t2 & 0x40)>>5) | ((t3 & 0x40)>>4) | ((t4 & 0x40)>>3); |
Pokitto | 0:e8b8f36b4505 | 740 | #endif |
Pokitto | 0:e8b8f36b4505 | 741 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 742 | |
Pokitto | 0:e8b8f36b4505 | 743 | /** bit 8 **/ |
Pokitto | 0:e8b8f36b4505 | 744 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 745 | paletteindex = (t & 0x80)>>7; |
Pokitto | 0:e8b8f36b4505 | 746 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 747 | paletteindex = ((t & 0x80)>>7) | ((t2 & 0x80)>>6); |
Pokitto | 0:e8b8f36b4505 | 748 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 749 | paletteindex = ((t & 0x80)>>7) | ((t2 & 0x80)>>6) | ((t3 & 0x80)>>5); |
Pokitto | 0:e8b8f36b4505 | 750 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 751 | paletteindex = ((t & 0x80)>>7) | ((t2 & 0x80)>>6) | ((t3 & 0x80)>>5) | ((t4 & 0x80)>>4); |
Pokitto | 0:e8b8f36b4505 | 752 | #endif |
Pokitto | 0:e8b8f36b4505 | 753 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 754 | |
Pokitto | 0:e8b8f36b4505 | 755 | d+=84; // jump to byte directly below |
Pokitto | 0:e8b8f36b4505 | 756 | } |
Pokitto | 0:e8b8f36b4505 | 757 | |
Pokitto | 0:e8b8f36b4505 | 758 | |
Pokitto | 0:e8b8f36b4505 | 759 | /*write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 760 | write_data(0x10); // 0 |
Pokitto | 0:e8b8f36b4505 | 761 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 762 | write_data(xptr++); |
Pokitto | 0:e8b8f36b4505 | 763 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 764 | CLR_CS_SET_CD_RD_WR;*/ |
Pokitto | 0:e8b8f36b4505 | 765 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 766 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 767 | |
Pokitto | 0:e8b8f36b4505 | 768 | s=0; |
Pokitto | 0:e8b8f36b4505 | 769 | |
Pokitto | 0:e8b8f36b4505 | 770 | /** draw scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 771 | for (s=0;s<48;) { |
Pokitto | 0:e8b8f36b4505 | 772 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 773 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 774 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 775 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 776 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 777 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 778 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 779 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 780 | } |
Pokitto | 0:e8b8f36b4505 | 781 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 782 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 783 | |
Pokitto | 0:e8b8f36b4505 | 784 | |
Pokitto | 0:e8b8f36b4505 | 785 | /*write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 786 | write_data(0x10); // 0 |
Pokitto | 0:e8b8f36b4505 | 787 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 788 | write_data(xptr++); |
Pokitto | 0:e8b8f36b4505 | 789 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 790 | CLR_CS_SET_CD_RD_WR;*/ |
Pokitto | 0:e8b8f36b4505 | 791 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 792 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 793 | |
Pokitto | 0:e8b8f36b4505 | 794 | for (s=0;s<48;) { |
Pokitto | 0:e8b8f36b4505 | 795 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 796 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 797 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 798 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 799 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 800 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 801 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 802 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 803 | } |
Pokitto | 0:e8b8f36b4505 | 804 | |
Pokitto | 0:e8b8f36b4505 | 805 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 806 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 807 | |
Pokitto | 0:e8b8f36b4505 | 808 | |
Pokitto | 0:e8b8f36b4505 | 809 | #if POK_STRETCH |
Pokitto | 0:e8b8f36b4505 | 810 | //if (x>16 && x<68) |
Pokitto | 0:e8b8f36b4505 | 811 | if (x&2)// && x&2) |
Pokitto | 0:e8b8f36b4505 | 812 | { |
Pokitto | 0:e8b8f36b4505 | 813 | /*write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 814 | write_data(0x10); // 0 |
Pokitto | 0:e8b8f36b4505 | 815 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 816 | write_data(xptr++); |
Pokitto | 0:e8b8f36b4505 | 817 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 818 | CLR_CS_SET_CD_RD_WR;*/ |
Pokitto | 0:e8b8f36b4505 | 819 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 820 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 821 | |
Pokitto | 0:e8b8f36b4505 | 822 | |
Pokitto | 0:e8b8f36b4505 | 823 | for (s=0;s<48;) { |
Pokitto | 0:e8b8f36b4505 | 824 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 825 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 826 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 827 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 828 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 829 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 830 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 831 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 832 | } |
Pokitto | 0:e8b8f36b4505 | 833 | |
Pokitto | 0:e8b8f36b4505 | 834 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 835 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 836 | |
Pokitto | 0:e8b8f36b4505 | 837 | } |
Pokitto | 0:e8b8f36b4505 | 838 | #endif |
Pokitto | 0:e8b8f36b4505 | 839 | } |
Pokitto | 0:e8b8f36b4505 | 840 | /** draw border **/ |
Pokitto | 0:e8b8f36b4505 | 841 | for (int s=0;s<5*176;) { |
Pokitto | 0:e8b8f36b4505 | 842 | setup_data_16(COLOR_BLACK);CLR_WR;SET_WR;s++; |
Pokitto | 0:e8b8f36b4505 | 843 | } |
Pokitto | 0:e8b8f36b4505 | 844 | } |
Pokitto | 0:e8b8f36b4505 | 845 | |
Pokitto | 0:e8b8f36b4505 | 846 | |
Pokitto | 0:e8b8f36b4505 | 847 | void Pokitto::lcdRefreshAB(uint8_t * scrbuf, uint16_t* paletteptr) { |
Pokitto | 2:968589ca3484 | 848 | uint16_t x,y; |
Pokitto | 0:e8b8f36b4505 | 849 | uint16_t scanline[64]; |
Pokitto | 2:968589ca3484 | 850 | uint8_t *d; |
Pokitto | 0:e8b8f36b4505 | 851 | //lcdClear(); |
Pokitto | 0:e8b8f36b4505 | 852 | #if POK_STRETCH |
Pokitto | 2:968589ca3484 | 853 | uint16_t xptr = 14; |
Pokitto | 2:968589ca3484 | 854 | uint8_t yoffset = 24; |
Pokitto | 0:e8b8f36b4505 | 855 | #else |
Pokitto | 0:e8b8f36b4505 | 856 | xptr = 0; //was 26 |
Pokitto | 0:e8b8f36b4505 | 857 | #endif |
Pokitto | 0:e8b8f36b4505 | 858 | |
Pokitto | 0:e8b8f36b4505 | 859 | for(x=0;x<128;x++) |
Pokitto | 0:e8b8f36b4505 | 860 | { |
Pokitto | 0:e8b8f36b4505 | 861 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 862 | write_data(yoffset); // 0 |
Pokitto | 0:e8b8f36b4505 | 863 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 864 | write_data(xptr++); |
Pokitto | 0:e8b8f36b4505 | 865 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 866 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 867 | //setDRAMptr(xptr++,yoffset); |
Pokitto | 0:e8b8f36b4505 | 868 | |
Pokitto | 0:e8b8f36b4505 | 869 | d = scrbuf + x;// point to beginning of line in data |
Pokitto | 0:e8b8f36b4505 | 870 | |
Pokitto | 0:e8b8f36b4505 | 871 | /** find colours in one scanline **/ |
Pokitto | 0:e8b8f36b4505 | 872 | uint8_t s=0; |
Pokitto | 0:e8b8f36b4505 | 873 | for(y=0;y<8;y++) |
Pokitto | 0:e8b8f36b4505 | 874 | { |
Pokitto | 0:e8b8f36b4505 | 875 | uint8_t t = *d; |
Pokitto | 0:e8b8f36b4505 | 876 | #if POK_COLORDEPTH > 1 |
Pokitto | 0:e8b8f36b4505 | 877 | uint8_t t2 = *(d+AB_JUMP); |
Pokitto | 0:e8b8f36b4505 | 878 | #endif // POK_COLORDEPTH |
Pokitto | 0:e8b8f36b4505 | 879 | #if POK_COLORDEPTH > 2 |
Pokitto | 0:e8b8f36b4505 | 880 | uint8_t t3 = *(d+AB_JUMP+AB_JUMP); |
Pokitto | 0:e8b8f36b4505 | 881 | #endif // POK_COLORDEPTH |
Pokitto | 0:e8b8f36b4505 | 882 | #if POK_COLORDEPTH > 3 |
Pokitto | 0:e8b8f36b4505 | 883 | uint8_t t4 = *(d+AB_JUMP+AB_JUMP+AB_JUMP); |
Pokitto | 0:e8b8f36b4505 | 884 | #endif // POK_COLORDEPTH |
Pokitto | 0:e8b8f36b4505 | 885 | uint8_t paletteindex = 0; |
Pokitto | 0:e8b8f36b4505 | 886 | |
Pokitto | 0:e8b8f36b4505 | 887 | /** bit 1 **/ |
Pokitto | 0:e8b8f36b4505 | 888 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 889 | paletteindex = (t & 0x1); |
Pokitto | 0:e8b8f36b4505 | 890 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 891 | paletteindex = ((t & 0x1)) | ((t2 & 0x01)<<1); |
Pokitto | 0:e8b8f36b4505 | 892 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 893 | paletteindex = (t & 0x1) | ((t2 & 0x1)<<1) | ((t3 & 0x1)<<2); |
Pokitto | 0:e8b8f36b4505 | 894 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 895 | paletteindex = (t & 0x1) | ((t2 & 0x1)<<1) | ((t3 & 0x1)<<2) | ((t4 & 0x1)<<3); |
Pokitto | 0:e8b8f36b4505 | 896 | #endif |
Pokitto | 0:e8b8f36b4505 | 897 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 898 | |
Pokitto | 0:e8b8f36b4505 | 899 | /** bit 2 **/ |
Pokitto | 0:e8b8f36b4505 | 900 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 901 | paletteindex = (t & 0x2)>>1; |
Pokitto | 0:e8b8f36b4505 | 902 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 903 | paletteindex = ((t & 0x2)>>1) | ((t2 & 0x02)); |
Pokitto | 0:e8b8f36b4505 | 904 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 905 | paletteindex = ((t & 0x2)>>1) | ((t2 & 0x2)) | ((t3 & 0x2)<<1); |
Pokitto | 0:e8b8f36b4505 | 906 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 907 | paletteindex = ((t & 0x2)>>1) | ((t2 & 0x2)) | ((t3 & 0x2)<<1) | ((t4 & 0x2)<<2); |
Pokitto | 0:e8b8f36b4505 | 908 | #endif |
Pokitto | 0:e8b8f36b4505 | 909 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 910 | |
Pokitto | 0:e8b8f36b4505 | 911 | /** bit 3 **/ |
Pokitto | 0:e8b8f36b4505 | 912 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 913 | paletteindex = (t & 0x4)>>2; |
Pokitto | 0:e8b8f36b4505 | 914 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 915 | paletteindex = ((t & 4)>>2) | ((t2 & 0x04)>>1); |
Pokitto | 0:e8b8f36b4505 | 916 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 917 | paletteindex = ((t & 0x4)>>2) | ((t2 & 0x4)>>1) | (t3 & 0x4); |
Pokitto | 0:e8b8f36b4505 | 918 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 919 | paletteindex = ((t & 0x4)>>2) | ((t2 & 0x4)>>1) | (t3 & 0x4) | ((t4 & 0x4)<<1); |
Pokitto | 0:e8b8f36b4505 | 920 | #endif |
Pokitto | 0:e8b8f36b4505 | 921 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 922 | |
Pokitto | 0:e8b8f36b4505 | 923 | /** bit 4 **/ |
Pokitto | 0:e8b8f36b4505 | 924 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 925 | paletteindex = (t & 0x8)>>3; |
Pokitto | 0:e8b8f36b4505 | 926 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 927 | paletteindex = ((t & 0x8)>>3) | ((t2 & 0x08)>>2); |
Pokitto | 0:e8b8f36b4505 | 928 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 929 | paletteindex = ((t & 0x8)>>3) | ((t2 & 0x8)>>2) | ((t3 & 0x8)>>1); |
Pokitto | 0:e8b8f36b4505 | 930 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 931 | paletteindex = ((t & 0x8)>>3) | ((t2 & 0x8)>>2) | ((t3 & 0x8)>>1) | (t4 & 0x8); |
Pokitto | 0:e8b8f36b4505 | 932 | #endif |
Pokitto | 0:e8b8f36b4505 | 933 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 934 | |
Pokitto | 0:e8b8f36b4505 | 935 | /** bit 5 **/ |
Pokitto | 0:e8b8f36b4505 | 936 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 937 | paletteindex = (t & 0x10)>>4; |
Pokitto | 0:e8b8f36b4505 | 938 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 939 | paletteindex = ((t & 0x10)>>4) | ((t2 & 0x10)>>3); |
Pokitto | 0:e8b8f36b4505 | 940 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 941 | paletteindex = ((t & 0x10)>>4) | ((t2 & 0x10)>>3) | ((t3 & 0x10)>>2); |
Pokitto | 0:e8b8f36b4505 | 942 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 943 | paletteindex = ((t & 0x10)>>4) | ((t2 & 0x10)>>3) | ((t3 & 0x10)>>2) | ((t4 & 0x10)>>1); |
Pokitto | 0:e8b8f36b4505 | 944 | #endif |
Pokitto | 0:e8b8f36b4505 | 945 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 946 | |
Pokitto | 0:e8b8f36b4505 | 947 | /** bit 6 **/ |
Pokitto | 0:e8b8f36b4505 | 948 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 949 | paletteindex = (t & 0x20)>>5; |
Pokitto | 0:e8b8f36b4505 | 950 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 951 | paletteindex = ((t & 0x20)>>5) | ((t2 & 0x20)>>4); |
Pokitto | 0:e8b8f36b4505 | 952 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 953 | paletteindex = ((t & 0x20)>>5) | ((t2 & 0x20)>>4) | ((t3 & 0x20)>>3); |
Pokitto | 0:e8b8f36b4505 | 954 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 955 | paletteindex = ((t & 0x20)>>5) | ((t2 & 0x20)>>4) | ((t3 & 0x20)>>3) | ((t4 & 0x20)>>2); |
Pokitto | 0:e8b8f36b4505 | 956 | #endif |
Pokitto | 0:e8b8f36b4505 | 957 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 958 | |
Pokitto | 0:e8b8f36b4505 | 959 | /** bit 7 **/ |
Pokitto | 0:e8b8f36b4505 | 960 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 961 | paletteindex = (t & 0x40)>>6; |
Pokitto | 0:e8b8f36b4505 | 962 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 963 | paletteindex = ((t & 0x40)>>6) | ((t2 & 0x40)>>5); |
Pokitto | 0:e8b8f36b4505 | 964 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 965 | paletteindex = ((t & 0x40)>>6) | ((t2 & 0x40)>>5) | ((t3 & 0x40)>>4) ; |
Pokitto | 0:e8b8f36b4505 | 966 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 967 | paletteindex = ((t & 0x40)>>6) | ((t2 & 0x40)>>5) | ((t3 & 0x40)>>4) | ((t4 & 0x40)>>3); |
Pokitto | 0:e8b8f36b4505 | 968 | #endif |
Pokitto | 0:e8b8f36b4505 | 969 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 970 | |
Pokitto | 0:e8b8f36b4505 | 971 | /** bit 8 **/ |
Pokitto | 0:e8b8f36b4505 | 972 | #if POK_COLORDEPTH == 1 |
Pokitto | 0:e8b8f36b4505 | 973 | paletteindex = (t & 0x80)>>7; |
Pokitto | 0:e8b8f36b4505 | 974 | #elif POK_COLORDEPTH == 2 |
Pokitto | 0:e8b8f36b4505 | 975 | paletteindex = ((t & 0x80)>>7) | ((t2 & 0x80)>>6); |
Pokitto | 0:e8b8f36b4505 | 976 | #elif POK_COLORDEPTH == 3 |
Pokitto | 0:e8b8f36b4505 | 977 | paletteindex = ((t & 0x80)>>7) | ((t2 & 0x80)>>6) | ((t3 & 0x80)>>5); |
Pokitto | 0:e8b8f36b4505 | 978 | #elif POK_COLORDEPTH == 4 |
Pokitto | 0:e8b8f36b4505 | 979 | paletteindex = ((t & 0x80)>>7) | ((t2 & 0x80)>>6) | ((t3 & 0x80)>>5) | ((t4 & 0x80)>>4); |
Pokitto | 0:e8b8f36b4505 | 980 | #endif |
Pokitto | 0:e8b8f36b4505 | 981 | scanline[s++] = paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 982 | |
Pokitto | 0:e8b8f36b4505 | 983 | d+=128; // jump to byte directly below |
Pokitto | 0:e8b8f36b4505 | 984 | } |
Pokitto | 0:e8b8f36b4505 | 985 | |
Pokitto | 0:e8b8f36b4505 | 986 | s=0; |
Pokitto | 0:e8b8f36b4505 | 987 | |
Pokitto | 0:e8b8f36b4505 | 988 | /** draw scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 989 | for (s=0;s<64;) { |
Pokitto | 0:e8b8f36b4505 | 990 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 991 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 992 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 993 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 994 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 995 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 996 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 997 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 998 | } |
Pokitto | 0:e8b8f36b4505 | 999 | |
Pokitto | 0:e8b8f36b4505 | 1000 | #if POK_STRETCH |
Pokitto | 0:e8b8f36b4505 | 1001 | if (x&1) { |
Pokitto | 0:e8b8f36b4505 | 1002 | write_command(0x20); // Horizontal DRAM Address |
Pokitto | 0:e8b8f36b4505 | 1003 | write_data(yoffset); // 0 |
Pokitto | 0:e8b8f36b4505 | 1004 | write_command(0x21); // Vertical DRAM Address |
Pokitto | 0:e8b8f36b4505 | 1005 | write_data(xptr++); |
Pokitto | 0:e8b8f36b4505 | 1006 | write_command(0x22); // write data to DRAM |
Pokitto | 0:e8b8f36b4505 | 1007 | CLR_CS_SET_CD_RD_WR; |
Pokitto | 0:e8b8f36b4505 | 1008 | //setDRAMptr(xptr++,yoffset); |
Pokitto | 0:e8b8f36b4505 | 1009 | |
Pokitto | 0:e8b8f36b4505 | 1010 | for (s=0;s<64;) { |
Pokitto | 0:e8b8f36b4505 | 1011 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1012 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1013 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1014 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1015 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1016 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1017 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1018 | setup_data_16(scanline[s++]);CLR_WR;SET_WR;CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1019 | } |
Pokitto | 0:e8b8f36b4505 | 1020 | } |
Pokitto | 0:e8b8f36b4505 | 1021 | #endif |
Pokitto | 0:e8b8f36b4505 | 1022 | } |
Pokitto | 0:e8b8f36b4505 | 1023 | } |
Pokitto | 0:e8b8f36b4505 | 1024 | |
Pokitto | 0:e8b8f36b4505 | 1025 | void Pokitto::lcdRefreshModeGBC(uint8_t * scrbuf, uint16_t* paletteptr) { |
Pokitto | 0:e8b8f36b4505 | 1026 | uint16_t x,y,xptr; |
Pokitto | 0:e8b8f36b4505 | 1027 | uint16_t scanline[4][144]; // read 4 half-nibbles = 4 pixels at a time |
Pokitto | 0:e8b8f36b4505 | 1028 | uint8_t *d, yoffset=0; |
Pokitto | 0:e8b8f36b4505 | 1029 | |
Pokitto | 0:e8b8f36b4505 | 1030 | xptr = 0; |
Pokitto | 0:e8b8f36b4505 | 1031 | setDRAMptr(xptr,yoffset); |
Pokitto | 0:e8b8f36b4505 | 1032 | |
Pokitto | 0:e8b8f36b4505 | 1033 | |
Pokitto | 0:e8b8f36b4505 | 1034 | for(x=0;x<160;x+=4) |
Pokitto | 0:e8b8f36b4505 | 1035 | { |
Pokitto | 0:e8b8f36b4505 | 1036 | d = scrbuf+(x>>2);// point to beginning of line in data |
Pokitto | 0:e8b8f36b4505 | 1037 | /** find colours in one scanline **/ |
Pokitto | 0:e8b8f36b4505 | 1038 | uint8_t s=0; |
Pokitto | 0:e8b8f36b4505 | 1039 | for(y=0;y<144;y++) |
Pokitto | 0:e8b8f36b4505 | 1040 | { |
Pokitto | 0:e8b8f36b4505 | 1041 | uint8_t tdata = *d; |
Pokitto | 0:e8b8f36b4505 | 1042 | uint8_t t4 = tdata & 0x03; tdata >>= 2;// lowest half-nibble |
Pokitto | 0:e8b8f36b4505 | 1043 | uint8_t t3 = tdata & 0x03; tdata >>= 2;// second lowest half-nibble |
Pokitto | 0:e8b8f36b4505 | 1044 | uint8_t t2 = tdata & 0x03; tdata >>= 2;// second highest half-nibble |
Pokitto | 0:e8b8f36b4505 | 1045 | uint8_t t = tdata & 0x03;// highest half-nibble |
Pokitto | 0:e8b8f36b4505 | 1046 | |
Pokitto | 0:e8b8f36b4505 | 1047 | /** put nibble values in the scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 1048 | |
Pokitto | 0:e8b8f36b4505 | 1049 | scanline[0][s] = paletteptr[t]; |
Pokitto | 0:e8b8f36b4505 | 1050 | scanline[1][s] = paletteptr[t2]; |
Pokitto | 0:e8b8f36b4505 | 1051 | scanline[2][s] = paletteptr[t3]; |
Pokitto | 0:e8b8f36b4505 | 1052 | scanline[3][s++] = paletteptr[t4]; |
Pokitto | 0:e8b8f36b4505 | 1053 | |
Pokitto | 0:e8b8f36b4505 | 1054 | d+=160/4; // jump to read byte directly below in screenbuffer |
Pokitto | 0:e8b8f36b4505 | 1055 | } |
Pokitto | 0:e8b8f36b4505 | 1056 | |
Pokitto | 0:e8b8f36b4505 | 1057 | s=0; |
Pokitto | 0:e8b8f36b4505 | 1058 | /** draw scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 1059 | for (s=0;s<144;) { |
Pokitto | 0:e8b8f36b4505 | 1060 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1061 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1062 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1063 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1064 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1065 | setup_data_16(scanline[0][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1066 | } |
Pokitto | 0:e8b8f36b4505 | 1067 | setDRAMptr(++xptr,yoffset); |
Pokitto | 0:e8b8f36b4505 | 1068 | for (s=0;s<144;) { |
Pokitto | 0:e8b8f36b4505 | 1069 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1070 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1071 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1072 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1073 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1074 | setup_data_16(scanline[1][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1075 | } |
Pokitto | 0:e8b8f36b4505 | 1076 | setDRAMptr(++xptr,yoffset); |
Pokitto | 0:e8b8f36b4505 | 1077 | for (s=0;s<144;) { |
Pokitto | 0:e8b8f36b4505 | 1078 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1079 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1080 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1081 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1082 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1083 | setup_data_16(scanline[2][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1084 | } |
Pokitto | 0:e8b8f36b4505 | 1085 | setDRAMptr(++xptr,yoffset); |
Pokitto | 0:e8b8f36b4505 | 1086 | for (s=0;s<144;) { |
Pokitto | 0:e8b8f36b4505 | 1087 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1088 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1089 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1090 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1091 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1092 | setup_data_16(scanline[3][s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1093 | } |
Pokitto | 0:e8b8f36b4505 | 1094 | setDRAMptr(++xptr,yoffset); |
Pokitto | 0:e8b8f36b4505 | 1095 | } |
Pokitto | 0:e8b8f36b4505 | 1096 | } |
Pokitto | 0:e8b8f36b4505 | 1097 | |
Pokitto | 0:e8b8f36b4505 | 1098 | |
Pokitto | 0:e8b8f36b4505 | 1099 | void Pokitto::lcdRefreshT1(uint8_t* tilebuf, uint8_t* tilecolorbuf, uint8_t* tileset, uint16_t* paletteptr) { |
Pokitto | 2:968589ca3484 | 1100 | #ifdef POK_TILEMODE |
Pokitto | 0:e8b8f36b4505 | 1101 | uint16_t x,y,data,xptr; |
Pokitto | 0:e8b8f36b4505 | 1102 | uint16_t scanline[176]; |
Pokitto | 0:e8b8f36b4505 | 1103 | uint8_t yoffset=0, tilebyte, tileindex, tilex=0, tiley=0,xcount; |
Pokitto | 0:e8b8f36b4505 | 1104 | |
Pokitto | 2:968589ca3484 | 1105 | |
Pokitto | 0:e8b8f36b4505 | 1106 | if (!tileset) return; |
Pokitto | 0:e8b8f36b4505 | 1107 | |
Pokitto | 0:e8b8f36b4505 | 1108 | #if LCDWIDTH < POK_LCD_W |
Pokitto | 0:e8b8f36b4505 | 1109 | xptr = (POK_LCD_W-LCDWIDTH)/2; |
Pokitto | 0:e8b8f36b4505 | 1110 | #else |
Pokitto | 0:e8b8f36b4505 | 1111 | xptr = 0; |
Pokitto | 0:e8b8f36b4505 | 1112 | #endif |
Pokitto | 0:e8b8f36b4505 | 1113 | #if LCDHEIGHT < POK_LCD_H |
Pokitto | 0:e8b8f36b4505 | 1114 | yoffset = (POK_LCD_H-LCDHEIGHT)/2; |
Pokitto | 0:e8b8f36b4505 | 1115 | #else |
Pokitto | 0:e8b8f36b4505 | 1116 | yoffset = 0; |
Pokitto | 0:e8b8f36b4505 | 1117 | #endif |
Pokitto | 0:e8b8f36b4505 | 1118 | |
Pokitto | 0:e8b8f36b4505 | 1119 | for(x=0, xcount=0 ;x<LCDWIDTH;x++,xcount++) // loop through vertical columns |
Pokitto | 0:e8b8f36b4505 | 1120 | { |
Pokitto | 0:e8b8f36b4505 | 1121 | setDRAMptr(xptr++,yoffset); //point to VRAM |
Pokitto | 0:e8b8f36b4505 | 1122 | |
Pokitto | 0:e8b8f36b4505 | 1123 | /** find colours in one scanline **/ |
Pokitto | 0:e8b8f36b4505 | 1124 | uint8_t s=0, tiley=0; |
Pokitto | 0:e8b8f36b4505 | 1125 | //tileindex = tilebuf[tilex*POK_TILES_Y]; |
Pokitto | 0:e8b8f36b4505 | 1126 | if (xcount==POK_TILE_W) { |
Pokitto | 0:e8b8f36b4505 | 1127 | tilex++; |
Pokitto | 0:e8b8f36b4505 | 1128 | xcount=0; |
Pokitto | 0:e8b8f36b4505 | 1129 | } |
Pokitto | 0:e8b8f36b4505 | 1130 | |
Pokitto | 0:e8b8f36b4505 | 1131 | for(y=0;y<LCDHEIGHT;) |
Pokitto | 0:e8b8f36b4505 | 1132 | { |
Pokitto | 0:e8b8f36b4505 | 1133 | uint8_t tileval = tilebuf[tilex+tiley*POK_TILES_X]; //get tile number |
Pokitto | 0:e8b8f36b4505 | 1134 | uint16_t index = tileval*POK_TILE_W+xcount; |
Pokitto | 0:e8b8f36b4505 | 1135 | uint8_t tilebyte = tileset[index]; //get bitmap data |
Pokitto | 0:e8b8f36b4505 | 1136 | for (uint8_t ycount=0, bitcount=0; ycount<POK_TILE_H; ycount++, y++, bitcount++) { |
Pokitto | 0:e8b8f36b4505 | 1137 | if (bitcount==8) { |
Pokitto | 0:e8b8f36b4505 | 1138 | bitcount=0; |
Pokitto | 0:e8b8f36b4505 | 1139 | index += 176; //jump to byte below in the tileset bitmap |
Pokitto | 0:e8b8f36b4505 | 1140 | tilebyte = tileset[index]; //get bitmap data |
Pokitto | 0:e8b8f36b4505 | 1141 | } |
Pokitto | 0:e8b8f36b4505 | 1142 | //tilebyte = tile[(tileindex>>4)+*POK_TILE_W]; //tilemaps are 16x16 |
Pokitto | 0:e8b8f36b4505 | 1143 | //uint8_t paletteindex = ((tilebyte>>(bitcount&0x7)) & 0x1); |
Pokitto | 0:e8b8f36b4505 | 1144 | if (!tileval) scanline[s++] = COLOR_MAGENTA*((tilebyte>>bitcount)&0x1);//paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 1145 | else scanline[s++] = paletteptr[((tilebyte>>bitcount)&0x1)*tileval];//paletteptr[paletteindex]; |
Pokitto | 0:e8b8f36b4505 | 1146 | } |
Pokitto | 0:e8b8f36b4505 | 1147 | tiley++; //move to next tile |
Pokitto | 0:e8b8f36b4505 | 1148 | } |
Pokitto | 0:e8b8f36b4505 | 1149 | s=0; |
Pokitto | 0:e8b8f36b4505 | 1150 | |
Pokitto | 0:e8b8f36b4505 | 1151 | /** draw scanlines **/ |
Pokitto | 0:e8b8f36b4505 | 1152 | for (s=0;s<LCDHEIGHT;) { |
Pokitto | 0:e8b8f36b4505 | 1153 | setup_data_16(scanline[s++]);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1154 | } |
Pokitto | 0:e8b8f36b4505 | 1155 | } |
Pokitto | 0:e8b8f36b4505 | 1156 | #endif |
Pokitto | 0:e8b8f36b4505 | 1157 | } |
Pokitto | 0:e8b8f36b4505 | 1158 | |
Pokitto | 0:e8b8f36b4505 | 1159 | void Pokitto::blitWord(uint16_t c) { |
Pokitto | 0:e8b8f36b4505 | 1160 | setup_data_16(c);CLR_WR;SET_WR; |
Pokitto | 0:e8b8f36b4505 | 1161 | } |
Pokitto | 0:e8b8f36b4505 | 1162 |