This function sets the side key state (Enabled/Disabled).

Syntax

int SetSideKey(
  int mode
);

Parameters

mode
[in] Sets the state of the side key.
ValueDescription
ON Enable the side key.
OFF Disabled the side key.
CURRENT_MODE Returns the current side key state.

Return value

Returns the side key state 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_mode;
    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_mode = ON;
                exit_flag = 1;
                break;

            case NUM2_KEY:
                set_mode = OFF;
                exit_flag = 1;
                break;

            case NUM3_KEY:
                set_mode = CURRENT_MODE;
                exit_flag = 1;
                break;

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

    ret = SetSideKey(set_mode);
    GotoXY(1,2);
    printf("ret = %s", (ret > 0)? "ON" : "OFF");

    while(1)
    {
        Idle();
    }
}

Last updated: 2022/03/10