mirror of
https://github.com/YuzuZensai/MCUFRIEND_kbv.git
synced 2026-01-31 14:57:48 +00:00
move OPENSMART, TFT_HX8357GLUE to unused
This commit is contained in:
20
extras/unused/OPENSMART_kbv.cpp
Normal file
20
extras/unused/OPENSMART_kbv.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
// this will avoid any library editing
|
||||
//
|
||||
// but the sketch must use specific OPENSMART_kbv class constructor
|
||||
|
||||
#define USE_SPECIAL //SPECIAL will use the first match
|
||||
//#define USE_OPENSMART_SHIELD_PINOUT //deprecated
|
||||
//select the target board
|
||||
#define USE_OPENSMART_SHIELD_PINOUT_UNO
|
||||
#define USE_OPENSMART_SHIELD_PINOUT_MEGA
|
||||
#define USE_OPENSMART_SHIELD_PINOUT_DUE //thanks Michel53
|
||||
//select the target controllers that are not enabled by default
|
||||
#define SUPPORT_8352A //HX8352A
|
||||
#define SUPPORT_8352B //HX8352B
|
||||
#define SUPPORT_9225 //RM68130
|
||||
|
||||
#include "OPENSMART_kbv.h" //class declaration
|
||||
|
||||
#define MCUFRIEND_kbv OPENSMART_kbv //rename the class scope
|
||||
|
||||
#include "MCUFRIEND_kbv.cpp" //same methods, but with OPENSMART_kbv class scope
|
||||
78
extras/unused/OPENSMART_kbv.h
Normal file
78
extras/unused/OPENSMART_kbv.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* OPENSMART_kbv class inherits from Adafruit_GFX class and the Arduino Print class.
|
||||
* Any use of OPENSMART_kbv class and examples is dependent on Adafruit and Arduino licenses
|
||||
* The license texts are in the accompanying license.txt file
|
||||
*/
|
||||
|
||||
#ifndef OPENSMART_KBV_H_
|
||||
#define OPENSMART_KBV_H_ 101 //version number
|
||||
#define MCUFRIEND_KBV_H_ OPENSMART_KBV_H_ //guard against any MCUFRIEND_kbv.h include
|
||||
|
||||
//#define USE_SERIAL
|
||||
|
||||
#if ARDUINO < 101
|
||||
#define USE_GFX_KBV
|
||||
#include "ADA_GFX_kbv.h"
|
||||
#else
|
||||
#include "Adafruit_GFX.h"
|
||||
#endif
|
||||
|
||||
class OPENSMART_kbv : public Adafruit_GFX {
|
||||
|
||||
public:
|
||||
// OPENSMART_kbv(int CS=A3, int RS=A2, int WR=A1, int RD=A0, int RST=A4); //shield wiring
|
||||
OPENSMART_kbv(int CS=0, int RS=0, int WR=0, int RD=0, int _RST=0); //dummy arguments
|
||||
void reset(void); // you only need the constructor
|
||||
void begin(uint16_t ID = 0x9341); // you only need the constructor
|
||||
virtual void drawPixel(int16_t x, int16_t y, uint16_t color); // and these three
|
||||
void WriteCmdData(uint16_t cmd, uint16_t dat); // ?public methods !!!
|
||||
void pushCommand(uint16_t cmd, uint8_t * block, int8_t N);
|
||||
uint16_t color565(uint8_t r, uint8_t g, uint8_t b) { return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3); }
|
||||
uint16_t readID(void);
|
||||
virtual void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { fillRect(x, y, 1, h, color); }
|
||||
virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) { fillRect(x, y, w, 1, color); }
|
||||
virtual void fillScreen(uint16_t color) { fillRect(0, 0, _width, _height, color); }
|
||||
virtual void setRotation(uint8_t r);
|
||||
virtual void invertDisplay(bool i);
|
||||
|
||||
uint16_t readReg(uint16_t reg, int8_t index=0);
|
||||
int16_t readGRAM(int16_t x, int16_t y, uint16_t *block, int16_t w, int16_t h);
|
||||
uint16_t readPixel(int16_t x, int16_t y) { uint16_t color; readGRAM(x, y, &color, 1, 1); return color; }
|
||||
void setAddrWindow(int16_t x, int16_t y, int16_t x1, int16_t y1);
|
||||
void pushColors(uint16_t *block, int16_t n, bool first);
|
||||
void pushColors(uint8_t *block, int16_t n, bool first);
|
||||
void pushColors(const uint8_t *block, int16_t n, bool first, bool bigend = false);
|
||||
void vertScroll(int16_t top, int16_t scrollines, int16_t offset);
|
||||
|
||||
protected:
|
||||
uint32_t readReg32(uint16_t reg);
|
||||
uint32_t readReg40(uint16_t reg);
|
||||
uint16_t _lcd_xor, _lcd_capable;
|
||||
|
||||
private:
|
||||
uint16_t _lcd_ID, _lcd_rev, _lcd_madctl, _lcd_drivOut, _MC, _MP, _MW, _SC, _EC, _SP, _EP;
|
||||
};
|
||||
|
||||
// New color definitions. thanks to Bodmer
|
||||
#define TFT_BLACK 0x0000 /* 0, 0, 0 */
|
||||
#define TFT_NAVY 0x000F /* 0, 0, 128 */
|
||||
#define TFT_DARKGREEN 0x03E0 /* 0, 128, 0 */
|
||||
#define TFT_DARKCYAN 0x03EF /* 0, 128, 128 */
|
||||
#define TFT_MAROON 0x7800 /* 128, 0, 0 */
|
||||
#define TFT_PURPLE 0x780F /* 128, 0, 128 */
|
||||
#define TFT_OLIVE 0x7BE0 /* 128, 128, 0 */
|
||||
#define TFT_LIGHTGREY 0xC618 /* 192, 192, 192 */
|
||||
#define TFT_DARKGREY 0x7BEF /* 128, 128, 128 */
|
||||
#define TFT_BLUE 0x001F /* 0, 0, 255 */
|
||||
#define TFT_GREEN 0x07E0 /* 0, 255, 0 */
|
||||
#define TFT_CYAN 0x07FF /* 0, 255, 255 */
|
||||
#define TFT_RED 0xF800 /* 255, 0, 0 */
|
||||
#define TFT_MAGENTA 0xF81F /* 255, 0, 255 */
|
||||
#define TFT_YELLOW 0xFFE0 /* 255, 255, 0 */
|
||||
#define TFT_WHITE 0xFFFF /* 255, 255, 255 */
|
||||
#define TFT_ORANGE 0xFDA0 /* 255, 180, 0 */
|
||||
#define TFT_GREENYELLOW 0xB7E0 /* 180, 255, 0 */
|
||||
#define TFT_PINK 0xFC9F
|
||||
|
||||
#endif
|
||||
172
extras/unused/TFT_HX8357GLUE.h
Normal file
172
extras/unused/TFT_HX8357GLUE.h
Normal file
@@ -0,0 +1,172 @@
|
||||
// NOT FOR PUBLIC USE
|
||||
|
||||
#define HX8357_BLACK 0x0000
|
||||
#define HX8357_BLUE 0x001F
|
||||
#define HX8357_RED 0xF800
|
||||
#define HX8357_GREEN 0x07E0
|
||||
#define HX8357_CYAN 0x07FF
|
||||
#define HX8357_MAGENTA 0xF81F
|
||||
#define HX8357_YELLOW 0xFFE0
|
||||
#define HX8357_WHITE 0xFFFF
|
||||
|
||||
//#include <Adafruit_GFX.h> // Core graphics library
|
||||
#include <MCUFRIEND_kbv.h> // Hardware-specific library
|
||||
#if !defined(AVR)
|
||||
#include <avr/dtostrf.h>
|
||||
#endif
|
||||
|
||||
#include <Fonts/FreeSans9pt7b.h>
|
||||
#include <Fonts/FreeSans12pt7b.h>
|
||||
#include <Fonts/FreeSans18pt7b.h>
|
||||
#include <Fonts/FreeSerifItalic12pt7b.h>
|
||||
#include <Fonts/FreeMonoBold24pt7b.h>
|
||||
|
||||
const GFXfont *Fonts[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
&FreeSans9pt7b,
|
||||
NULL,
|
||||
&FreeSans12pt7b,
|
||||
NULL,
|
||||
&FreeSans18pt7b,
|
||||
&FreeSerifItalic12pt7b,
|
||||
&FreeMonoBold24pt7b,
|
||||
};
|
||||
#define TFT_BLACK 0x0000
|
||||
#define TFT_NAVY 0x000F
|
||||
#define TFT_DARKGREEN 0x03E0
|
||||
#define TFT_DARKCYAN 0x03EF
|
||||
#define TFT_MAROON 0x7800
|
||||
#define TFT_PURPLE 0x780F
|
||||
#define TFT_OLIVE 0x7BE0
|
||||
#define TFT_LIGHTGREY 0xC618
|
||||
#define TFT_DARKGREY 0x7BEF
|
||||
#define TFT_BLUE 0x001F
|
||||
#define TFT_GREEN 0x07E0
|
||||
#define TFT_CYAN 0x07FF
|
||||
#define TFT_RED 0xF800
|
||||
#define TFT_MAGENTA 0xF81F
|
||||
#define TFT_YELLOW 0xFFE0
|
||||
#define TFT_WHITE 0xFFFF
|
||||
#define TFT_ORANGE 0xFD20
|
||||
#define TFT_GREENYELLOW 0xAFE5
|
||||
#define TFT_PINK 0xF81F
|
||||
|
||||
#define MC_DATUM 4
|
||||
|
||||
class TFT_HX8357GLUE : public MCUFRIEND_kbv
|
||||
{
|
||||
public:
|
||||
TFT_HX8357GLUE() {}
|
||||
void begin(void) {
|
||||
init();
|
||||
}
|
||||
void init(void)
|
||||
{
|
||||
MCUFRIEND_kbv::reset();
|
||||
_ID = MCUFRIEND_kbv::readID();
|
||||
if (_ID == 0x00D3 || _ID == 0xD3D3)
|
||||
_ID = 0x9486;
|
||||
MCUFRIEND_kbv::begin(_ID);
|
||||
MCUFRIEND_kbv::setRotation(1);
|
||||
_first = true;
|
||||
}
|
||||
void setWindow(int16_t x0, int16_t y0, int16_t x1, int16_t y1)
|
||||
{
|
||||
MCUFRIEND_kbv::setAddrWindow(x0, y0, x1, y1);
|
||||
_first = true;
|
||||
}
|
||||
|
||||
void pushColors(uint8_t *data, uint16_t len)
|
||||
{
|
||||
MCUFRIEND_kbv::pushColors((uint8_t*)data, len, _first);
|
||||
_first = false;
|
||||
}
|
||||
|
||||
void pushColors(uint16_t *data, uint8_t len)
|
||||
{
|
||||
MCUFRIEND_kbv::pushColors((uint16_t*)data, len, _first);
|
||||
_first = false;
|
||||
}
|
||||
|
||||
void pushColors(uint16_t *data, uint16_t len, int first)
|
||||
{
|
||||
MCUFRIEND_kbv::pushColors((uint16_t*)data, len, first);
|
||||
}
|
||||
|
||||
void pushColor(uint16_t color)
|
||||
{
|
||||
uint16_t c = color;
|
||||
MCUFRIEND_kbv::pushColors(&c, 1, _first);
|
||||
_first = false;
|
||||
}
|
||||
|
||||
void setCursor(int16_t x, int16_t y)
|
||||
{
|
||||
setCursor(x, y, _font);
|
||||
}
|
||||
|
||||
void setCursor(int16_t x, int16_t y, uint8_t idx)
|
||||
{
|
||||
|
||||
const GFXfont *f = Fonts[idx];
|
||||
MCUFRIEND_kbv::setFont(f);
|
||||
// MCUFRIEND_kbv::setCursor(x, y + f->glyph->height);
|
||||
|
||||
MCUFRIEND_kbv::setCursor(x, y);
|
||||
}
|
||||
|
||||
void setTextFont(uint8_t font)
|
||||
{
|
||||
_font = font;
|
||||
MCUFRIEND_kbv::setFont(Fonts[_font]);
|
||||
}
|
||||
|
||||
int16_t drawNumber(long long_num, int16_t poX, int16_t poY, int16_t idx)
|
||||
{
|
||||
char buf[12];
|
||||
ltoa(long_num, buf, 10);
|
||||
return drawString(buf, poX, poY, idx);
|
||||
}
|
||||
|
||||
int16_t drawChar(char c, int16_t poX, int16_t poY, int16_t idx)
|
||||
{
|
||||
char buf[2];
|
||||
buf[0] = c;
|
||||
buf[1] = 0;
|
||||
return drawString(buf, poX, poY, idx);
|
||||
}
|
||||
|
||||
int16_t drawString(char *string, int16_t poX, int16_t poY, int16_t idx)
|
||||
{
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
setFont(Fonts[_font = idx]);
|
||||
getTextBounds(string, poX, poY, &x1, &y1, &w, &h);
|
||||
fillRect(x1, y1 + h, w, h, 0x0000);
|
||||
MCUFRIEND_kbv::setCursor(poX, poY + h);
|
||||
print(string);
|
||||
return w;
|
||||
}
|
||||
int16_t drawCentreString(char *string, int16_t poX, int16_t poY, int16_t idx)
|
||||
{
|
||||
int16_t x1, y1;
|
||||
uint16_t w, h;
|
||||
setFont(Fonts[_font = idx]);
|
||||
getTextBounds(string, poX, poY, &x1, &y1, &w, &h);
|
||||
poX -= w/2;
|
||||
x1 -= w/2;
|
||||
fillRect(x1, y1 + h, w, h, 0x0000);
|
||||
MCUFRIEND_kbv::setCursor(poX, poY + h);
|
||||
print(string);
|
||||
return w;
|
||||
// return drawString(string, dX, poY, idx);
|
||||
}
|
||||
void setTextDatum(uint8_t datum) { ; }
|
||||
void setTextPadding(uint16_t x_width) { ; }
|
||||
|
||||
private:
|
||||
uint16_t _ID;
|
||||
uint8_t _font, _first;
|
||||
};
|
||||
|
||||
179
extras/unused/appnote_himax.sed
Normal file
179
extras/unused/appnote_himax.sed
Normal file
@@ -0,0 +1,179 @@
|
||||
#n does not work. use nsed -n
|
||||
|
||||
######################################################################
|
||||
# nsed -f pagebreak.sed file.txt | nsed -n -f appnote_himax.sed
|
||||
|
||||
# copy-paste Ilitek App Note examples to xxx.txt
|
||||
# ditto Renesas, Himax, ...
|
||||
# or just pipe UTFT initlcd.h through
|
||||
|
||||
# parse Ilitek App Note sequence. e.g.
|
||||
# LCD_ILI9486_CMD(0XF2);
|
||||
# LCD_ILI9486_INDEX(0x18);
|
||||
# Delayms(1); // Delay 1ms
|
||||
|
||||
# parse GalaxyCore App Note sequence. e.g.
|
||||
# LCD_ GC9102_CMD(0XF2);
|
||||
# LCD_ GC9102_DATA(0x18);
|
||||
# delayms(1); // Delay 1ms
|
||||
|
||||
# parse Himax App Note sequence. e.g.
|
||||
# Set_NOKIA_8B_CMD(0XF2);
|
||||
# Set_NOKIA_8B_PA(0x18);
|
||||
# DelayX1ms(1); // Delay 1ms
|
||||
|
||||
# parse Renesas App Note sequence. e.g.
|
||||
# {setc, 0x000F2}
|
||||
# {setp, 0x00018}
|
||||
# {time, 0040,ms}
|
||||
|
||||
# parse UTFT sequence. e.g.
|
||||
# LCD_Write_COM(0XF2);
|
||||
# LCD_Write_DATA(0x18);
|
||||
# delay(1); // Delay 1ms
|
||||
|
||||
# parse EastRising sequence. e.g.
|
||||
# Write_Cmd(0XF2);
|
||||
# Write_Cmd_Data(0x18);
|
||||
# delayms(1); // Delay 1ms
|
||||
|
||||
:Ilitek
|
||||
# remove leading white space
|
||||
s/^[ ]*//
|
||||
# //comment// to //comment
|
||||
s/----\/\/$/----/
|
||||
# //comment to /* comment */
|
||||
s/[/][/]\(.*\)/\/\*\1\*\/ /
|
||||
# change to consistent CMD syntax
|
||||
s/LCD_ILI9..._CMD_INDEX/LCD_Write_COM/
|
||||
s/LCD_ILI9..._CMD/LCD_Write_COM/
|
||||
s/LCD_ GC9102_CMD/LCD_Write_COM/
|
||||
s/r61581_cmd/LCD_Write_COM/
|
||||
s/LV_DRV_DELAY_MS/delay/
|
||||
s/LCD_Write_COM_DATA(\(.*\),\(.*\));/ (\1), 1, \2, /
|
||||
s/IO.writeCommandTransaction/LCD_Write_COM/
|
||||
s/Delayms/delay/
|
||||
s/Set_NOKIA_8B_CMD/LCD_Write_COM/
|
||||
s/DelayX1ms/delay/
|
||||
s/Lcd_Write_Com/LCD_Write_COM/
|
||||
s/lcdWriteReg(0x00/LCD_Write_COM(0x/
|
||||
s/writecommand/LCD_Write_COM/
|
||||
s/{setc,.* 0x000\(..\)}/LCD_Write_COM(0x\1);/
|
||||
s/{time, 0*\(.*\),ms}/delay(\1);/
|
||||
s/delayms/delay/
|
||||
s/GUI_Delay/delay/
|
||||
s/Write_Cmd_Data/LCD_Write_DATA/
|
||||
s/Write_Cmd/LCD_Write_COM/
|
||||
s/lcdWriteData(0x00/LCD_Write_DATA(0x/
|
||||
s/LCD_WR_REG(/LCD_Write_COM(/
|
||||
s/LCD_Write_COM *(/LCD_Write_COM(/
|
||||
/LCD_Write_COM(/b good
|
||||
/delay(/b good
|
||||
b print
|
||||
{
|
||||
:good
|
||||
h
|
||||
:args
|
||||
n
|
||||
s/^[ ]*//
|
||||
s/[ ]*\/\/[VP][0-9]+$//
|
||||
s/[/][/]\(.*\)/ \/\*\1\*\/ /
|
||||
s/LCD_ILI9..._CMD_PAs/LCD_Write_DATA/
|
||||
s/LCD_ILI9..._INDEX/LCD_Write_DATA/
|
||||
s/LCD_ILI9..._ Parameter/LCD_Write_DATA/
|
||||
s/LCD_ GC9102_DATA/LCD_Write_DATA/
|
||||
s/r61581_data/LCD_Write_DATA/
|
||||
s/IO.writeDataTransaction/LCD_Write_DATA/
|
||||
s/Set_NOKIA_8B_PA/LCD_Write_DATA/
|
||||
s/DelayX1ms/delay/
|
||||
s/{setp,.* 0x000\(..\)}/LCD_Write_DATA(0x\1);/
|
||||
s/{setp,.* 0x00\(...\)}/LCD_Write_DATA(0x\1);/
|
||||
# s/{time, 0*\(.*\),ms}/delay(\1)/
|
||||
s/LCD_Write_DATA_8/LCD_Write_DATA/
|
||||
s/Lcd_Write_Data/LCD_Write_DATA/
|
||||
s/lcdWriteData(0x00/LCD_Write_DATA(0x/
|
||||
s/writedata/LCD_Write_DATA/
|
||||
s/delayms/delay/
|
||||
s/Write_Cmd_Data/LCD_Write_DATA/
|
||||
s/LCD_WR_DATA(/LCD_Write_DATA(/
|
||||
s/LCD_Write_DATA *(/LCD_Write_DATA(/
|
||||
#kludges for inconsistent syntax in Ilitek PDF
|
||||
s/;)$/);/
|
||||
s/)$/);/
|
||||
s/;;/;/
|
||||
# append any data to Hold space
|
||||
/LCD_Write_DATA(/{
|
||||
H
|
||||
b args
|
||||
}
|
||||
/^$/b args
|
||||
x
|
||||
# parse command byte to (0xNN),
|
||||
s/LCD_Write_COM(\([^)]+\)/ (\1)/
|
||||
s/(0[xX]00\(..\))/(0x\1)/
|
||||
# parse data byte to 0xNN,
|
||||
s/\nLCD_Write_DATA(//g
|
||||
# parse delay times
|
||||
s/delay(\(.+\));/ TFTLCD_DELAY8, \1, /
|
||||
s/)\;/,/g
|
||||
s/0X/0x/g
|
||||
s/0x,/0x00,/g
|
||||
s/;,/,/
|
||||
w 9806.out
|
||||
# attempt to calculate number of parameters. show #ERROR# if > 16
|
||||
/0x..),.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,.*,/s/),/),#ERROR#,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/),16,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/),15,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/),14,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/),13,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/),12,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/),11,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/),10,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/), 9,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/), 8,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/), 7,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/), 6,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,.*0x..,/s/),/), 5,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,.*0x..,/s/),/), 4,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,.*0x..,/s/),/), 3,/
|
||||
t counted
|
||||
/0x..),.*0x..,.*0x..,/s/),/), 2,/
|
||||
t counted
|
||||
/0x..),.*0x..,/s/),/), 1,/
|
||||
t counted
|
||||
/0x..),/s/),/), 0,/
|
||||
:counted
|
||||
# life is simpler with multiple whitespace reduced to single space
|
||||
s/[ ]+/ /g
|
||||
s/ $//
|
||||
#/(0x2C)/p
|
||||
# attempt to move first comment to end of line
|
||||
s/\((0x..),[ 1][0-9],\) \/\*\([^*]*\)\*\/ \(.*\)/\1 \3 \/\/\2/
|
||||
#s/\((0x..),[ 1][0-9],\) \(\/\*[^*]*\*\/\) \(.*\)/\1 \3 \2/
|
||||
#/0x..),[ 1][0-9],/s/ *\(\/\*[^*]*\*\/\) *\(.*\)/ \2 \1/
|
||||
p
|
||||
x
|
||||
b Ilitek
|
||||
}
|
||||
:print
|
||||
s/^[Vv]oid \(.*\)_Initial.*(void)/const unsigned char \1[] =/
|
||||
s/^void LCD_Initial_\(.*\)(void)/const unsigned char \1[] =/
|
||||
s/^void \(.*\)::init()/const unsigned char \1[] =/
|
||||
s/^}$/};/
|
||||
p
|
||||
|
||||
:end
|
||||
@@ -1,54 +0,0 @@
|
||||
#n does not work. use nsed -n
|
||||
|
||||
######################################################################
|
||||
# nsed -f pagebreak.sed file.txt | nsed -n -f appnote_ilitek.sed
|
||||
|
||||
# parse Ilitek App Note sequence. e.g.
|
||||
# LCD_ILI9486_CMD(0XF2);
|
||||
# LCD_ILI9486_INDEX(0x18);
|
||||
# Delayms(1); // Delay 1ms
|
||||
|
||||
:Ilitek
|
||||
# //Title line
|
||||
s/^[1-9].*/\/\/ &/
|
||||
# //comment to /* comment */
|
||||
s/[/][/]\(.*\)/\/\*\1\*\/ /
|
||||
s/_CMD_INDEX/_CMD/
|
||||
s/_CMD_PAs/_INDEX/
|
||||
s/_ Parameter (/_INDEX(/
|
||||
/LCD_ILI9..._CMD(/b good
|
||||
/Delayms(/b good
|
||||
b print
|
||||
{
|
||||
:good
|
||||
h
|
||||
:args
|
||||
n
|
||||
s/[/][/]\(.*\)/\/\*\1\*\/ /
|
||||
s/_CMD_INDEX/_CMD/
|
||||
s/_CMD_PAs/_INDEX/
|
||||
s/_ Parameter (/_INDEX(/
|
||||
# append any data to Hold space
|
||||
/LCD_ILI9..._INDEX(/{
|
||||
H
|
||||
b args
|
||||
}
|
||||
/^$/b args
|
||||
x
|
||||
# parse command byte to (0xNN),
|
||||
s/LCD_ILI9..._CMD(\([^)]+\)/ (\1)/
|
||||
# parse data byte to 0xNN,
|
||||
s/\nLCD_ILI9..._INDEX(//g
|
||||
# parse delay times
|
||||
s/Delayms(\(.+\));/ TFTLCD_DELAY8, \1, /
|
||||
s/)\;/,/g
|
||||
s/0X/0x/g
|
||||
s/,;/,/
|
||||
p
|
||||
x
|
||||
b Ilitek
|
||||
}
|
||||
:print
|
||||
p
|
||||
|
||||
:end
|
||||
@@ -1,55 +0,0 @@
|
||||
#n does not work. use nsed -n
|
||||
|
||||
######################################################################
|
||||
# nsed -f appnote_novatek.sed inputfile
|
||||
# produce output in: init_sequence.out
|
||||
# still requires removing some garbage.
|
||||
# adding array declaration, inserting argument count on each line.
|
||||
|
||||
# parse Novatek App Note sequence. e.g.
|
||||
# Lcd_Write_Com(0XF2);
|
||||
# Lcd_Write_Data(0x18);
|
||||
# delay(100);
|
||||
|
||||
:Novatek
|
||||
# trim any leading, trailing whitespace. Line scope comments
|
||||
s/^[\t ]*//
|
||||
s/[\t ]*$//
|
||||
s/[\t ]*[/][/]\(.*\)/ \/\*\1\*\/ /
|
||||
# block start
|
||||
/Lcd_Write_Com(/b good
|
||||
/delay(/b good
|
||||
b print
|
||||
{
|
||||
:good
|
||||
h
|
||||
:args
|
||||
n
|
||||
s/^[\t ]*//
|
||||
s/[\t ]*$//
|
||||
s/[\t ]*[/][/]\(.*\)/ \/\*\1\*\/ /
|
||||
# append any data to Hold space
|
||||
/Lcd_Write_Data(/{
|
||||
H
|
||||
b args
|
||||
}
|
||||
/^$/b args
|
||||
x
|
||||
# trim ( 0xNN ) to (0xNN)
|
||||
s/( */(/g
|
||||
s/ *)/)/g
|
||||
# parse command byte to (0xNN),
|
||||
s/Lcd_Write_Com(\([^)]+\)/ (\1)/
|
||||
# parse data byte to 0xNN,
|
||||
s/\nLcd_Write_Data(//g
|
||||
# parse delay times
|
||||
s/delay(\(.+\));/ TFTLCD_DELAY8, \1, /
|
||||
s/) *\;/,/g
|
||||
s/0X/0x/g
|
||||
s/,;/,/
|
||||
winit_sequence.out
|
||||
x
|
||||
b Novatek
|
||||
}
|
||||
:print
|
||||
:end
|
||||
@@ -1,47 +0,0 @@
|
||||
#n does not work. use nsed -n
|
||||
|
||||
######################################################################
|
||||
# parse Renesas App Note sequence. e.g.
|
||||
# {setc, [107], W, 0x000B0}
|
||||
# {setc, 0x000D0}
|
||||
# {setp, 0x00033}
|
||||
# {time, 0040,ms}
|
||||
|
||||
:Renesas
|
||||
# //Title line
|
||||
s/^[1-9].*/\/\/ &/
|
||||
# //comment to /* comment */
|
||||
s/[/][/]\(.*\)/\/\*\1\*\/ /
|
||||
/{setc,/b good
|
||||
/{time,/b good
|
||||
b print
|
||||
{
|
||||
:good
|
||||
h
|
||||
:args
|
||||
n
|
||||
s/[/][/]\(.*\)/\/\*\1\*\/ /
|
||||
# append any data to Hold space
|
||||
/setp/{
|
||||
H
|
||||
b args
|
||||
}
|
||||
# /^$/b args
|
||||
x
|
||||
# verbose format
|
||||
s/, \[[0-9]+\], W, 0x/, 0x/g
|
||||
# parse command byte to (0xNN),
|
||||
s/{setc, 0x000\(..\)}/ (0x\1), /
|
||||
# parse data byte to 0xNN,
|
||||
# s/\nLCD_ILI9486_INDEX(//g
|
||||
s/\n{setp, 0x000\(..\)}/0x\1, /g
|
||||
s/\n{setp, 0x00\(...\)}/0x\1, /g
|
||||
# parse delay times
|
||||
s/{time, 0*\(.*\),ms}/ TFTLCD_DELAY8, \1, /
|
||||
s/)\;/,/g
|
||||
p
|
||||
x
|
||||
b Renesas
|
||||
}
|
||||
:print
|
||||
p
|
||||
@@ -1,3 +1,21 @@
|
||||
# skip the PDF page footers.
|
||||
# skip the Ilitek PDF page footers.
|
||||
/^a-.*/,/^Page.*/d
|
||||
/^[0-9]+$/,/^.2010.*/d
|
||||
# skip the GalaxyCore PDF page headers.
|
||||
/^Page*/,/^132RGB.*/d
|
||||
# GalaxyCore //comment// to //comment
|
||||
s/----\/\/$/----/
|
||||
# skip the Himax PDF page footers.
|
||||
/^Him.ax Confidential*/,/^APPLICATION NOTE/d
|
||||
/^-P.*Himax Confidential*/,/^APPLICATION NOTE/d
|
||||
# skip the Renesas PDF page footers.
|
||||
/^[0-9]+$/,/Renesas SP Drivers/d
|
||||
#/Initial Code(/d
|
||||
# comment the Panel Title
|
||||
s/^[1-9]/\/\/ &/
|
||||
# remove Enter/Exit Sleep functions
|
||||
/^[Vv]oid.*Sleep/,/^}/d
|
||||
/^[Vv]oid.*Standby/,/^}/d
|
||||
# legal function name
|
||||
/^void/s/[.]//
|
||||
# remove hardware Reset sequence
|
||||
/Reset LCD Driver/,/Start Initial Sequence/d
|
||||
|
||||
Reference in New Issue
Block a user