Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: ili9163lcd.cpp
- Revision:
- 3:9caa79f40909
- Parent:
- 2:4d5b94a92f19
- Child:
- 4:016fae067de1
--- a/ili9163lcd.cpp Fri Jan 01 13:57:57 2021 +0000
+++ b/ili9163lcd.cpp Sat Jan 02 01:42:56 2021 +0000
@@ -62,9 +62,9 @@
A0_ = 0;
for(i=0;i<8;i++){
if(address & 128)SDA_= 1; else SDA_ = 0;
- SCK_ = 1;
+ SCK_ = 0;//TBD
address <<= 1;
- SCK_ = 0;
+ SCK_ = 1;//TBD
}
wait_us(1);
CS_ = 1;
@@ -78,9 +78,9 @@
A0_ = 1;
for(i=0;i<8;i++){
if(parameter & 128)SDA_= 1; else SDA_ = 0;
- SCK_ = 1;
+ SCK_ = 0;//TBD
parameter <<= 1;
- SCK_ = 0;
+ SCK_ = 1;//TBD
}
wait_us(1);
CS_ = 1;
@@ -94,16 +94,16 @@
A0_ = 1;
for(i=0;i<8;i++){
if(dataByte1 & 128)SDA_= 1; else SDA_ = 0;
- SCK_ = 1;
+ SCK_ = 0;//TBD
dataByte1 <<= 1;
- SCK_ = 0;
+ SCK_ = 1;//TBD
}
wait_us(1);
for(i=0;i<8;i++){
if(dataByte2 & 128)SDA_= 1; else SDA_ = 0;
- SCK_ = 1;
+ SCK_ = 0;//TBD
dataByte2 <<= 1;
- SCK_ = 0;
+ SCK_ = 1;//TBD
}
wait_us(1);
CS_ = 1;
@@ -234,11 +234,90 @@
// Plot the pixels
lcdWriteCommand(WRITE_MEMORY_START);
//for(pixel = 0; pixel < 16385; pixel++) lcdWriteData(colour >> 8, colour);
- for(pixel = 0; pixel < 20481; pixel++) lcdWriteData(colour >> 8, colour);
+ for(pixel = 0; pixel < 20480; pixel++) lcdWriteData(colour >> 8, colour);
//128x128=16,384
//128x160=20,480
}
+void grade(void)
+{
+ uint16_t line_buf[128];
+ uint16_t pixel;
+ uint16_t colour;
+
+ // Set the column address to 0-127
+ lcdWriteCommand(SET_COLUMN_ADDRESS);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(COL_MAX);
+
+ // Set the page address to 0-127
+ lcdWriteCommand(SET_PAGE_ADDRESS);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ //lcdWriteParameter(0x7f);
+ lcdWriteParameter(PAGE_MAX);
+
+ for(pixel = 0; pixel < 128; pixel++){
+ if(pixel < 32) colour = decodeRgbValue((pixel&0b11111)>>1, 0, 0);
+ else if(pixel < 64) colour = decodeRgbValue(0, (pixel&0b11111)>>1, 0);
+ else if(pixel < 96) colour = decodeRgbValue(0, 0, (pixel&0b11111)>>1);
+ else colour = 0;
+ line_buf[pixel]=colour;
+ }
+ // Plot the pixels
+ lcdWriteCommand(WRITE_MEMORY_START);
+ for(uint16_t page = 0;page < 160;page++){
+ for(pixel = 0; pixel < 128; pixel++){
+ //if(pixel < 32) colour = decodeRgbValue((pixel&0b11111)>>1, 0, 0);
+ //else if(pixel < 64) colour = decodeRgbValue(0, (pixel&0b11111)>>1, 0);
+ //else if(pixel < 96) colour = decodeRgbValue(0, 0, (pixel&0b11111)>>1);
+ //else colour = 0;
+ //lcdWriteData(colour >> 8, colour);
+ lcdWriteData(line_buf[pixel] >> 8, line_buf[pixel]);
+ }
+ }
+}
+
+void colorbar(void)
+{
+ uint16_t pixel;
+ uint16_t colour;
+
+ // Set the column address to 0-127
+ lcdWriteCommand(SET_COLUMN_ADDRESS);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(COL_MAX);
+
+ // Set the page address to 0-127
+ lcdWriteCommand(SET_PAGE_ADDRESS);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ lcdWriteParameter(0x00);
+ //lcdWriteParameter(0x7f);
+ lcdWriteParameter(PAGE_MAX);
+
+ // Plot the pixels
+ lcdWriteCommand(WRITE_MEMORY_START);
+ for(uint16_t page = 0;page < 160;page++){
+ if(page < 28) colour = decodeRgbValue(31, 31, 31);
+ else if(page < 50) colour = decodeRgbValue(31, 31, 0);
+ else if(page < 72) colour = decodeRgbValue(0, 31, 31);
+ else if(page < 94) colour = decodeRgbValue(0, 31, 0);
+ else if(page < 116) colour = decodeRgbValue(31, 0, 31);
+ else if(page < 138) colour = decodeRgbValue(31, 0, 0);
+ else colour = decodeRgbValue(0, 0, 31);
+
+ for(pixel = 0; pixel < 128; pixel++){
+ lcdWriteData(colour >> 8, colour);
+ }
+ }
+}
+
void lcdPlot(uint8_t x, uint8_t y, uint16_t colour)
{
// Horizontal Address Start Position