Basic library for SHARP LCD LS027B4DH01/LS027B7DH01

Dependents:   AkiSpiLcd_demo AkiSpiLcd_demo2 LCDRAM AkiSpiLcd_example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MemoryLcd.cpp Source File

MemoryLcd.cpp

00001 /*
00002 Copyright (c) 2016 Kazuki Yamamoto <k.yamamoto.08136891@gmail.com>
00003 Permission is hereby granted, free of charge, to any person obtaining
00004 a copy of this software and associated documentation files
00005 (the "Software"), to deal in the Software without restriction,
00006 including without limitation the rights to use, copy, modify, merge,
00007 publish, distribute, sublicense, and/or sell copies of the Software,
00008 and to permit persons to whom the Software is furnished to do so,
00009 subject to the following conditions:
00010 The above copyright notice and this permission notice shall be
00011 included in all copies or substantial portions of the Software.
00012 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00013 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00014 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00015 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00016 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
00017 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
00018 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00019 */
00020 /** this is base class for Memory LCDs from SHARP or JDI
00021 * by Kazuki Yamamoto, or _K4ZUKI_
00022 */
00023 // #include "MemoryLcd.h"
00024 //
00025 // MemoryLCD::MemoryLCD(PinName mosi, PinName miso, PinName sck, PinName csl)
00026 //     : _spi(mosi, miso, sck), _csl(csl) {
00027 //   _csl = 0;
00028 //   _spi.format(8, 0);
00029 //   _spi.frequency(1000000);
00030 //   _comflag = 0;
00031 // }
00032 //
00033 // void MemoryLCD::cls() {
00034 //   _csl = 1;
00035 //
00036 //   _spi.write(LCD_MODE::CLEAR_SCREEN | (_comflag << 6));
00037 //   _spi.write(0x00);
00038 //
00039 //   _csl = 0;
00040 //
00041 //   cominvert();
00042 // }
00043 //
00044 // void MemoryLCD::directUpdateSingle(int line, uint8_t *data) {
00045 //   _csl = 1;
00046 //   if (line == 0) line = 1;
00047 //
00048 //   _spi.write(LCD_MODE::UPDATE | (_comflag << 6));
00049 //   _spi.write(line);
00050 //
00051 //   for (int i = 0; i < 50; i++) {
00052 //     _spi.write(*(data + i));
00053 //   }
00054 //   _spi.write(0x00);
00055 //   _spi.write(0x00);
00056 //
00057 //   _csl = 0;
00058 //
00059 //   cominvert();
00060 // }
00061 //
00062 // void MemoryLCD::directUpdateMulti(int line, int length, uint8_t *data) {
00063 //   _modeflag = 1;
00064 //   _clearflag = 0;
00065 //
00066 //   if (line == 0) line = 1;
00067 //
00068 //   if (length > 0) {
00069 //     _csl = 1;
00070 //
00071 //     for (int j = 1; j <= length; j++) {
00072 //       _spi.write(LCD_MODE::UPDATE | (_comflag << 6));
00073 //       _spi.write(line);
00074 //       for (int i = 0; i < 50; i++) {
00075 //         _spi.write(*(data + (50 * j + i)));  // hogepic[50*j+i]
00076 //       }
00077 //       line += 1;
00078 //     }
00079 //     _spi.write(0x00);
00080 //     _spi.write(0x00);
00081 //
00082 //     _csl = 0;
00083 //   }
00084 //   cominvert();
00085 // }
00086 //
00087 // void MemoryLCD::cominvert() {
00088 //   _csl = 1;
00089 //
00090 //   _spi.write(LCD_MODE::COM_INVERT | (_comflag << 6));
00091 //   _spi.write(0x00);
00092 //
00093 //   _csl = 0;
00094 //   if (_comflag == 0) {
00095 //     _comflag = 1;
00096 //   } else {
00097 //     _comflag = 0;
00098 //   }
00099 // }