Revert "Remove unnecessary commands from N1600 initialization; refactor display memory write setup to use macros"
This reverts commit e66910638d
.
This commit is contained in:
parent
5d5ba8c4a7
commit
a3091ff683
|
@ -56,15 +56,14 @@ static const struct display_macro INIT_N1200[] = {
|
|||
{COMMAND_TYPE_CMD, 0x10},
|
||||
};
|
||||
|
||||
static const struct display_macro PREPARE_N1200[] = {
|
||||
{COMMAND_TYPE_CMD, 0xB0},
|
||||
{COMMAND_TYPE_CMD, 0x10},
|
||||
{COMMAND_TYPE_CMD, 0x00},
|
||||
};
|
||||
|
||||
/* Decoded:
|
||||
* CMD 36: MADCTL (argument missing!)
|
||||
* CMD 29: DISPON
|
||||
* CMD BA: Data order (1)
|
||||
* DAT 07: ignored?
|
||||
* CMD 15: undefined?
|
||||
* DAT 25: ignored?
|
||||
* DAT 3F: ignored?
|
||||
* CMD 11: sleep out
|
||||
* CMD 13: normal display mode on
|
||||
* CMD 37: set scroll entry point
|
||||
|
@ -80,8 +79,13 @@ static const struct display_macro PREPARE_N1200[] = {
|
|||
*/
|
||||
static const struct display_macro INIT_N1600[] = {
|
||||
{COMMAND_TYPE_CMD, 0x01, 10},
|
||||
{COMMAND_TYPE_CMD, 0x36},
|
||||
{COMMAND_TYPE_CMD, 0x29},
|
||||
{COMMAND_TYPE_CMD, 0xBA},
|
||||
{COMMAND_TYPE_DATA, 0x07},
|
||||
{COMMAND_TYPE_CMD, 0x15},
|
||||
{COMMAND_TYPE_DATA, 0x25},
|
||||
{COMMAND_TYPE_DATA, 0x3F},
|
||||
{COMMAND_TYPE_CMD, 0x11},
|
||||
{COMMAND_TYPE_CMD, 0x13},
|
||||
{COMMAND_TYPE_CMD, 0x37},
|
||||
|
@ -96,30 +100,14 @@ static const struct display_macro INIT_N1600[] = {
|
|||
{COMMAND_TYPE_DATA, 70-1},
|
||||
};
|
||||
|
||||
static const struct display_macro PREPARE_N1600[] = {
|
||||
{COMMAND_TYPE_CMD, 0x2C},
|
||||
};
|
||||
|
||||
|
||||
struct display_descriptor {
|
||||
/* Macro to execute in order to initialize the display from scratch */
|
||||
const struct display_macro * init_macro;
|
||||
int init_macro_length;
|
||||
|
||||
/* Macro to execute to prepare the display for sending raw contents */
|
||||
const struct display_macro * prepare_macro;
|
||||
int prepare_macro_length;
|
||||
};
|
||||
|
||||
const struct display_descriptor DISPLAY_DESCRIPTORS[] = {
|
||||
[DISPLAY_TYPE_N1200] = {
|
||||
INIT_N1200, sizeof(INIT_N1200)/sizeof(INIT_N1200[0]),
|
||||
PREPARE_N1200, sizeof(PREPARE_N1200)/sizeof(PREPARE_N1200[0])
|
||||
},
|
||||
[DISPLAY_TYPE_N1600] = {
|
||||
INIT_N1600, sizeof(INIT_N1600)/sizeof(INIT_N1600[0]),
|
||||
PREPARE_N1600, sizeof(PREPARE_N1600)/sizeof(PREPARE_N1600[0])
|
||||
},
|
||||
[DISPLAY_TYPE_N1200] = { INIT_N1200, sizeof(INIT_N1200)/sizeof(INIT_N1200[0]) },
|
||||
[DISPLAY_TYPE_N1600] = { INIT_N1600, sizeof(INIT_N1600)/sizeof(INIT_N1600[0]) },
|
||||
};
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -233,13 +221,6 @@ uint8_t lcdRead(uint8_t data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void lcdExecuteMacro(const struct display_macro *macro, int macro_length)
|
||||
{
|
||||
for(int i=0; i<macro_length; i++) {
|
||||
lcdWrite(macro[i].type, macro[i].data);
|
||||
delayms(macro[i].delay_after);
|
||||
}
|
||||
}
|
||||
|
||||
void lcdInit(void) {
|
||||
int id;
|
||||
|
@ -268,7 +249,10 @@ void lcdInit(void) {
|
|||
displayDescriptor = DISPLAY_DESCRIPTORS + displayType;
|
||||
|
||||
lcd_select();
|
||||
lcdExecuteMacro(displayDescriptor->init_macro, displayDescriptor->init_macro_length);
|
||||
for(int i=0; i<displayDescriptor->init_macro_length; i++) {
|
||||
lcdWrite(displayDescriptor->init_macro[i].type, displayDescriptor->init_macro[i].data);
|
||||
delayms(displayDescriptor->init_macro[i].delay_after);
|
||||
}
|
||||
lcd_deselect();
|
||||
}
|
||||
|
||||
|
@ -326,9 +310,10 @@ void lcdDisplay(void) {
|
|||
char byte;
|
||||
lcd_select();
|
||||
|
||||
lcdExecuteMacro(displayDescriptor->prepare_macro, displayDescriptor->prepare_macro_length);
|
||||
|
||||
if(displayType==DISPLAY_TYPE_N1200){
|
||||
lcdWrite(COMMAND_TYPE_CMD,0xB0);
|
||||
lcdWrite(COMMAND_TYPE_CMD,0x10);
|
||||
lcdWrite(COMMAND_TYPE_CMD,0x00);
|
||||
uint16_t i,page;
|
||||
for(page=0; page<RESY_B;page++) {
|
||||
for(i=0; i<RESX; i++) {
|
||||
|
@ -347,6 +332,8 @@ void lcdDisplay(void) {
|
|||
uint16_t x,y;
|
||||
bool px;
|
||||
|
||||
lcdWrite(COMMAND_TYPE_CMD,0x2C);
|
||||
|
||||
//top line of the frame...
|
||||
_helper_hline(COLOR_FRAME);
|
||||
|
||||
|
|
Loading…
Reference in New Issue