📄 lcd6963.c
字号:
if(( (row&0x04) && test) ||
(!(row&0x04) && !test))
{
lcd_cmd(0xC1);
lcd_busy_wait();
dat=lcd_in_dat();
if(dat != 0x0F)
{
err_flag=1; /* show read back failure */
}
}
else
{
lcd_cmd(0xC1);
lcd_busy_wait();
dat=lcd_in_dat();
if(dat != 0xF0)
{
err_flag=1; /* show read back failure */
}
}
}
}
return(err_flag); /* show test result */
}
/*
**
** Clears the display memory starting at the left/top and going to
** the right/bottom . No runtime error checking is performed. It is
** assumed that left is less than right and that top is less than
** bottom
**
*/
void lcd_clear_area(unsigned char left, unsigned char top, unsigned char right, unsigned char bottom){ unsigned char bit_pos;
unsigned char y;
unsigned char byte_offset;
unsigned char x_bits;
unsigned char remaining_bits;
unsigned char mask;
bit_pos = left & 0x07; /* get starting bit offset into byte */
for(y = top; y <= bottom; y++)
{
byte_offset = left >> 3; /* get byte offset into x direction */
x_bits = (right - left) + 1; /* get length in the x direction to write */
remaining_bits = 8 - bit_pos; /* number of bits left in byte */
mask = l_mask_array[bit_pos]; /* get mask for this bit */
while(x_bits) /* while there are still bits to write */
{
if((remaining_bits == 8) && (x_bits > 7))
{
/* here if we are byte aligned and have at least 1 byte to write */
/* do the entire byte at once instead of bit by bit */
while(x_bits > 7) /* while there are at least 8 more bits to do */
{
l_display_array[y][byte_offset] = 0x00;
byte_offset++;
x_bits -= 8;
}
}
else
{
/* here if not byte aligned or an entire byte does not need written */
/* thus do bit by bit */
l_display_array[y][byte_offset] &= ~mask;
if(l_mask_array[0] & 0x80)
{
mask >>= 1;
}
else
{
mask <<= 1;
}
x_bits--;
remaining_bits--;
if(remaining_bits == 0)
{
/* might have bust gotton byte aligned */
/* so reset for beginning of a byte */
remaining_bits = 8;
byte_offset++;
mask = l_mask_array[0];
}
}
}
}
}
/*
**
** Inverts the display memory starting at the left/top and going to** the right/bottom. No runtime error checking is performed. It is
** assumed that left is less than right and that top is less than
** bottom
**
*/
void lcd_invert_area(unsigned char left, unsigned char top, unsigned char right, unsigned char bottom){ unsigned char bit_pos;
unsigned char y;
unsigned char byte_offset;
unsigned char x_bits;
unsigned char remaining_bits;
unsigned char mask;
bit_pos = left & 0x07; /* get starting bit offset into byte */
for(y = top; y <= bottom; y++)
{ byte_offset = left >> 3; /* get byte offset into x direction */
x_bits = (right - left) + 1; /* get length in the x direction to write */
remaining_bits = 8 - bit_pos; /* number of bits left in byte */
mask = l_mask_array[bit_pos]; /* get mask for this bit */
while(x_bits) /* while there are still bits to write */
{ if((remaining_bits == 8) && (x_bits > 7))
{
/* here if we are byte aligned and have at least 1 byte to write */
/* do the entire byte at once instead of bit by bit */
while(x_bits > 7) /* while there are at least 8 more bits to do */
{
l_display_array[y][byte_offset] ^= 0xFF;
byte_offset++;
x_bits -= 8;
} } else { /* here if not byte aligned or an entire byte does not need written */
/* thus do bit by bit */
l_display_array[y][byte_offset] ^= mask;
if(l_mask_array[0] & 0x80)
{
mask >>= 1;
}
else
{
mask <<= 1;
}
x_bits--;
remaining_bits--;
if(remaining_bits == 0)
{
/* might have bust gotton byte aligned */
/* so reset for beginning of a byte */
remaining_bits = 8;
byte_offset++;
mask = l_mask_array[0];
}
}
}
}
}
/*
**
** Draws a line into the display memory starting at left going to
** right, on the given row. No runtime error checking is performed.
** It is assumed that left is less than right.
**
*/
void lcd_horz_line(unsigned char left, unsigned char right, unsigned char row){
unsigned char bit_pos;
unsigned char byte_offset;
unsigned char x_bits;
unsigned char remaining_bits;
unsigned char mask;
bit_pos = left & 0x07; /* get starting bit offset into byte */
byte_offset = left >> 3; /* get byte offset into y direction */
x_bits = (right - left) + 1; /* get length in the x direction to write */
remaining_bits = 8 - bit_pos; /* number of bits left in byte */
mask = l_mask_array[bit_pos]; /* get mask for this bit */
while(x_bits) /* while there are still bits to write */
{
if((remaining_bits == 8) && (x_bits > 7))
{
/* here if we are byte aligned and have at least 1 byte to write */
/* do the entire byte at once instead of bit by bit */
while(x_bits > 7) /* while there are at least 8 more bits to do */
{
l_display_array[row][byte_offset] = 0xFF;
byte_offset++;
x_bits -= 8;
}
}
else
{
/* we are not byte aligned or an entire byte does not need written */ /* do each individual bit */ l_display_array[row][byte_offset] |= mask;
if(l_mask_array[0] & 0x80)
{
mask >>= 1;
}
else
{
mask <<= 1;
}
x_bits--;
remaining_bits--;
if(remaining_bits == 0)
{
/* might have bust gotton byte aligned */
/* so reset for beginning of a byte */
remaining_bits = 8;
byte_offset++;
mask = l_mask_array[0];
}
}
}
}
/*
**
** Draws a vertical line into display memory starting at the top** going to the bottom in the given column. No runtime error checking
** is performed. It is assumed that top is less than bottom and that
** the column is in range.
**
*/
void lcd_vert_line(unsigned char top, unsigned char bottom, unsigned char column){ unsigned char bit_pos; unsigned char byte_offset; unsigned char mask; unsigned char row; bit_pos = column & 0x07; /* get the bit offset into a byte */ byte_offset = column >> 3; /* get the byte offset into x array */ mask = l_mask_array[bit_pos]; /* get the mask for this bit */ for(row = top; row <= bottom; row++) { l_display_array[row][byte_offset] |= mask; }}
/*
**
** Clears a line into the display memory starting at left going to
** right, on the given row. No runtime error checking is performed.
** It is assumed that left is less than right.
**
*/
void lcd_clr_horz_line(unsigned char left, unsigned char right, unsigned char row){
unsigned char bit_pos;
unsigned char byte_offset;
unsigned char x_bits;
unsigned char remaining_bits;
unsigned char mask;
bit_pos = left & 0x07; /* get starting bit offset into byte */
byte_offset = left >> 3; /* get byte offset into x direction */
x_bits = (right - left) + 1; /* get length in the x direction to write */
remaining_bits = 8 - bit_pos; /* number of bits left in byte */
mask = l_mask_array[bit_pos]; /* get mask for this bit */
while(x_bits) /* while there are still bits to write */
{
if((remaining_bits == 8) && (x_bits > 7))
{
/* here if we are byte aligned and have at least 1 byte to write */
/* do the entire byte at once instead of bit by bit */
while(x_bits > 7) /* while there are at least 8 more bits to do */
{
l_display_array[row][byte_offset] = 0x00;
byte_offset++;
x_bits -= 8;
}
}
else
{
/* we are not byte aligned or an entire byte does not need written */ /* do each individual bit */ l_display_array[row][byte_offset] &= ~mask;
if(l_mask_array[0] & 0x80)
{
mask >>= 1;
}
else
{
mask <<= 1;
}
x_bits--;
remaining_bits--;
if(remaining_bits == 0)
{
/* might have bust gotton byte aligned */
/* so reset for beginning of a byte */
remaining_bits = 8;
byte_offset++;
mask = l_mask_array[0];
}
}
}
}
/*
**
** Clears a vertical line into display memory starting at the top** going to the bottom in the given column. No runtime error checking
** is performed. It is assumed that top is less than bottom and that
** the column is in range.
**
*/
void lcd_clr_vert_line(unsigned char top, unsigned char bottom, unsigned char column){ unsigned char bit_pos; unsigned char byte_offset; unsigned char mask; unsigned char row; bit_pos = column & 0x07; /* get the bit offset into a byte */ byte_offset = column >> 3; /* get the byte offset into x array */ mask = l_mask_array[bit_pos]; /* get the mask for this bit */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -