diff --git a/examples/python/blink-io8.py b/examples/python/blink-io8.py index 5b4f99b..c03380f 100644 --- a/examples/python/blink-io8.py +++ b/examples/python/blink-io8.py @@ -25,13 +25,12 @@ import pymaa as maa import time -maa.maa_init() -x = maa.gpio_t() -maa.gpio_init(x, 8) -maa.gpio_dir(x, "out") +maa.init() +x = maa.Gpio(8) +x.dir(maa.MAA_GPIO_OUT) while True: - maa.gpio_write(x,1) + x.write(1) time.sleep(0.2) - maa.gpio_write(x,0) + x.write(0) time.sleep(0.2) diff --git a/examples/python/cycle-pwm3.py b/examples/python/cycle-pwm3.py index 0adc4b6..c90351a 100644 --- a/examples/python/cycle-pwm3.py +++ b/examples/python/cycle-pwm3.py @@ -25,7 +25,7 @@ import pymaa as maa import time -maa.maa_init() +maa.init() x = maa.PWM(0,3) x.enable(1); x.period_us(20) diff --git a/examples/python/hello_gpio.py b/examples/python/hello_gpio.py index 473156f..008fb00 100644 --- a/examples/python/hello_gpio.py +++ b/examples/python/hello_gpio.py @@ -24,8 +24,6 @@ import pymaa -pumaa.maa_init() -x = pymaa.gpio_t() -print(x.pin) -pymaa.gpio_init(x, 8) +pumaa.init() +x = pymaa.Gpio(13) print(x.pin) diff --git a/examples/python/readi2c.py b/examples/python/readi2c.py index 626cfb7..6f5ac4b 100644 --- a/examples/python/readi2c.py +++ b/examples/python/readi2c.py @@ -22,10 +22,10 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -import pymaa +import pymaa as maa -pumaa.maa_init() -x = pymaa.I2CSlave(27,28) +maa.init() +x = maa.I2c() x.address(0x62) y= " " ret = x.read(y, 2) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index faa5c4b..9259d04 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,5 +74,5 @@ if (SWIG_FOUND) include (${SWIG_USE_FILE}) add_subdirectory (python) - add_subdirectory (javascript) +# add_subdirectory (javascript) endif () diff --git a/src/maa.i b/src/maa.i index b1f372a..240358a 100644 --- a/src/maa.i +++ b/src/maa.i @@ -9,6 +9,8 @@ %rename(get_version) maa_get_version(); const char * maa_get_version(); +%rename(init) maa_init(); +int maa_init(); #### GPIO ####