Code Monkey home page Code Monkey logo

bma_binding_micropython's Introduction

概况

用于博世运动传感器驱动程序的 microPython 模块。

支持的传感器

  • BMA423

编译指南

获取源码

cd micropython
git clone https://github.com/liangyingy/bma_binding_micropython.git extmod/bma_binding_micropython

esp32

Note

编译前请准备好esp-idf

关于esp32更详细的编译说,请参考 https://github.com/micropython/micropython/tree/master/ports/esp32

cd ports/esp32/
make USER_C_MODULES=../../../extmod/bma_binding_micropython/micropython.cmake

文档

这个库的 API 文档可以在 Read the Docs 中找到。

验证与测试

  • [LILYGO T-Watch](bin/micropython-esp32-v1.19.bin)

开发计划

  • [x] 步数统计
  • [x] 活动检测中断
  • [x] 单击中断
  • [x] 双击中断
  • [x] 抬腕中断
  • [ ] 引入线程对中断进行处理
  • [ ] 支持spi接口
  • [ ] 更多的传感器

bma_binding_micropython's People

Contributors

lbuque avatar

Watchers

 avatar

bma_binding_micropython's Issues

兄弟我是b站来的

bma423这种一个py就搞定了 大可不必弄成c的再转过去太麻烦了,8080 7789那个mpy确实不错哦

build failed

bonjour ,
some issue when building micropython :

