You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • I'm working on a native class to recognize gestures.
    Input will be a distance sensor HC-SR04.
    To recognize a gesture something like setWatch is used.
    Its running up to the point that an interupt is recognized, but there are no args that would help to assign the interupt to a parent.
    Any idea ?

    void gotInterrupt(int n, ... ){ jsWarn("got it %j",n); }
    void jswrap_Gesture_scan(JsVar *parent){
      JsGesture gest;
      if(!getFromVar(&gest,parent)) return;
      IOEventFlags exti = EV_NONE;
      if (!jsiIsWatchingPin(gest.data.echo))
        exti = jshPinWatch(gest.data.echo, true);
        // disable event callbacks by default
      if (exti) {
    	jshSetEventCallback(exti, 0);
    	JsVar *fn = jsvNewNativeFunction((void (*)(void))gotInterrupt, JSWAT_VOID|JSWAT_THIS_ARG|(JSWAT_JSVAR<<JSWAT_BITS));
        if (!fn) return;
        jshSetEventCallback(exti, (JshEventCallbackCallback)jsvGetNativeFunctionPtr(fn));
    	jsvUnLock(fn);
      }
    }
    
About

Avatar for JumJum @JumJum started