Private
Public Access
2
0

maa: Initial commit of maa, a python and nodejs I2C skeleton only

This commit is contained in:
Brendan Le Foll
2014-04-08 18:43:26 +01:00
commit 00ba95bac0
31 changed files with 1055 additions and 0 deletions

5
examples/CMakeLists.txt Normal file
View File

@@ -0,0 +1,5 @@
add_executable (readi2c readi2c.cpp)
add_executable (hellomaa hellomaa.cpp)
target_link_libraries (hellomaa maa)
target_link_libraries (readi2c maa)

10
examples/hellomaa.cpp Normal file
View File

@@ -0,0 +1,10 @@
#include "stdio.h"
#include "../src/maa.h"
int
main(int argc, char **argv)
{
fprintf(stdout, "hello maa\n Version: %d\n", get_version());
return 0;
}

View File

@@ -0,0 +1,5 @@
var m = require("maajs")
console.log("maa version: " + m.get_version());
var r = new m.I2C(20, 21);

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env python2
import pymaa
x = pymaa.I2C(27,28)
y= " "
ret = x.read(0x62, y, 2)
print(y)

11
examples/readi2c.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include "../src/maa.h"
int
main ()
{
maa::I2C i2c(28, 27);
int addr = 0x62;
char data[2];
int ret = i2c.read(addr, data, 2);
return ret;
}