Private
Public Access
2
0

aio.hpp: Add C++ wrapper around Aio

* maa_aio_context becomes an opaque pointer
* C++ wrapper class Aio created
* examples/c++ with a sample for Aio created
* swig now uses C++ wrapper Aio to generate an API
* python generated code is now C++

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-05-15 22:47:38 +01:00
parent e84406d697
commit 554505b640
11 changed files with 125 additions and 41 deletions

View File

@@ -4,7 +4,7 @@
#include "pwm.h"
#include "i2c.h"
#include "spi.h"
#include "aio.h"
#include "aio.hpp"
%}
%init %{
@@ -112,7 +112,7 @@ typedef struct {
{
Py_INCREF(pyfunc);
// do a nasty cast to get away from the warnings
maa_gpio_isr(self, MAA_GPIO_EDGE_BOTH, pyfunc);
maa_gpio_isr(self, MAA_GPIO_EDGE_BOTH, (void (*) ()) pyfunc);
return 0;
}
#else
@@ -270,25 +270,4 @@ typedef struct {
#### AIO ####
%rename(Aio) maa_aio_context;
%ignore adc_in_fp;
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()
{
}
unsigned int read()
{
return maa_aio_read($self);
}
}
%include "aio.hpp"