This function sets the key backlight time.

Syntax

int KeyBacklightTime(
  int time
);

Parameters

time
[in] Specify the key backlight time. (In seconds).
The following values can be specified.
ValueDescription
KEYBL_TIME_OFF Always turn off the key backlight.
KEYBL_TIME_2SEC 2 seconds.
KEYBL_TIME_5SEC 5 seconds.
KEYBL_TIME_10SEC 10 seconds.
KEYBL_TIME_ON Always turn on the key backlight.
CURRENT_MODE Returns the current set time.

Return value

Returns the key backlight time setting after the change.

Remarks

This API is compatible with OS version TH15J06 or later.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main(void)
{
    char ch;
    int  set_time;
    int  exit_flag;
    int  ret;

    GotoXY( 1,1 );
    printf("Press Key\n");

    exit_flag = 0;
    while(1)
    {
        if (kbhit())
        {
            ch = getchar();
            switch(ch)
            {
            case NUM1_KEY:
                set_time = KEYBL_TIME_OFF;
                exit_flag = 1;
                break;

            case NUM2_KEY:
                set_time = KEYBL_TIME_2SEC;
                exit_flag = 1;
                break;

            case NUM5_KEY:
                set_time = KEYBL_TIME_5SEC;
                exit_flag = 1;
                break;

            case NUM6_KEY:
                set_time = KEYBL_TIME_10SEC;
                exit_flag = 1;
                break;

            case NUM7_KEY:
                set_time = KEYBL_TIME_ON;
                exit_flag = 1;
                break;

            default:
                GotoXY(1,2);
                printf("ERROR !!");
                break;
            }
        }
        ResetKey();
        if (exit_flag) break;
    }

    ret = KeyBacklightTime(set_time);
    GotoXY(1,2);
    printf("ret = %dS", ret);

    while(1)
    {
        Idle();
    }
}

Last updated: 2022/03/10