Syntax
int Backlight(
int what,
unsigned short time
);
Parameters
- what
-
[in] Specify the operation content.
One of the following values:Value Description OFF Switches the backlight off. ON Switches the backlight on. AUTO Switches the backlight on and dims the backlight to the lowest brightness if there is no operation during the timeout time specified by time. RETURN_TIME Returns the current value of timeout time. - time
-
[in] This parameter is valid when AUTO is specified for what, and specifies the timeout time in 20 msec units until the backlight dims to the minimum brightness.
If you specify 1 to 65,534, the timeout time is set to time x 20 msec.
If you specify 65,535, the setting is the same as if you specify ON in what.
Return value
OK is returned if what specifies OFF or ON.When AUTO is specified in what, OK is returned if time is 1 to 65,535, otherwise ERROR is returned.
When RETURN_TIME is specified in what, 65,535 is returned if the current setting is ON, and the currently set timeout time (1 to 65,534) is returned if the current settiong is AUTO. (System 4.0 or later)
Remarks
If you specify ON in what, the backlight will always be on with the brightness set by the BackLightLvl function.If you specify AUTO in what, the backlight turns on with the brightness set by the BackLightLvl function. After that, if no operation is performed during the timeout time specified by time, the backlight will dim to the minimum brightness, but if any operation is performed, it will automatically return to the original brightness.
On the other hand, when OFF is specified in what, the backlight is completely turned off, but if any operation is performed in this state, the backlight will turn on automatically. However, please note that it works according to the currently set AUTO or ON settings.
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void main(void)
{
int savedBacklightTime;
int savedBacklightLevel;
while(1){
printf("Press [ENT] to start\n");
while(1){
if (kbhit()){
if (getchar() == ENT_KEY){
break;
}
}
Idle();
}
savedBacklightTime = Backlight(RETURN_TIME, 0); // Save current timeout.
savedBacklightLevel = BackLightLvl(CURRENT_MODE);
Backlight(ON, 0); // Turn on the backlight continuously.
BackLightLvl(LCD_LEVEL5); // Highest brightness
printf("\nBacklight->ON always\n");
printf("Press [BS] to exit.\n");
while(1){
if (kbhit()){
if (getchar() == BS_KEY){
break;
}
}
Idle();
}
Backlight(AUTO, savedBacklightTime); // Restore the timeout.
BackLightLvl(savedBacklightLevel); // Restore the brightness
printf("\nBacklight->restored\n");
}
}
Last updated: 2022/04/08