maa: Initial commit of maa, a python and nodejs I2C skeleton only
This commit is contained in:
5
examples/CMakeLists.txt
Normal file
5
examples/CMakeLists.txt
Normal 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
10
examples/hellomaa.cpp
Normal 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;
|
||||
}
|
||||
5
examples/javascript/example.js
Normal file
5
examples/javascript/example.js
Normal file
@@ -0,0 +1,5 @@
|
||||
var m = require("maajs")
|
||||
|
||||
console.log("maa version: " + m.get_version());
|
||||
|
||||
var r = new m.I2C(20, 21);
|
||||
9
examples/python/readi2c.py
Normal file
9
examples/python/readi2c.py
Normal 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
11
examples/readi2c.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user