Private
Public Access
2
0

spi.hpp: Add C++ wrapper around Spi

* maa_spi_context becomes an opaque pointer
* C++ wrapper class Spi created
* swig now uses C++ wrapper Gpio to generate API

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-05-16 14:10:29 +01:00
parent 41f619048d
commit d0240cd50a
6 changed files with 94 additions and 61 deletions

View File

@@ -3,7 +3,7 @@
#include "gpio.hpp"
#include "pwm.hpp"
#include "i2c.hpp"
#include "spi.h"
#include "spi.hpp"
#include "aio.hpp"
%}
@@ -29,37 +29,7 @@ const char * maa_get_version();
#### SPI ####
%rename(Spi) maa_spi_context;
%ignore spifd;
typedef struct {
/*@{*/
int spifd; /**< File descriptor to SPI Device */
/*@}*/
} maa_spi_context;
%nodefault maa_spi_context;
%extend maa_spi_context {
maa_spi_context()
{
return maa_spi_init();
}
~maa_spi_context()
{
}
int mode(unsigned short mode)
{
return maa_spi_mode($self, mode);
}
int frequency(int hz)
{
return maa_spi_frequency($self, hz);
}
unsigned int write(unsigned int data)
{
return maa_spi_write($self, data);
}
}
%include "spi.hpp"
#### AIO ####