/*
 * Class:     org_bulldog_beagleboneblack_jni_NativeGpio
 * Method:    digitalWrite
 * Signature: (III)V
 */
JNIEXPORT void JNICALL Java_org_bulldog_beagleboneblack_jni_NativeGpio_debouncePin
  (JNIEnv * env, jclass clazz, jint port, jint pin, jint ms) {
	if(ms == -1) {
		BBBIO_sys_Disable_Debouncing(port, pin, 0);
	} else {
		BBBIO_sys_Enable_Debouncing(port, pin, ms);
	}
}
Пример #2
0
//-----------------------------------------------
int main(void)
{
	int DebFlag  =DEBOUNCING_BUTTON_UP;
	int DebCount = 0;
	iolib_init();

	iolib_setdir(8,12, BBBIO_DIR_IN);
	iolib_setdir(8,11, BBBIO_DIR_IN);

#ifdef DEBOUNCING
        BBBIO_sys_Enable_Debouncing(8 ,11 ,10);
#else
	BBBIO_sys_Disable_Debouncing(8 ,11);
#endif

	printf("OK\n");

        int count = 0;
	int Test =0;
        while(Test <10)
        {
                count ++ ;
                if (is_high(8,11))
                {
		    DebFlag = DEBOUNCING_BUTTON_DOWN;
                }
		else
                {
		    if(DebFlag == DEBOUNCING_BUTTON_DOWN)
		    {
			DebCount ++ ;
			DebFlag = DEBOUNCING_BUTTON_UP ;
		    }
                }
		if(count == 10000000)
		{
		    printf("%d\n",DebCount);
		    count =0;
		    Test ++;
		}
        }
	BBBIO_sys_Disable_Debouncing(8 ,11);
        iolib_free();
	printf("Release\n");
        return(0);
}