gpio.hpp: Add C++ wrapper around Gpio
[contrib/mraa.git] / src / maa.i
1 %{
2     #include "maa.h"
3     #include "gpio.hpp"
4     #include "pwm.hpp"
5     #include "i2c.hpp"
6     #include "spi.h"
7     #include "aio.hpp"
8 %}
9
10 %init %{
11     //Adding maa_init() to the module initialisation process
12     maa_init();
13 %}
14
15 %rename(get_version) maa_get_version();
16 const char * maa_get_version();
17
18 #### GPIO ####
19
20 %include "gpio.hpp"
21
22 #### i2c ####
23
24 %include "i2c.hpp"
25
26 #### PWM ####
27
28 %include "pwm.hpp"
29
30 #### SPI ####
31
32 %rename(Spi) maa_spi_context;
33
34 %ignore spifd;
35 typedef struct {
36     /*@{*/
37     int spifd; /**< File descriptor to SPI Device */
38     /*@}*/
39 } maa_spi_context;
40
41 %nodefault maa_spi_context;
42 %extend maa_spi_context {
43   maa_spi_context()
44   {
45     return maa_spi_init();
46   }
47   ~maa_spi_context()
48   {
49   }
50   int mode(unsigned short mode)
51   {
52     return maa_spi_mode($self, mode);
53   }
54   int frequency(int hz)
55   {
56     return maa_spi_frequency($self, hz);
57   }
58   unsigned int write(unsigned int data)
59   {
60     return maa_spi_write($self, data);
61   }
62 }
63
64 #### AIO ####
65
66 %include "aio.hpp"