mirror of
				https://github.com/eclipse/upm.git
				synced 2025-11-04 09:05:34 +03:00 
			
		
		
		
	Added new macros for installISR and applied where possible.
This commit is contained in:
		
							
								
								
									
										50
									
								
								src/_upm.i
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								src/_upm.i
									
									
									
									
									
								
							@@ -10,6 +10,56 @@
 | 
			
		||||
}
 | 
			
		||||
%enddef
 | 
			
		||||
 | 
			
		||||
/* Define GETTER in the appropiate .i file with the getter function name
 | 
			
		||||
*/
 | 
			
		||||
%define JAVA_ADD_INSTALLISR_GPIO(UPM_Classname)
 | 
			
		||||
%extend UPM_Classname {
 | 
			
		||||
    void installISR(int gpio, mraa::Edge level, jobject runnable)
 | 
			
		||||
    {
 | 
			
		||||
      // delete any existing ISR and GPIO context
 | 
			
		||||
      $self->uninstallISR();
 | 
			
		||||
 | 
			
		||||
      // create gpio context
 | 
			
		||||
      mraa::Gpio* swg_gpioIntr = $self->GETTER;
 | 
			
		||||
 | 
			
		||||
      swg_gpioIntr->dir(mraa::DIR_IN);
 | 
			
		||||
      swg_gpioIntr->isr(level, runnable);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
%enddef
 | 
			
		||||
 | 
			
		||||
/* Define INTERRUPT in the appropiate .i file with the interrupt type
 | 
			
		||||
*/
 | 
			
		||||
%define JAVA_ADD_INSTALLISR_INTERRUPT(UPM_Classname)
 | 
			
		||||
%extend UPM_Classname {
 | 
			
		||||
    void installISR(INTERRUPT intr, int gpio,
 | 
			
		||||
                    mraa::Edge level, jobject runnable)
 | 
			
		||||
    {
 | 
			
		||||
        $self->installISR(intr, gpio, level, mraa_java_isr_callback, runnable);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
%enddef
 | 
			
		||||
 | 
			
		||||
%define JAVA_ADD_INSTALLISR_EDGE(UPM_Classname)
 | 
			
		||||
%extend UPM_Classname {
 | 
			
		||||
    void installISR(mraa::Edge level, jobject runnable)
 | 
			
		||||
    {
 | 
			
		||||
      $self->installISR(level, mraa_java_isr_callback, runnable);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
%enddef
 | 
			
		||||
 | 
			
		||||
%define JAVA_ADD_INSTALLISR_PIN(UPM_Classname)
 | 
			
		||||
%extend UPM_Classname {
 | 
			
		||||
    void installISR(int pin, jobject runnable)
 | 
			
		||||
    {
 | 
			
		||||
        $self->installISR(pin, mraa_java_isr_callback, runnable);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
%enddef
 | 
			
		||||
 | 
			
		||||
/* Macro for adding JNI loadLibrary dependency
 | 
			
		||||
    usage: JAVA_JNI_LOADLIBRARY(javaupm_rhusb)
 | 
			
		||||
*/
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user