コード例 #1
0
def reset(device):
    libmetawear.mbl_mw_logging_stop(device.board)
    libmetawear.mbl_mw_logging_clear_entries(device.board)
    libmetawear.mbl_mw_macro_erase_all(device.board)
    libmetawear.mbl_mw_debug_reset_after_gc(device.board)
    print("Erase logger and clear all entries")
    sleep(1.0)

    libmetawear.mbl_mw_debug_disconnect(device.board)
    sleep(1.0)
コード例 #2
0
ファイル: utils.py プロジェクト: makenasandra/aha
def reset(device) -> None:
    """
    This function resets your device if its stuck in a bad state
    :param device:
    :return None:
    """
    # Stops data logging
    libmetawear.mbl_mw_logging_stop(device.board)
    # Clear the logger of saved entries
    libmetawear.mbl_mw_logging_clear_entries(device.board)
    # Remove all macros on the flash memory
    libmetawear.mbl_mw_macro_erase_all(device.board)
    # Restarts the board after performing garbage collection
    libmetawear.mbl_mw_debug_reset_after_gc(device.board)
    libmetawear.mbl_mw_debug_disconnect(device.board)
    device.disconnect()
コード例 #3
0
    for x in range(0, result['length']):
        wrapper = DataHandler(result['signals'].contents[x])
        libmetawear.mbl_mw_anonymous_datasignal_subscribe(
            result['signals'].contents[x], wrapper.data_handler_fn)
        handlers.append(wrapper)

    def progress_update_handler(left, total):
        if (left == 0):
            dl_event.set()

    def unknown_entry_handler(id, epoch, data, length):
        print("unknown entry = " + str(id))

    print("Downloading log")
    progress_update_fn = FnVoid_UInt_UInt(progress_update_handler)
    unknown_entry_fn = FnVoid_UByte_Long_UByteP_UByte(unknown_entry_handler)
    download_handler = LogDownloadHandler(
        received_progress_update=progress_update_fn,
        received_unknown_entry=unknown_entry_fn,
        received_unhandled_entry=cast(None, FnVoid_DataP))
    libmetawear.mbl_mw_logging_download(metawear.board, 10,
                                        byref(download_handler))
    dl_event.wait()

    print("Download completed")
    libmetawear.mbl_mw_macro_erase_all(metawear.board)
    libmetawear.mbl_mw_debug_reset_after_gc(metawear.board)
    libmetawear.mbl_mw_debug_disconnect(metawear.board)

    sleep(1.0)
コード例 #4
0
# usage: python full_reset.py [mac]
from __future__ import print_function
import sys
from mbientlab.metawear import MetaWear, libmetawear
from mbientlab.metawear.cbindings import *
from time import sleep
from threading import Event

# device = MetaWear('C2:9B:59:07:56:C9')
device = MetaWear('FB:81:71:31:92:7A')
device.connect()
print("Connected")

libmetawear.mbl_mw_logging_stop(device.board)
libmetawear.mbl_mw_logging_clear_entries(device.board)
libmetawear.mbl_mw_macro_erase_all(device.board)
libmetawear.mbl_mw_debug_reset_after_gc(device.board)
print("Erase logger and clear all entries")
sleep(1.0)

libmetawear.mbl_mw_debug_disconnect(device.board)
sleep(1.0)

device.disconnect()
print("Disconnect")
sleep(1.0)