Added display API function to set LCD contrast
This commit is contained in:
parent
e49c6e036c
commit
92870f477f
|
|
@ -96,4 +96,12 @@ void display_render();
|
||||||
*/
|
*/
|
||||||
bool display_renderingInProgress();
|
bool display_renderingInProgress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set display contrast.
|
||||||
|
* NOTE: not all the display controllers support contrast control, thus on some
|
||||||
|
* targets this function has no effect.
|
||||||
|
* @param contrast: display contrast, normalised value with range 0 - 255.
|
||||||
|
*/
|
||||||
|
void display_setContrast(uint8_t contrast);
|
||||||
|
|
||||||
#endif /* DISPLAY_H */
|
#endif /* DISPLAY_H */
|
||||||
|
|
|
||||||
|
|
@ -418,3 +418,9 @@ void *display_getFrameBuffer()
|
||||||
{
|
{
|
||||||
return (void *)(frameBuffer);
|
return (void *)(frameBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_setContrast(uint8_t contrast)
|
||||||
|
{
|
||||||
|
/* This controller does not support contrast regulation */
|
||||||
|
(void) contrast;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,11 +91,9 @@ void display_init()
|
||||||
gpio_clearPin(LCD_CS);
|
gpio_clearPin(LCD_CS);
|
||||||
|
|
||||||
gpio_clearPin(LCD_RS); /* RS low -> command mode */
|
gpio_clearPin(LCD_RS); /* RS low -> command mode */
|
||||||
// sendByteToController(0xE2); /* System Reset */
|
|
||||||
sendByteToController(0x2F); /* Voltage Follower On */
|
sendByteToController(0x2F); /* Voltage Follower On */
|
||||||
sendByteToController(0x81); /* Set Electronic Volume = 15 */
|
sendByteToController(0x81); /* Set Electronic Volume */
|
||||||
/* TODO variable contrast */
|
sendByteToController(0x15); /* Contrast, initial setting */
|
||||||
sendByteToController(0x15); /* Contrast */
|
|
||||||
sendByteToController(0xA2); /* Set Bias = 1/9 */
|
sendByteToController(0xA2); /* Set Bias = 1/9 */
|
||||||
sendByteToController(0xA1); /* A0 Set SEG Direction */
|
sendByteToController(0xA1); /* A0 Set SEG Direction */
|
||||||
sendByteToController(0xC0); /* Set COM Direction */
|
sendByteToController(0xC0); /* Set COM Direction */
|
||||||
|
|
@ -130,7 +128,9 @@ void display_renderRow(uint8_t row)
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint8_t s = 0; s < 8; s++){
|
|
||||||
|
for (uint8_t s = 0; s < 8; s++)
|
||||||
|
{
|
||||||
sendByteToController(tmp[s]);
|
sendByteToController(tmp[s]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -166,3 +166,10 @@ void *display_getFrameBuffer()
|
||||||
{
|
{
|
||||||
return (void *)(frameBuffer);
|
return (void *)(frameBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_setContrast(uint8_t contrast)
|
||||||
|
{
|
||||||
|
gpio_clearPin(LCD_RS); /* RS low -> command mode */
|
||||||
|
sendByteToController(0x81); /* Set Electronic Volume */
|
||||||
|
sendByteToController(contrast >> 2); /* Controller contrast range is 0 - 63 */
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -196,3 +196,9 @@ void *display_getFrameBuffer()
|
||||||
{
|
{
|
||||||
return (void *) (frameBuffer);
|
return (void *) (frameBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void display_setContrast(uint8_t contrast)
|
||||||
|
{
|
||||||
|
printf("Setting display contrast to %d\n", contrast);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue