aio: add aio swig object
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
@@ -54,7 +54,7 @@ install (TARGETS maa DESTINATION lib)
|
|||||||
|
|
||||||
if (DOXYGEN_FOUND)
|
if (DOXYGEN_FOUND)
|
||||||
set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
|
set (CMAKE_SWIG_FLAGS -DDOXYGEN=${DOXYGEN_FOUND})
|
||||||
set (DOCFILES maa pwm i2c gpio)
|
set (DOCFILES maa pwm i2c gpio aio)
|
||||||
foreach (_file ${DOCFILES})
|
foreach (_file ${DOCFILES})
|
||||||
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}_doc.i
|
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}_doc.i
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/doxy2swig.py -n
|
||||||
|
|||||||
26
src/maa.i
26
src/maa.i
@@ -4,6 +4,7 @@
|
|||||||
#include "pwm.h"
|
#include "pwm.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "aio.h"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%rename(get_version) maa_get_version();
|
%rename(get_version) maa_get_version();
|
||||||
@@ -192,3 +193,28 @@ typedef struct {
|
|||||||
return maa_spi_write($self, data);
|
return maa_spi_write($self, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#### AIO ####
|
||||||
|
|
||||||
|
%rename(Aio) maa_aio_context;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
unsigned int channel;
|
||||||
|
FILE *adc_in_fp;
|
||||||
|
} maa_aio_context;
|
||||||
|
|
||||||
|
%nodefault maa_aio_context;
|
||||||
|
%extend maa_aio_context {
|
||||||
|
maa_aio_context(unsigned int aio_channel)
|
||||||
|
{
|
||||||
|
return maa_aio_init(aio_channel);
|
||||||
|
}
|
||||||
|
~maa_aio_context()
|
||||||
|
{
|
||||||
|
maa_aio_close($self);
|
||||||
|
}
|
||||||
|
unsigned int read()
|
||||||
|
{
|
||||||
|
return maa_aio_read_u16($self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user