[233/247] Building C object esp-idf/ma...df_main.dir/__/__/frozen_content.c.obj FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/__/__/frozen_content.c.obj /home/pi/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DFFCONF_H=\"/home/pi/micropython/lib/oofatfs/ffconf.h\" -DLFS1_NO_ASSERT -DLFS1_NO_DEBUG -DLFS1_NO_ERROR -DLFS1_NO_MALLOC -DLFS1_NO_WARN -DLFS2_NO_ASSERT -DLFS2_NO_DEBUG -DLFS2_NO_ERROR -DLFS2_NO_MALLOC -DLFS2_NO_WARN -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DMICROPY_ESP_IDF_4=1 -DMICROPY_MODULE_FROZEN_MPY="(1)" -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool -DMICROPY_VFS_FAT=1 -DMICROPY_VFS_LFS2=1 -D__DBINTERFACE_PRIVATE=1 -Dvirt_fd_t="void*" -Iconfig -I/home/pi/micropython -I/home/pi/micropython/lib/berkeley-db-1.xx/PORT/include -I/home/pi/micropython/extmod/bma_binding_micropython/src -I/home/pi/micropython/extmod/bma_binding_micropython/lib/BMA423-Sensor-API -I../ -I../boards/GENERIC -I. -I/home/pi/esp-idf/components/bt/host/nimble/nimble -I/home/pi/esp-idf/components/newlib/platform_include -I/home/pi/esp-idf/components/freertos/include -I/home/pi/esp-idf/components/heap/include -I/home/pi/esp-idf/components/log/include -I/home/pi/esp-idf/components/soc/esp32/include -I/home/pi/esp-idf/components/soc/include -I/home/pi/esp-idf/components/esp_rom/include -I/home/pi/esp-idf/components/esp_common/include -I/home/pi/esp-idf/components/xtensa/include -I/home/pi/esp-idf/components/xtensa/esp32/include -I/home/pi/esp-idf/components/esp32/include -I/home/pi/esp-idf/components/driver/include -I/home/pi/esp-idf/components/esp_ringbuf/include -I/home/pi/esp-idf/components/esp_event/include -I/home/pi/esp-idf/components/tcpip_adapter/include -I/home/pi/esp-idf/components/lwip/include/apps -I/home/pi/esp-idf/components/lwip/include/apps/sntp -I/home/pi/esp-idf/components/lwip/lwip/src/include -I/home/pi/esp-idf/components/lwip/port/esp32/include -I/home/pi/esp-idf/components/lwip/port/esp32/include/arch -I/home/pi/esp-idf/components/vfs/include -I/home/pi/esp-idf/components/esp_wifi/include -I/home/pi/esp-idf/components/esp_wifi/esp32/include -I/home/pi/esp-idf/components/esp_eth/include -I/home/pi/esp-idf/components/efuse/include -I/home/pi/esp-idf/components/efuse/esp32/include -I/home/pi/esp-idf/components/app_trace/include -I/home/pi/esp-idf/components/app_update/include -I/home/pi/esp-idf/components/spi_flash/include -I/home/pi/esp-idf/components/bootloader_support/include -I/home/pi/esp-idf/components/bt/include -I/home/pi/esp-idf/components/bt/common/osi/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/porting/nimble/include -I/home/pi/esp-idf/components/bt/host/nimble/port/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/ans/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/bas/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gatt/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/ias/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/lls/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/services/tps/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/store/ram/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/nimble/host/store/config/include -I/home/pi/esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include -I/home/pi/esp-idf/components/bt/host/nimble/esp-hci/include -I/home/pi/esp-idf/components/nvs_flash/include -I/home/pi/esp-idf/components/mbedtls/port/include -I/home/pi/esp-idf/components/mbedtls/mbedtls/include -I/home/pi/esp-idf/components/esp_adc_cal/include -I/home/pi/esp-idf/components/mdns/include -I/home/pi/esp-idf/components/console -I/home/pi/esp-idf/components/sdmmc/include -I/home/pi/esp-idf/components/ulp/include -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -nostdlib -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Os -freorder-blocks -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.0.2-dirty\" -DGCC_NOT_5_2_0 -DESP_PLATFORM -DNDEBUG -Wno-clobbered -Wno-deprecated-declarations -Wno-missing-field-initializers -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/__/__/frozen_content.c.obj -MF esp-idf/main/CMakeFiles/__idf_main.dir/__/__/frozen_content.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/__/__/frozen_content.c.obj -c frozen_content.c frozen_content.c:108:5: error: redeclaration of enumerator 'MP_QSTR_debug' MP_QSTR_debug, ^~~~~~~~~~~~~ In file included from /home/pi/micropython/py/obj.h:33, from /home/pi/micropython/py/objint.h:30, from frozen_content.c:16: ./genhdr/qstrdefs.generated.h:582:6: note: previous definition of 'MP_QSTR_debug' was here QDEF(MP_QSTR_debug, 21972, 5, "debug") ^~~~~~~~~~~~~ /home/pi/micropython/py/qstr.h:41:34: note: in definition of macro 'QDEF' #define QDEF(id, hash, len, str) id, ^~ frozen_content.c:167:5: error: redeclaration of enumerator 'MP_QSTR_temperature' MP_QSTR_temperature, ^~~~~~~~~~~~~~~~~~~ In file included from /home/pi/micropython/py/obj.h:33, from /home/pi/micropython/py/objint.h:30, from frozen_content.c:16: ./genhdr/qstrdefs.generated.h:968:6: note: previous definition of 'MP_QSTR_temperature' was here QDEF(MP_QSTR_temperature, 57065, 11, "temperature") ^~~~~~~~~~~~~~~~~~~ /home/pi/micropython/py/qstr.h:41:34: note: in definition of macro 'QDEF' #define QDEF(id, hash, len, str) id, ^~ frozen_content.c:326:5: error: redeclaration of enumerator 'MP_QSTR_y' MP_QSTR_y, ^~~~~~~~~ In file included from /home/pi/micropython/py/obj.h:33, from /home/pi/micropython/py/objint.h:30, from frozen_content.c:16: ./genhdr/qstrdefs.generated.h:1053:6: note: previous definition of 'MP_QSTR_y' was here QDEF(MP_QSTR_y, 46556, 1, "y") ^~~~~~~~~ /home/pi/micropython/py/qstr.h:41:34: note: in definition of macro 'QDEF' #define QDEF(id, hash, len, str) id, ^~ [236/247] Building C object esp-idf/ma...nding_micropython/src/bma_bma423.c.obj /home/pi/micropython/extmod/bma_binding_micropython/src/bma_bma423.c: In function 'bma423_make_new': /home/pi/micropython/extmod/bma_binding_micropython/src/bma_bma423.c:273:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] args1[0] = MP_ROM_PTR(&irq_handler_obj); ^ /home/pi/micropython/extmod/bma_binding_micropython/src/bma_bma423.c:304:18: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] args1[0] = MP_ROM_PTR(&irq_handler_obj); ^ [238/247] Building C object esp-idf/ma...ython/lib/BMA423-Sensor-API/bma4.c.obj ninja: build stopped: subcommand failed. ninja failed with exit code 1 make: *** [Makefile:38: all] Error 2
thanks for help

bma423 as wakeup ESP32 : OK at first time then KO , how to clear IRQ

Bonjour ,
I wish use bma423 as twatch 2020 V1 wakeup from lightsleep
The bma wake the watch up only first time
seems that the IRQ is always ON and the watch wake up after machine.lighsleep(10000).
No display from bma423.c ...
How to clear the IRQ or debug ?
Thanks for help

...
b.wrist_wear(double_tap_cb)

def bma_interrupt(pin):
    print("bma interrupt" + str(pin))
    print("Got BMA Accellorator Interrupt on pin:", pin)

bmaint = Pin(39, Pin.IN)
bmaint.irq(trigger=Pin.IRQ_RISING, handler=None,wake=machine.sleep)
#esp32.wake_on_ext0(bmaint, esp32.WAKEUP_ALL_LOW)
#esp32.wake_on_ext0(bmaint, esp32.WAKEUP_ANY_HIGH)

while True:
    print('5 s')
    utime.sleep(5)
    print('sleep 10s')
    machine.lightsleep(10000)
    print(str(machine.wake_reason()))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.