else if (x < LCD_Vop_MIN)
x = LCD_Vop_MIN;
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_SetVop);
- lcd_write(LCD_MASTER, LCD_DATA, x & LCD_Vop_LOWMASK);
- lcd_write(LCD_MASTER, LCD_DATA, x >> LCD_Vop_HIGHSHIFT);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_SetVop);
+ lcd_write(LCD_RIGHT, LCD_DATA, x & LCD_Vop_LOWMASK);
+ lcd_write(LCD_RIGHT, LCD_DATA, x >> LCD_Vop_HIGHSHIFT);
}
inline void setup_lcd (void)
LCD_RSTB=1;
wait_ms(1 +1);
- // Slave chip
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_ExtCommand1);
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_EnableSlave);
+ // "Slave" chip - left half
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_ExtCommand1);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_EnableSlave);
// Disable auto read
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_ExtCommand2);
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_AutoReadControl);
- lcd_write(LCD_SLAVE, LCD_DATA, 0x9F);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_ExtCommand2);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_AutoReadControl);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x9F);
// // Enable OTP Read
- // lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_OtpWrRdControl);
- // lcd_write(LCD_SLAVE, LCD_DATA, 0x00);
+ // lcd_write(LCD_LEFT, LCD_COMMAND, LCD_OtpWrRdControl);
+ // lcd_write(LCD_LEFT, LCD_DATA, 0x00);
// wait_ms(10 +1);
// // OTP Up-Load
- // lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_OtpRead);
+ // lcd_write(LCD_LEFT, LCD_COMMAND, LCD_OtpRead);
// wait_ms(20 +1);
// // OTP Control Out
- // lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_OtpControlWrite);
+ // lcd_write(LCD_LEFT, LCD_COMMAND, LCD_OtpControlWrite);
// Sleep out
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_ExtCommand1);
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_PowerSaveSleepOut);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_ExtCommand1);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_PowerSaveSleepOut);
wait_ms(50 +1);
// Power control
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_PowerControl);
- lcd_write(LCD_SLAVE, LCD_DATA, 0x01); // VB OFF; VR ON, VF OFF
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_PowerControl);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x01); // VB OFF; VR ON, VF OFF
// Display Mode
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_DisplayMode);
- lcd_write(LCD_SLAVE, LCD_DATA, LCD_MONO); // Monochrome Mode
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_DisplayMode);
+ lcd_write(LCD_LEFT, LCD_DATA, LCD_MONO); // Monochrome Mode
// Display Format
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_DataFormatLsbTop);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_DataFormatLsbTop);
// Display Control
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_DisplayControl);
- lcd_write(LCD_SLAVE, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
- lcd_write(LCD_SLAVE, LCD_DATA, 0x25); // Duty = 38
- lcd_write(LCD_SLAVE, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_DisplayControl);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
+ lcd_write(LCD_LEFT, LCD_DATA, 0x25); // Duty = 38
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
// Data Scan Direction
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_DataScanDirection);
- lcd_write(LCD_SLAVE, LCD_DATA, 0x06);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_DataScanDirection);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x06);
// Analog Circuit Set
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_ExtCommand2);
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_AnalogCircuitSet);
- lcd_write(LCD_SLAVE, LCD_DATA, 0x00);
- lcd_write(LCD_SLAVE, LCD_DATA, 0x01); // Booster Efficiency = Level 1
- lcd_write(LCD_SLAVE, LCD_DATA, LCD_BIAS); // Bias
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_ExtCommand2);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_AnalogCircuitSet);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x01); // Booster Efficiency = Level 1
+ lcd_write(LCD_LEFT, LCD_DATA, LCD_BIAS); // Bias
// Page Address Setting
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_ExtCommand1);
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_SetPageAddress);
- lcd_write(LCD_SLAVE, LCD_DATA, 0);
- lcd_write(LCD_SLAVE, LCD_DATA, 4);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_ExtCommand1);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_SetPageAddress);
+ lcd_write(LCD_LEFT, LCD_DATA, 0);
+ lcd_write(LCD_LEFT, LCD_DATA, 4);
// Column Address Setting
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_SetColumnAddress);
- lcd_write(LCD_SLAVE, LCD_DATA, 0);
- lcd_write(LCD_SLAVE, LCD_DATA, HALFSCREEN_PIXELS-1);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_SetColumnAddress);
+ lcd_write(LCD_LEFT, LCD_DATA, 0);
+ lcd_write(LCD_LEFT, LCD_DATA, HALFSCREEN_PIXELS-1);
// Display On
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_DisplayOn);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_DisplayOn);
- // Master chip
+ // "Master" chip - right half
// Enable Master
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_ExtCommand1);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_EnableMaster);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_ExtCommand1);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_EnableMaster);
// Disable auto read
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_ExtCommand2);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_AutoReadControl);
- lcd_write(LCD_MASTER, LCD_DATA, 0x9F);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_ExtCommand2);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_AutoReadControl);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x9F);
// // Enable OTP Read
- // lcd_write(LCD_MASTER, LCD_COMMAND, LCD_OtpWrRdControl);
- // lcd_write(LCD_MASTER, LCD_DATA, 0x00);
+ // lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_OtpWrRdControl);
+ // lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
// wait_ms(10 +1);
// // OTP Up-Load
- // lcd_write(LCD_MASTER, LCD_COMMAND, LCD_OtpRead);
+ // lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_OtpRead);
// wait_ms(20 +1);
// // OTP Control Out
- // lcd_write(LCD_MASTER, LCD_COMMAND, LCD_OtpControlWrite);
+ // lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_OtpControlWrite);
// Sleep out
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_ExtCommand1);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_PowerSaveSleepOut);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_ExtCommand1);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_PowerSaveSleepOut);
wait_ms(50 +1);
// Power control
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_PowerControl);
- lcd_write(LCD_MASTER, LCD_DATA, 0x0B); // VB ON; VR, VF ON
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_PowerControl);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x0B); // VB ON; VR, VF ON
// Set Vop
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_SetVop);
- lcd_write(LCD_MASTER, LCD_DATA, LCD_DEFAULT_Vop );//!
- lcd_write(LCD_MASTER, LCD_DATA, LCD_DEFAULT_Vop_HIGH );//!
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_SetVop);
+ lcd_write(LCD_RIGHT, LCD_DATA, LCD_DEFAULT_Vop );//!
+ lcd_write(LCD_RIGHT, LCD_DATA, LCD_DEFAULT_Vop_HIGH );//!
// Display Mode
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_DisplayMode);
- lcd_write(LCD_MASTER, LCD_DATA, LCD_MONO); // Monochrome Mode
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_DisplayMode);
+ lcd_write(LCD_RIGHT, LCD_DATA, LCD_MONO); // Monochrome Mode
// Display Format
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_DataFormatLsbTop);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_DataFormatLsbTop);
// Display Control
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_DisplayControl);
- lcd_write(LCD_MASTER, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
- lcd_write(LCD_MASTER, LCD_DATA, 0x25); // Duty = 38
- lcd_write(LCD_MASTER, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_DisplayControl);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x25); // Duty = 38
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00); // CL Dividing Ratio -> Not Divide
// Data Scan Direction
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_DataScanDirection);
- lcd_write(LCD_MASTER, LCD_DATA, 0x06);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_DataScanDirection);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x06);
// Analog Circuit Set
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_ExtCommand2);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_AnalogCircuitSet);
- lcd_write(LCD_MASTER, LCD_DATA, 0x00);
- lcd_write(LCD_MASTER, LCD_DATA, 0x01); // Booster Efficiency = Level
- lcd_write(LCD_MASTER, LCD_DATA, LCD_BIAS); // Bias
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_ExtCommand2);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_AnalogCircuitSet);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x01); // Booster Efficiency = Level
+ lcd_write(LCD_RIGHT, LCD_DATA, LCD_BIAS); // Bias
// Page Address Setting
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_ExtCommand1);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_SetPageAddress);
- lcd_write(LCD_MASTER, LCD_DATA, 0);
- lcd_write(LCD_MASTER, LCD_DATA, 4);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_ExtCommand1);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_SetPageAddress);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0);
+ lcd_write(LCD_RIGHT, LCD_DATA, 4);
// Column Address Setting
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_SetColumnAddress);
- lcd_write(LCD_MASTER, LCD_DATA, 0);
- lcd_write(LCD_MASTER, LCD_DATA, HALFSCREEN_PIXELS-1);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_SetColumnAddress);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0);
+ lcd_write(LCD_RIGHT, LCD_DATA, HALFSCREEN_PIXELS-1);
// Internal Power Supply
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_ExtCommand2);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_DrivingSelectInt);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_ExtCommand2);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_DrivingSelectInt);
// Display On
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_ExtCommand1);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_DisplayOn);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_ExtCommand1);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_DisplayOn);
}
LCD_D__PM = 0x00; //data output
- if (chip == LCD_SLAVE) //reverse bits for slave chip
+ if (chip == LCD_LEFT) //reverse bits for left chip
d = reverse_bits(data);
else
d = data;
LCD_D = d; //set data
- if(chip == LCD_MASTER) //set chipselect
+ if(chip == LCD_RIGHT) //set chipselect
LCD_CSB_MASTER=0;
else
LCD_CSB_SLAVE=0;
LCD_WR = 1; //unset writeenable;
- if(chip == LCD_MASTER) //unset chipselect
+ if(chip == LCD_RIGHT) //unset chipselect
LCD_CSB_MASTER=1;
else
LCD_CSB_SLAVE=1;
if (x0 < HALFSCREEN_PIXELS)
{
x = (x1 > (HALFSCREEN_PIXELS-1)) ? HALFSCREEN_PIXELS-1 : x1;
- lcd_set_mode(LCD_SLAVE, mode, x0, x, y0, y1);
- lcd_write(LCD_SLAVE, LCD_COMMAND, LCD_WriteDataToDDRAM);
+ lcd_set_mode(LCD_LEFT, mode, x0, x, y0, y1);
+ lcd_write(LCD_LEFT, LCD_COMMAND, LCD_WriteDataToDDRAM);
}
if (x1 >= HALFSCREEN_PIXELS)
{
x = (x0 < HALFSCREEN_PIXELS) ? 0 : (x0-HALFSCREEN_PIXELS);
- lcd_set_mode(LCD_MASTER, mode, x, x1-HALFSCREEN_PIXELS, y0, y1);
- lcd_write(LCD_MASTER, LCD_COMMAND, LCD_WriteDataToDDRAM);
+ lcd_set_mode(LCD_RIGHT, mode, x, x1-HALFSCREEN_PIXELS, y0, y1);
+ lcd_write(LCD_RIGHT, LCD_COMMAND, LCD_WriteDataToDDRAM);
}
}
{
for(j=0; j<=y; ++j)
{
- lcd_write(LCD_SLAVE, LCD_DATA, 0x00);
- lcd_write(LCD_MASTER, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
}
}
}
uint16_t line1, line2, line3, line4, margin_l, margin_r;
uint16_t len, N;
uint16_t i, i0, i1, i2, i3, j0, j1, j2, j3;
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
uint8_t underline;
underline = selected ? 0x3C : 00;
for(i=0; i<margin_l; ++i) // left margin
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
for (i=0, i0=-1; i<N; ++i)
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
if(!(i&0x7))
{
++i0;
for (i=0, i0=-1, i1=line1-1; i<N; ++i)
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
if(!(i&0x7))
{
++i0;
for (i=0, i0=-1, i1=line1-1, i2=line2-1; i<N; ++i)
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
if(!(i&0x7))
{
++i0;
for (i=0, i0=-1, i1=line1-1, i2=line2-1, i3=line3-1; i<N; ++i)
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
if(!(i&0x7))
{
++i0;
for(i=0; i<margin_r; ++i) // right margin
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
uint16_t line1, margin_l, margin_r;
uint16_t len, N;
uint16_t i, i0, j0, j3;
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
uint8_t underline;
underline = selected ? 0x3C : 00;
for(i=0; i<margin_l; ++i) // left margin
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
++(*x);
for (i=0, i0=-1; i<N; ++i) // single text line; 8 font
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
if(!(i&0x7))
{
++i0;
for(i=0; i<margin_r; ++i) // right margin
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
++(*x);
uint16_t line1, margin_l, margin_r;
uint16_t len, N;
uint16_t i, i0, j0, j3;
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
line1 = button_chars[type];
margin_l = button_lmargin[type];
for(i=0; i<margin_l; ++i) // left margin
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
++(*x);
for (i=0, i0=-1; i<N; ++i) // single text line; 16px font
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
if(!(i&0x7))
{
++i0;
for(i=0; i<margin_r; ++i) // right margin
{
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
lcd_write(chip, LCD_DATA, 0x00);
++(*x);
void lcd_subdraw_divider (uint16_t * const x)
{
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x55);
lcd_write(chip, LCD_DATA, 0x55);
void lcd_subdraw_lowdivider (uint16_t * const x)
{
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
if (*x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x55);
lcd_write(chip, LCD_DATA, 0x55);
uint16_t N;
uint16_t margin_l, margin_r;
uint16_t i;
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
uint8_t underline;
if ((id < -1) || (id > 5))
for(i=0; i<margin_l; ++i) // left margin
{
if (x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
++x;
}
for (i=0; i<N; ++i) // underline
{
if (x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, underline);
++x;
}
for(i=0; i<margin_r; ++i) // right margin
{
if (x >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
++x;
}
void lcd_draw_name_cursor (const uint8_t pos)
{
uint16_t x, i, j;
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
x = (pos<<3) + TITLE_6B_PIXELS + 1 +BUTTON_6X_LMARGIN;
lcd_setup_drawing(LCD_MONO, x, x+7, 2, 2);
for (i=x, j='^'<<3; i<x+8; ++i, j+=1)
{
if (i >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, font8[j]);
}
}
void lcd_erase_name_cursor (const uint8_t pos)
{
uint16_t x, i;
- uint8_t chip = LCD_SLAVE;
+ uint8_t chip = LCD_LEFT;
x = (pos<<3) + TITLE_6B_PIXELS + 1 +BUTTON_6X_LMARGIN;
lcd_setup_drawing(LCD_MONO, x, x+7, 2, 2);
for (i=x; i<x+8; ++i)
{
if (i >= HALFSCREEN_PIXELS)
- chip = LCD_MASTER;
+ chip = LCD_RIGHT;
lcd_write(chip, LCD_DATA, 0x00);
}
}
lcd_setup_drawing(LCD_GRAY, draw_x, HALFSCREEN_PIXELS-1, 0, 9);
while (draw_wave_active)
{
- memset(col, 0, 10);
x = convert_wave((int8_t)draw_wave_data[draw_x]);
- if (x < WAVE_LOWER_0)
+ // Yes, I know this could be done with another loop. This is my choice.
+ if (x < WAVE_LOWER_4)
{
- col[4] = WAVE_LOWER_START;
- if (x < WAVE_LOWER_1)
- {
- col[5] = 0xff;
- if (x < WAVE_LOWER_2)
- {
- col[6] = 0xff;
- if (x < WAVE_LOWER_3)
- {
- col[7] = 0xff;
- if (x < WAVE_LOWER_4)
- {
- col[8] = 0xff;
- col[9] = wave_lower[x-WAVE_LOWER_5];
- }
- else
- col[8] = wave_lower[x-WAVE_LOWER_4];
- }
- else
- col[7] = wave_lower[x-WAVE_LOWER_3];
- }
- else
- col[6] = wave_lower[x-WAVE_LOWER_2];
- }
- else
- col[5] = wave_lower[x-WAVE_LOWER_1];
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_LOWER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_lower[x-WAVE_LOWER_5]);
}
- else if (x >= WAVE_UPPER_0)
+ else if (x < WAVE_LOWER_3)
{
- col[4] = WAVE_UPPER_START;
- if (x >= WAVE_UPPER_1)
- {
- col[3] = 0xff;
- if (x >= WAVE_UPPER_2)
- {
- col[2] = 0xff;
- if (x >= WAVE_UPPER_3)
- {
- col[1] = 0xff;
- col[0] = wave_upper[x-WAVE_UPPER_3];
- }
- else
- col[1] = wave_upper[x-WAVE_UPPER_2];
- }
- else
- col[2] = wave_upper[x-WAVE_UPPER_1];
- }
- else
- col[3] = wave_upper[x-WAVE_UPPER_0];
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_LOWER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_lower[x-WAVE_LOWER_4]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ }
+ else if (x < WAVE_LOWER_2)
+ {
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_LOWER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_lower[x-WAVE_LOWER_3]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ }
+ else if (x < WAVE_LOWER_1)
+ {
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_LOWER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_lower[x-WAVE_LOWER_2]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ }
+ else if (x < WAVE_LOWER_0)
+ {
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_LOWER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_lower[x-WAVE_LOWER_1]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ }
+ else if (x < WAVE_UPPER_0)
+ {
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_middle[x-WAVE_LOWER_0]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ }
+ else if (x < WAVE_UPPER_1)
+ {
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_upper[x-WAVE_UPPER_0]);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_UPPER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ }
+ else if (x < WAVE_UPPER_2)
+ {
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_upper[x-WAVE_UPPER_1]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_UPPER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ }
+ else if (x < WAVE_UPPER_3)
+ {
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, wave_upper[x-WAVE_UPPER_2]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_UPPER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
}
else
{
- col[4] = wave_middle[x-WAVE_LOWER_0];
+ lcd_write(LCD_LEFT, LCD_DATA, wave_upper[x-WAVE_UPPER_3]);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, 0xff);
+ lcd_write(LCD_LEFT, LCD_DATA, WAVE_UPPER_START);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
+ lcd_write(LCD_LEFT, LCD_DATA, 0x00);
}
- lcd_write(LCD_SLAVE, LCD_DATA, col[0]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[1]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[2]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[3]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[4]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[5]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[6]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[7]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[8]);
- lcd_write(LCD_SLAVE, LCD_DATA, col[9]);
-
++draw_x;
// finished
if (draw_x >= HALFSCREEN_PIXELS)
draw_x = 0;
return;
}
- // // interrupt drawing to handle AIX communication
- // if (NOT_EMPTY_BP(aix_buffer_w, aix_buffer_r, N_AIX_DATA))
- // return;
+ // interrupt drawing to handle AIX communication
+ if (NOT_EMPTY_BP(aix_buffer_w, aix_buffer_r, N_AIX_DATA))
+ return;
}
draw_x = 0;
}
lcd_setup_drawing(LCD_GRAY, HALFSCREEN_PIXELS+draw_x, FULLSCREEN_PIXELS-1, 0, 9);
while (draw_adsr_active)
{
- memset(col, 0, 10);
x = draw_adsr_data[draw_x];
-
- if (x >= ADSR_UPPER_1)
+ // Yes, I know this could be done with another loop. This is my choice.
+ if (x < ADSR_UPPER_1)
{
- col[9] = 0xff;
- if (x >= ADSR_UPPER_2)
- {
- col[8] = 0xff;
- if (x >= ADSR_UPPER_3)
- {
- col[7] = 0xff;
- if (x >= ADSR_UPPER_4)
- {
- col[6] = 0xff;
- if (x >= ADSR_UPPER_5)
- {
- col[5] = 0xff;
- if (x >= ADSR_UPPER_6)
- {
- col[4] = 0xff;
- if (x >= ADSR_UPPER_7)
- {
- col[3] = 0xff;
- if (x >= ADSR_UPPER_8)
- {
- col[2] = 0xff;
- if (x >= ADSR_UPPER_9)
- {
- col[1] = 0xff;
- col[0] = wave_upper[x-ADSR_UPPER_9];
- }
- else
- col[1] = wave_upper[x-ADSR_UPPER_8];
- }
- else
- col[2] = wave_upper[x-ADSR_UPPER_7];
- }
- else
- col[3] = wave_upper[x-ADSR_UPPER_6];
- }
- else
- col[4] = wave_upper[x-ADSR_UPPER_5];
- }
- else
- col[5] = wave_upper[x-ADSR_UPPER_4];
- }
- else
- col[6] = wave_upper[x-ADSR_UPPER_3];
- }
- else
- col[7] = wave_upper[x-ADSR_UPPER_2];
- }
- else
- col[8] = wave_upper[x-ADSR_UPPER_1];
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_0]);
+ }
+ else if (x < ADSR_UPPER_2)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_1]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
+ else if (x < ADSR_UPPER_3)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_2]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
+ else if (x < ADSR_UPPER_4)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_3]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
+ else if (x < ADSR_UPPER_5)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_4]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
+ else if (x < ADSR_UPPER_6)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_5]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
+ else if (x < ADSR_UPPER_7)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_6]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
+ else if (x < ADSR_UPPER_8)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_7]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
+ else if (x < ADSR_UPPER_9)
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, 0x00);
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_8]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
}
else
- col[9] = wave_upper[x-ADSR_UPPER_0];
-
- lcd_write(LCD_MASTER, LCD_DATA, col[0]);
- lcd_write(LCD_MASTER, LCD_DATA, col[1]);
- lcd_write(LCD_MASTER, LCD_DATA, col[2]);
- lcd_write(LCD_MASTER, LCD_DATA, col[3]);
- lcd_write(LCD_MASTER, LCD_DATA, col[4]);
- lcd_write(LCD_MASTER, LCD_DATA, col[5]);
- lcd_write(LCD_MASTER, LCD_DATA, col[6]);
- lcd_write(LCD_MASTER, LCD_DATA, col[7]);
- lcd_write(LCD_MASTER, LCD_DATA, col[8]);
- lcd_write(LCD_MASTER, LCD_DATA, col[9]);
+ {
+ lcd_write(LCD_RIGHT, LCD_DATA, wave_upper[x-ADSR_UPPER_9]);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ lcd_write(LCD_RIGHT, LCD_DATA, 0xff);
+ }
++draw_x;
// finished
draw_x = 0;
return;
}
- // // interrupt drawing to handle communication
- // if (NOT_EMPTY_BP(aix_buffer_w, aix_buffer_r, N_AIX_DATA))
- // return;
+ // interrupt drawing to handle communication
+ if (NOT_EMPTY_BP(aix_buffer_w, aix_buffer_r, N_AIX_DATA))
+ return;
}
draw_x = 0;
}