examples: Update examples to use newer maa functions
* Use maa_init() before any other maa functions are called * Use ioNN instead of gpioXX, Using mapping Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@@ -29,10 +29,11 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
maa_init();
|
||||||
fprintf(stdout, "MAA Version: %d\nStarting Blinking on IO8\n",
|
fprintf(stdout, "MAA Version: %d\nStarting Blinking on IO8\n",
|
||||||
maa_get_version());
|
maa_get_version());
|
||||||
maa_gpio_context* gpio;
|
maa_gpio_context* gpio;
|
||||||
gpio = maa_gpio_init(26);
|
gpio = maa_gpio_init(8);
|
||||||
maa_gpio_dir(gpio, MAA_GPIO_OUT);
|
maa_gpio_dir(gpio, MAA_GPIO_OUT);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
|
maa_init();
|
||||||
maa_pwm_context* pwm;
|
maa_pwm_context* pwm;
|
||||||
pwm = maa_pwm_init(0, 3);
|
pwm = maa_pwm_init(0, 3);
|
||||||
if (pwm == NULL) {
|
if (pwm == NULL) {
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
maa_init();
|
||||||
float direction = 0;
|
float direction = 0;
|
||||||
int16_t x = 0, y = 0, z = 0;
|
int16_t x = 0, y = 0, z = 0;
|
||||||
char rx_tx_buf[MAX_BUFFER_LENGTH];
|
char rx_tx_buf[MAX_BUFFER_LENGTH];
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var m = require("maajs")
|
var m = require("maajs")
|
||||||
|
m.init();
|
||||||
console.log("maa version: " + m.get_version());
|
console.log("maa version: " + m.get_version());
|
||||||
|
|
||||||
var r = new m.I2C(20, 21);
|
var r = new m.I2C(20, 21);
|
||||||
|
|||||||
@@ -25,8 +25,9 @@
|
|||||||
import pymaa as maa
|
import pymaa as maa
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
maa.maa_init()
|
||||||
x = maa.gpio_t()
|
x = maa.gpio_t()
|
||||||
maa.gpio_init(x, 26)
|
maa.gpio_init(x, 8)
|
||||||
maa.gpio_dir(x, "out")
|
maa.gpio_dir(x, "out")
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
import pymaa as maa
|
import pymaa as maa
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
maa.maa_init()
|
||||||
x = maa.PWM(0,3)
|
x = maa.PWM(0,3)
|
||||||
x.enable(1);
|
x.enable(1);
|
||||||
x.period_us(20)
|
x.period_us(20)
|
||||||
|
|||||||
@@ -24,7 +24,8 @@
|
|||||||
|
|
||||||
import pymaa
|
import pymaa
|
||||||
|
|
||||||
|
pumaa.maa_init()
|
||||||
x = pymaa.gpio_t()
|
x = pymaa.gpio_t()
|
||||||
print(x.pin)
|
print(x.pin)
|
||||||
pymaa.gpio_init(x, 20)
|
pymaa.gpio_init(x, 8)
|
||||||
print(x.pin)
|
print(x.pin)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
import pymaa
|
import pymaa
|
||||||
|
|
||||||
|
pumaa.maa_init()
|
||||||
x = pymaa.I2CSlave(27,28)
|
x = pymaa.I2CSlave(27,28)
|
||||||
x.address(0x62)
|
x.address(0x62)
|
||||||
y= " "
|
y= " "
|
||||||
|
|||||||
Reference in New Issue
Block a user