This function sets the state (Enabled/Disabled) of the sidekey vibrator.

Syntax

int SetSideKeyVibrator(
  int mode
);

Parameters

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

Return value

Returns the state of the sidekey vibrator 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 = SetSideKeyVibrator(set_mode);
    GotoXY(1,2);
    printf("ret = %s", (ret > 0)? "ON" : "OFF");

    while(1)
    {
        Idle();
    }
}

Last updated: 2022/03/10