C Language Development Kit/Functions/TriggerPressed

From OptiWiki

Jump to: navigation, search
Description This function returns the current state of the trigger key. The trigger key is the large button that must be pressed to switch on the scan engine for barcode scanning. The trigger key can be either pressed or not pressed.
Syntax
int triggerpressed(void);
Arguments None
Returns
>= 1 The trigger key is pressed down.
0 The trigger key is not pressed down.
Remarks When the trigger key is pressed down this event is interpreted as a key stroke. The key stroke is placed in the keyboard buffer as TRIGGER_KEY (on the OPH100x and PHL terminals) or as ENT_KEY (on the DWT7133 and OPL97xx/DCL153x without full keyboard). The function getchar() will return the key stroke as TRIGGER_KEY or ENT_KEY.

The function triggerpressed() returns the current state of the trigger key. The function getchar() returns TRIGGER_KEY or ENT_KEY when a transition took place from not pressed to pressed.

Example
// This example will sound the buzzer when the trigger key is being pressed
 
#include "lib.h"
#include <stdio.h>
 
void main( void )
{
    printf("\fPress trigger!");
    while( 1 )
    {
        if( triggerpressed() )
            sound( TSTANDARD, VHIGH, SMEDIUM, 0);
        idle();
    }
}


Views
Personal tools