SWIG: Added documentation to _upm.i

Includes documentation on the macros provided as well as a top-level
description of the file.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck 2018-01-22 12:01:45 -08:00
parent d06e632f3b
commit d49ab2ac95

View File

@ -1,5 +1,16 @@
/* Macro for adding JAVA run
usage: JAVA_ADD_INSTALLISR(javaupm_a110x)
/*
* This file provides additional non-wrapper code functionality for use
* throughout the UPM repository. This file is intended to be %imported
* from the top-level upm.i (not directly by UPM libraries).
*
* No wrapper code will be generated from importing this .i file.
*/
/* Macro for adding JAVA installISR w/runnable.
UPM_Classname - UPM class name w/namespace.
example usage: JAVA_ADD_INSTALLISR(upm::A110x)
*/
%define JAVA_ADD_INSTALLISR(UPM_Classname)
%extend UPM_Classname {
@ -10,26 +21,37 @@
}
%enddef
/* Define GETTER in the appropiate .i file with the getter function name
/* Macro for adding JAVA installISR w/runnable for a GPIO
UPM_Classname - UPM class name w/namespace.
example usage: JAVA_ADD_INSTALLISR_GPIO(upm::A110x)
Requires: 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
/* delete any existing ISR and GPIO context */
$self->uninstallISR();
// create gpio context
/* 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
/* Macro for adding JAVA installISR for GPIO interrupt w/runnable.
UPM_Classname - UPM class name w/namespace.
example usage: JAVA_ADD_INSTALLISR_INTERRUPT(upm::A110x)
Requires: Define INTERRUPT in the appropiate .i file with the
interrupt type.
*/
%define JAVA_ADD_INSTALLISR_INTERRUPT(UPM_Classname)
%extend UPM_Classname {
@ -41,6 +63,11 @@
}
%enddef
/* Macro for adding JAVA installISR for mraa::Edge w/runnable.
UPM_Classname - UPM class name w/namespace.
example usage: JAVA_ADD_INSTALLISR_EDGE(upm::A110x)
*/
%define JAVA_ADD_INSTALLISR_EDGE(UPM_Classname)
%extend UPM_Classname {
void installISR(mraa::Edge level, jobject runnable)
@ -50,18 +77,24 @@
}
%enddef
/* Macro for adding JAVA installISR for pin w/runnable.
UPM_Classname - UPM class name w/namespace.
example usage: JAVA_ADD_INSTALLISR_PIN(upm::A110x)
*/
%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)
/* Macro for adding JNI loadLibrary dependency.
MyModuleName: Target UPM JAVA package.
example usage: JAVA_JNI_LOADLIBRARY(javaupm_rhusb)
*/
%define JAVA_JNI_LOADLIBRARY(MyModuleName)
%pragma(java) jniclasscode=%{