cleaning...
This commit is contained in:
parent
98b10fdf93
commit
b5cc46c9ef
2 changed files with 11 additions and 44 deletions
|
|
@ -402,7 +402,6 @@ void TFT_ILI9163C::chipInit() {
|
||||||
writedata(0X00);
|
writedata(0X00);
|
||||||
writedata(_GRAMHEIGH);
|
writedata(_GRAMHEIGH);
|
||||||
|
|
||||||
//colorSpace(__COLORSPC);//set default colorspace and other access data
|
|
||||||
colorSpace(_colorspaceData);
|
colorSpace(_colorspaceData);
|
||||||
setRotation(0);
|
setRotation(0);
|
||||||
writecommand(CMD_DISPON);//display ON
|
writecommand(CMD_DISPON);//display ON
|
||||||
|
|
@ -411,7 +410,6 @@ void TFT_ILI9163C::chipInit() {
|
||||||
|
|
||||||
delay(1);
|
delay(1);
|
||||||
fillScreen(BLACK);
|
fillScreen(BLACK);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -425,9 +423,6 @@ void TFT_ILI9163C::colorSpace(uint8_t cspace) {
|
||||||
} else {
|
} else {
|
||||||
bitSet(_Mactrl_Data,3);
|
bitSet(_Mactrl_Data,3);
|
||||||
}
|
}
|
||||||
//writecommand(CMD_MADCTL);
|
|
||||||
//writedata(_Mactrl_Data);
|
|
||||||
//delay(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -442,7 +437,10 @@ void TFT_ILI9163C::homeAddress() {
|
||||||
setAddrWindow(0x00,0x00,_GRAMWIDTH-1,_GRAMHEIGH-1);
|
setAddrWindow(0x00,0x00,_GRAMWIDTH-1,_GRAMHEIGH-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TFT_ILI9163C::setCursor(int16_t x, int16_t y) {
|
void TFT_ILI9163C::setCursor(int16_t x, int16_t y) {
|
||||||
|
if (boundaryCheck(x,y)) return;
|
||||||
setAddrWindow(0x00,0x00,x,y);
|
setAddrWindow(0x00,0x00,x,y);
|
||||||
cursor_x = x;
|
cursor_x = x;
|
||||||
cursor_y = y;
|
cursor_y = y;
|
||||||
|
|
@ -451,7 +449,7 @@ void TFT_ILI9163C::setCursor(int16_t x, int16_t y) {
|
||||||
|
|
||||||
|
|
||||||
void TFT_ILI9163C::pushColor(uint16_t color) {
|
void TFT_ILI9163C::pushColor(uint16_t color) {
|
||||||
writedata16(color);
|
writedata16(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_ILI9163C::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
void TFT_ILI9163C::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@
|
||||||
0.2b1: Cleaned up.
|
0.2b1: Cleaned up.
|
||||||
0.2b3: Added 2.2" Red PCB parameters
|
0.2b3: Added 2.2" Red PCB parameters
|
||||||
0.2b4: Bug fixes, added colorSpace (for future send image)
|
0.2b4: Bug fixes, added colorSpace (for future send image)
|
||||||
|
0.2b5: Cleaning
|
||||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
BugList of the current version:
|
BugList of the current version:
|
||||||
|
|
||||||
|
|
@ -100,10 +101,7 @@
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(__MK20DX128__) || defined(__MK20DX256__)
|
#if defined(__MK20DX128__) || defined(__MK20DX256__)
|
||||||
// #include "mk20dx128.h"
|
|
||||||
// #include "core_pins.h"
|
|
||||||
#define __DMASPI
|
#define __DMASPI
|
||||||
|
|
||||||
#define CTAR_24MHz (SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0) | SPI_CTAR_DBR)
|
#define CTAR_24MHz (SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0) | SPI_CTAR_DBR)
|
||||||
#define CTAR_16MHz (SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0) | SPI_CTAR_DBR)
|
#define CTAR_16MHz (SPI_CTAR_PBR(1) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0) | SPI_CTAR_DBR)
|
||||||
#define CTAR_12MHz (SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0))
|
#define CTAR_12MHz (SPI_CTAR_PBR(0) | SPI_CTAR_BR(0) | SPI_CTAR_CSSCK(0))
|
||||||
|
|
@ -163,7 +161,7 @@ Not tested!
|
||||||
|
|
||||||
Note 2: This is the offset between image in RAM and TFT. In that case 160 - 128 = 32;
|
Note 2: This is the offset between image in RAM and TFT. In that case 160 - 128 = 32;
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------
|
//--------- Keep out hands from here!-------------
|
||||||
|
|
||||||
#define BLACK 0x0000
|
#define BLACK 0x0000
|
||||||
#define WHITE 0xFFFF
|
#define WHITE 0xFFFF
|
||||||
|
|
@ -171,15 +169,6 @@ Not tested!
|
||||||
//ILI9163C registers-----------------------
|
//ILI9163C registers-----------------------
|
||||||
#define CMD_NOP 0x00//Non operation
|
#define CMD_NOP 0x00//Non operation
|
||||||
#define CMD_SWRESET 0x01//Soft Reset
|
#define CMD_SWRESET 0x01//Soft Reset
|
||||||
// #define CMD_RDDID 0x04//Read Display Identification Information
|
|
||||||
// #define CMD_RDDST 0x09//Read Display Status
|
|
||||||
// #define CMD_RDMODE 0x0A//Read Display power mode
|
|
||||||
// #define CMD_RDMADCTL 0x0B//Read Display MADCTL (orientation)
|
|
||||||
// #define CMD_RDPIXFMT 0x0C//Read Display Pixel Format
|
|
||||||
// #define CMD_RDIMMDE 0x0D//Read Display Image Mode
|
|
||||||
// #define CMD_RDSNMDE 0x0E//Read Display Signal Mode
|
|
||||||
//#define CMD_RDSNMDE 0x0F//Read Display Signal Mode
|
|
||||||
|
|
||||||
#define CMD_SLPIN 0x10//Sleep ON
|
#define CMD_SLPIN 0x10//Sleep ON
|
||||||
#define CMD_SLPOUT 0x11//Sleep OFF
|
#define CMD_SLPOUT 0x11//Sleep OFF
|
||||||
#define CMD_PTLON 0x12//Partial Mode ON
|
#define CMD_PTLON 0x12//Partial Mode ON
|
||||||
|
|
@ -221,43 +210,24 @@ Not tested!
|
||||||
#define CMD_VCOMCTR1 0xC5//VCOM_Control 1
|
#define CMD_VCOMCTR1 0xC5//VCOM_Control 1
|
||||||
#define CMD_VCOMCTR2 0xC6//VCOM_Control 2
|
#define CMD_VCOMCTR2 0xC6//VCOM_Control 2
|
||||||
#define CMD_VCOMOFFS 0xC7//VCOM Offset Control
|
#define CMD_VCOMOFFS 0xC7//VCOM Offset Control
|
||||||
|
|
||||||
// #define CMD_WRID4VL 0xD3//Write ID4 Value
|
|
||||||
|
|
||||||
// #define CMD_NVMEMFC1 0xD5//NV Memory Function Controller(1)
|
|
||||||
// #define CMD_NVMEMFC2 0xD6//NV Memory Function Controller(1)
|
|
||||||
// #define CMD_NVMEMFC3 0xD7//NV Memory Function Controller(1)
|
|
||||||
// #define CMD_RDID1 0xDA//Read ID1
|
|
||||||
// #define CMD_RDID2 0xDB//Read ID2
|
|
||||||
// #define CMD_RDID3 0xDC//Read ID3
|
|
||||||
// #define CMD_RDID4 0xDD//Read ID4
|
|
||||||
#define CMD_PGAMMAC 0xE0//Positive Gamma Correction Setting
|
#define CMD_PGAMMAC 0xE0//Positive Gamma Correction Setting
|
||||||
#define CMD_NGAMMAC 0xE1//Negative Gamma Correction Setting
|
#define CMD_NGAMMAC 0xE1//Negative Gamma Correction Setting
|
||||||
#define CMD_GAMRSEL 0xF2//GAM_R_SEL
|
#define CMD_GAMRSEL 0xF2//GAM_R_SEL
|
||||||
|
|
||||||
|
|
||||||
// #define DTA_MADCTL_MX 0x40//0x40 or 00
|
|
||||||
// #define DTA_MADCTL_MY 0x80
|
|
||||||
// #define DTA_MADCTL_MV 0x20
|
|
||||||
// #define DTA_MADCTL_ML 0x10
|
|
||||||
// #define DTA_MADCTL_RGB 0x00
|
|
||||||
// #define DTA_MADCTL_BGR 0x08
|
|
||||||
// #define DTA_MADCTL_MH 0x04
|
|
||||||
|
|
||||||
|
|
||||||
class TFT_ILI9163C : public Adafruit_GFX {
|
class TFT_ILI9163C : public Adafruit_GFX {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TFT_ILI9163C(uint8_t cspin,uint8_t dcpin,uint8_t rstpin);
|
TFT_ILI9163C(uint8_t cspin,uint8_t dcpin,uint8_t rstpin);
|
||||||
TFT_ILI9163C(uint8_t CS, uint8_t DC);
|
TFT_ILI9163C(uint8_t CS, uint8_t DC);//connect rst pin to VDD
|
||||||
|
|
||||||
void begin(void),
|
void begin(void),
|
||||||
setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1),
|
setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1),//graphic Addressing
|
||||||
setCursor(int16_t x,int16_t y),
|
setCursor(int16_t x,int16_t y),//char addressing
|
||||||
pushColor(uint16_t color),
|
pushColor(uint16_t color),
|
||||||
fillScreen(uint16_t color=0x0000),
|
fillScreen(uint16_t color=0x0000),
|
||||||
clearScreen(uint16_t color=0x0000),
|
clearScreen(uint16_t color=0x0000),//same as fillScreen
|
||||||
drawPixel(int16_t x, int16_t y, uint16_t color),
|
drawPixel(int16_t x, int16_t y, uint16_t color),
|
||||||
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
|
drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color),
|
||||||
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
|
drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color),
|
||||||
|
|
@ -270,7 +240,6 @@ class TFT_ILI9163C : public Adafruit_GFX {
|
||||||
private:
|
private:
|
||||||
uint8_t _Mactrl_Data;//container for the memory access control data
|
uint8_t _Mactrl_Data;//container for the memory access control data
|
||||||
uint8_t _colorspaceData;
|
uint8_t _colorspaceData;
|
||||||
uint8_t tabcolor;
|
|
||||||
void colorSpace(uint8_t cspace);
|
void colorSpace(uint8_t cspace);
|
||||||
void writecommand(uint8_t c);
|
void writecommand(uint8_t c);
|
||||||
void writedata(uint8_t d);
|
void writedata(uint8_t d);
|
||||||
|
|
@ -287,7 +256,7 @@ class TFT_ILI9163C : public Adafruit_GFX {
|
||||||
|
|
||||||
#if defined(__SAM3X8E__)
|
#if defined(__SAM3X8E__)
|
||||||
void spiwrite(uint8_t);
|
void spiwrite(uint8_t);
|
||||||
Pio *dataport, *clkport, *csport, *rsport;
|
Pio *dataport, *clkport, *csport, *rsport;
|
||||||
uint8_t _cs,_rs,_sid,_sclk,_rst;
|
uint8_t _cs,_rs,_sid,_sclk,_rst;
|
||||||
uint32_t datapinmask, clkpinmask, cspinmask, rspinmask;
|
uint32_t datapinmask, clkpinmask, cspinmask, rspinmask;
|
||||||
#endif // #if defined(__SAM3X8E__)
|
#endif // #if defined(__SAM3X8E__)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue