UNPKG

metawear

Version:
1,499 lines (1,331 loc) 174 kB
// Warning!!! // This JavaScript module is generated from the MetaWear C++ API header files // Do not edit var ref = require('ref-napi'); var ffi = require('ffi-napi'); var Struct = require('ref-struct-di')(ref); var ArrayType = require('ref-array-di')(ref); var Enum = require('enum'); var LIBMETAWEAR_PATH = require('./libmetawear-path'); // TODO: These exist because arrays are not handled perfectly yet var ArrayUByte_6 = ArrayType(ref.types.uint8, 6); var ArrayFloat = ArrayType(ref.types.float); var ArrayUByte_10 = ArrayType(ref.types.uint8, 10); var ArrayUByte_16 = ArrayType(ref.types.uint8, 16); var ProximityTsl2671Channel = new Enum({ '_0': 1, '_1': 2, 'BOTH': 3 }, ref.types.int); ProximityTsl2671Channel.alignment = 4; var BleAdType = new Enum({ 'CONNECTED_UNDIRECTED': 0, 'CONNECTED_DIRECTED': 1 }, ref.types.int); BleAdType.alignment = 4; var DataTypeId = new Enum({ 'UINT32': 0, 'FLOAT': 1, 'CARTESIAN_FLOAT': 2, 'INT32': 3, 'BYTE_ARRAY': 4, 'BATTERY_STATE': 5, 'TCS34725_ADC': 6, 'EULER_ANGLE': 7, 'QUATERNION': 8, 'CORRECTED_CARTESIAN_FLOAT': 9, 'OVERFLOW_STATE': 10, 'SENSOR_ORIENTATION': 11, 'STRING': 12, 'LOGGING_TIME': 13, 'BTLE_ADDRESS': 14, 'BOSCH_ANY_MOTION': 15, 'CALIBRATION_STATE': 16, 'DATA_ARRAY': 17, 'BOSCH_TAP': 18, 'BOSCH_GESTURE': 19 }, ref.types.int); DataTypeId.alignment = 4; var SensorFusionGyroRange = new Enum({ '_2000DPS': 0, '_1000DPS': 1, '_500DPS': 2, '_250DPS': 3 }, ref.types.int); SensorFusionGyroRange.alignment = 4; var TimeMode = new Enum({ 'ABSOLUTE': 0, 'DIFFERENTIAL': 1 }, ref.types.int); TimeMode.alignment = 4; var ProximityTsl2671Current = new Enum({ '_100mA': 0, '_50mA': 1, '_25mA': 2, '_12_5mA': 3 }, ref.types.int); ProximityTsl2671Current.alignment = 4; var MagBmm150Odr = new Enum({ '_10Hz': 0, '_2Hz': 1, '_6Hz': 2, '_8Hz': 3, '_15Hz': 4, '_20Hz': 5, '_25Hz': 6, '_30Hz': 7 }, ref.types.int); MagBmm150Odr.alignment = 4; var AccBoschGesture = new Enum({ 'UNKNOWN': 0, 'PUSH_ARM_DOWN': 1, 'PIVOT_UP': 2, 'SHAKE': 3, 'ARM_FLICK_IN': 4, 'ARM_FLICK_OUT': 5 }, ref.types.int); AccBoschGesture.alignment = 4; var NeoPixelColorOrdering = new Enum({ 'WS2811_RGB': 0, 'WS2811_RBG': 1, 'WS2811_GRB': 2, 'WS2811_GBR': 3 }, ref.types.int); NeoPixelColorOrdering.alignment = 4; var SensorOrientation = new Enum({ 'FACE_UP_PORTRAIT_UPRIGHT': 0, 'FACE_UP_PORTRAIT_UPSIDE_DOWN': 1, 'FACE_UP_LANDSCAPE_LEFT': 2, 'FACE_UP_LANDSCAPE_RIGHT': 3, 'FACE_DOWN_PORTRAIT_UPRIGHT': 4, 'FACE_DOWN_PORTRAIT_UPSIDE_DOWN': 5, 'FACE_DOWN_LANDSCAPE_LEFT': 6, 'FACE_DOWN_LANDSCAPE_RIGHT': 7 }, ref.types.int); SensorOrientation.alignment = 4; var Model = new Enum({ 'NA': -1, 'METAWEAR_R': 0, 'METAWEAR_RG': 1, 'METAWEAR_RPRO': 2, 'METAWEAR_C': 3, 'METAWEAR_CPRO': 4, 'METAENV': 5, 'METADETECT': 6, 'METAHEALTH': 7, 'METATRACKER': 8, 'METAMOTION_R': 9, 'METAMOTION_RL': 10, 'METAMOTION_C': 11, 'METAMOTION_S': 12 }, ref.types.int); Model.alignment = 4; var BaroBmp280StandbyTime = new Enum({ '_0_5ms': 0, '_62_5ms': 1, '_125ms': 2, '_250ms': 3, '_500ms': 4, '_1000ms': 5, '_2000ms': 6, '_4000ms': 7 }, ref.types.int); BaroBmp280StandbyTime.alignment = 4; var AlsLtr329MeasurementRate = new Enum({ '_50ms': 0, '_100ms': 1, '_200ms': 2, '_500ms': 3, '_1000ms': 4, '_2000ms': 5 }, ref.types.int); AlsLtr329MeasurementRate.alignment = 4; var NeoPixelRotDirection = new Enum({ 'TOWARDS': 0, 'AWAY': 1 }, ref.types.int); NeoPixelRotDirection.alignment = 4; var LedColor = new Enum({ 'GREEN': 0, 'RED': 1, 'BLUE': 2 }, ref.types.int); LedColor.alignment = 4; var MetaWearRChannel = new Enum({ 'ON_DIE': 0, 'EXT_THERMISTOR': 1 }, ref.types.int); MetaWearRChannel.alignment = 4; var GattCharWriteType = new Enum({ 'WITH_RESPONSE': 0, 'WITHOUT_RESPONSE': 1 }, ref.types.int); GattCharWriteType.alignment = 4; var Module = new Enum({ 'SWITCH': 1, 'LED': 2, 'ACCELEROMETER': 3, 'TEMPERATURE': 4, 'GPIO': 5, 'NEO_PIXEL': 6, 'IBEACON': 7, 'HAPTIC': 8, 'DATA_PROCESSOR': 9, 'EVENT': 10, 'LOGGING': 11, 'TIMER': 12, 'I2C': 13, 'MACRO': 15, 'CONDUCTANCE': 16, 'SETTINGS': 17, 'BAROMETER': 18, 'GYRO': 19, 'AMBIENT_LIGHT': 20, 'MAGNETOMETER': 21, 'HUMIDITY': 22, 'COLOR_DETECTOR': 23, 'PROXIMITY': 24, 'SENSOR_FUSION': 25, 'DEBUG': 254 }, ref.types.int); Module.alignment = 4; var PassthroughMode = new Enum({ 'ALL': 0, 'CONDITIONAL': 1, 'COUNT': 2 }, ref.types.int); PassthroughMode.alignment = 4; var BaroBoschIirFilter = new Enum({ 'OFF': 0, 'AVG_2': 1, 'AVG_4': 2, 'AVG_8': 3, 'AVG_16': 4 }, ref.types.int); BaroBoschIirFilter.alignment = 4; var DeltaMode = new Enum({ 'ABSOLUTE': 0, 'DIFFERENTIAL': 1, 'BINARY': 2 }, ref.types.int); DeltaMode.alignment = 4; var AccBma255Odr = new Enum({ '_15_62Hz': 0, '_31_26Hz': 1, '_62_5Hz': 2, '_125Hz': 3, '_250Hz': 4, '_500Hz': 5, '_1000Hz': 6, '_2000Hz': 7 }, ref.types.int); AccBma255Odr.alignment = 4; var ThresholdMode = new Enum({ 'ABSOLUTE': 0, 'BINARY': 1 }, ref.types.int); ThresholdMode.alignment = 4; var AccMma8452qOdr = new Enum({ '_800Hz': 0, '_400Hz': 1, '_200Hz': 2, '_100Hz': 3, '_50Hz': 4, '_12_5Hz': 5, '_6_25Hz': 6, '_1_56Hz': 7 }, ref.types.int); AccMma8452qOdr.alignment = 4; var ComparatorMode = new Enum({ 'ABSOLUTE': 0, 'REFERENCE': 1, 'ZONE': 2, 'BINARY': 3 }, ref.types.int); ComparatorMode.alignment = 4; var LedPreset = new Enum({ 'BLINK': 0, 'PULSE': 1, 'SOLID': 2 }, ref.types.int); LedPreset.alignment = 4; var BaroBme280StandbyTime = new Enum({ '_0_5ms': 0, '_62_5ms': 1, '_125ms': 2, '_250ms': 3, '_500ms': 4, '_1000ms': 5, '_10ms': 6, '_20ms': 7 }, ref.types.int); BaroBme280StandbyTime.alignment = 4; var MetaWearRProChannel = new Enum({ 'ON_DIE': 0, 'ON_BOARD_THERMISTOR': 1, 'EXT_THERMISTOR': 2, 'BMP280': 3 }, ref.types.int); MetaWearRProChannel.alignment = 4; var AccMma8452qCutoffFreq = new Enum({ 'HIGHEST': 0, 'HIGH': 1, 'MEDIUM': 2, 'LOW': 3 }, ref.types.int); AccMma8452qCutoffFreq.alignment = 4; var PulseOutput = new Enum({ 'WIDTH': 0, 'AREA': 1, 'PEAK': 2, 'ON_DETECTION': 3 }, ref.types.int); PulseOutput.alignment = 4; var AccMma8452qRange = new Enum({ '_2G': 0, '_4G': 1, '_8G': 2 }, ref.types.int); AccMma8452qRange.alignment = 4; var AccBoschMotion = new Enum({ 'SIGMOTION': 0, 'NOMOTION': 1, 'ANYMOTION': 2 }, ref.types.int); AccBoschMotion.alignment = 4; var ConductanceRange = new Enum({ '_50uS': 0, '_100uS': 1, '_150uS': 2, '_200uS': 3 }, ref.types.int); ConductanceRange.alignment = 4; var ComparatorOperation = new Enum({ 'EQ': 0, 'NEQ': 1, 'LT': 2, 'LTE': 3, 'GT': 4, 'GTE': 5 }, ref.types.int); ComparatorOperation.alignment = 4; var GpioAnalogReadMode = new Enum({ 'ABS_REF': 0, 'ADC': 1 }, ref.types.int); GpioAnalogReadMode.alignment = 4; var AccBoschAxisXyzSign = new Enum({ '_000': 0, '_100': 1, '_110': 2, '_101': 3, '_010': 4, '_011': 5, '_001': 6, '_111': 7 }, ref.types.int); AccBoschAxisXyzSign.alignment = 4; var AccBoschTypewrist = new Enum({ 'NONE': 0, 'WEARK_WAKEUP': 1, 'GESTURE': 2 }, ref.types.int); AccBoschTypewrist.alignment = 4; var AccBoschOrientationMode = new Enum({ 'SYMMETRICAL': 0, 'HIGH_ASYMMETRICAL': 1, 'LOW_ASYMMETRICAL': 2 }, ref.types.int); AccBoschOrientationMode.alignment = 4; var GyroBoschOdr = new Enum({ '_25Hz': 6, '_50Hz': 7, '_100Hz': 8, '_200Hz': 9, '_400Hz': 10, '_800Hz': 11, '_1600Hz': 12, '_3200Hz': 13 }, ref.types.int); GyroBoschOdr.alignment = 4; var AccBoschActivity = new Enum({ 'STILL': 0, 'WALKING': 1, 'RUNNING': 2, 'UNKNOWN': 3 }, ref.types.int); AccBoschActivity.alignment = 4; var SensorFusionMode = new Enum({ 'SLEEP': 0, 'NDOF': 1, 'IMU_PLUS': 2, 'COMPASS': 3, 'M4G': 4 }, ref.types.int); SensorFusionMode.alignment = 4; var AccBoschRange = new Enum({ '_2G': 0, '_4G': 1, '_8G': 2, '_16G': 3 }, ref.types.int); AccBoschRange.alignment = 4; var AccBmi160Odr = new Enum({ '_0_78125Hz': 0, '_1_5625Hz': 1, '_3_125Hz': 2, '_6_25Hz': 3, '_12_5Hz': 4, '_25Hz': 5, '_50Hz': 6, '_100Hz': 7, '_200Hz': 8, '_400Hz': 9, '_800Hz': 10, '_1600Hz': 11 }, ref.types.int); AccBmi160Odr.alignment = 4; var AccBmi270Odr = new Enum({ '_0_78125Hz': 0, '_1_5625Hz': 1, '_3_125Hz': 2, '_6_25Hz': 3, '_12_5Hz': 4, '_25Hz': 5, '_50Hz': 6, '_100Hz': 7, '_200Hz': 8, '_400Hz': 9, '_800Hz': 10, '_1600Hz': 11 }, ref.types.int); AccBmi270Odr.alignment = 4; var AccBoschDoubleTapWindow = new Enum({ '_50ms': 0, '_100ms': 1, '_150ms': 2, '_200ms': 3, '_250ms': 4, '_375ms': 5, '_500ms': 6, '_700ms': 7 }, ref.types.int); AccBoschDoubleTapWindow.alignment = 4; var AccBoschAxisXyzRemap = new Enum({ 'XYZ': 0, 'YZX': 1, 'ZXY': 2, 'XZY': 3, 'YXZ': 4, 'ZYX': 5 }, ref.types.int); AccBoschAxisXyzRemap.alignment = 4; var AccBmi160StepCounterMode = new Enum({ 'NORMAL': 0, 'SENSITIVE': 1, 'ROBUST': 2 }, ref.types.int); AccBmi160StepCounterMode.alignment = 4; var SensorFusionAccRange = new Enum({ '_2G': 0, '_4G': 1, '_8G': 2, '_16G': 3 }, ref.types.int); SensorFusionAccRange.alignment = 4; var MathOperation = new Enum({ 'ADD': 1, 'MULTIPLY': 2, 'DIVIDE': 3, 'MODULUS': 4, 'EXPONENT': 5, 'SQRT': 6, 'LSHIFT': 7, 'RSHIFT': 8, 'SUBTRACT': 9, 'ABS_VALUE': 10, 'CONSTANT': 11 }, ref.types.int); MathOperation.alignment = 4; var GpioPinChangeType = new Enum({ 'RISING': 1, 'FALLING': 2, 'ANY': 3 }, ref.types.int); GpioPinChangeType.alignment = 4; var SensorFusionData = new Enum({ 'CORRECTED_ACC': 0, 'CORRECTED_GYRO': 1, 'CORRECTED_MAG': 2, 'QUATERNION': 3, 'EULER_ANGLE': 4, 'GRAVITY_VECTOR': 5, 'LINEAR_ACC': 6 }, ref.types.int); SensorFusionData.alignment = 4; var WhitelistFilter = new Enum({ 'ALLOW_FROM_ANY': 0, 'SCAN_REQUESTS': 1, 'CONNECTION_REQUESTS': 2, 'SCAN_AND_CONNECTION_REQUESTS': 3 }, ref.types.int); WhitelistFilter.alignment = 4; var AccBoschTapQuietTime = new Enum({ '_30ms': 0, '_20ms': 1 }, ref.types.int); AccBoschTapQuietTime.alignment = 4; var AccBoschTapShockTime = new Enum({ '_50ms': 0, '_75ms': 1 }, ref.types.int); AccBoschTapShockTime.alignment = 4; var BaroBoschOversampling = new Enum({ 'SKIP': 0, 'ULTRA_LOW_POWER': 1, 'LOW_POWER': 2, 'STANDARD': 3, 'HIGH': 4, 'ULTRA_HIGH': 5 }, ref.types.int); BaroBoschOversampling.alignment = 4; var HumidityBme280Oversampling = new Enum({ '_1X': 1, '_2X': 2, '_4X': 3, '_8X': 4, '_16X': 5 }, ref.types.int); HumidityBme280Oversampling.alignment = 4; var ColorDetectorTcs34725Gain = new Enum({ '_1X': 0, '_4X': 1, '_16X': 2, '_60X': 3 }, ref.types.int); ColorDetectorTcs34725Gain.alignment = 4; var TemperatureSource = new Enum({ 'INVALID': -1, 'NRF_DIE': 0, 'EXT_THERM': 1, 'BMP280': 2, 'PRESET_THERM': 3 }, ref.types.int); TemperatureSource.alignment = 4; var GpioPullMode = new Enum({ 'UP': 0, 'DOWN': 1, 'NONE': 2 }, ref.types.int); GpioPullMode.alignment = 4; var AlsLtr329IntegrationTime = new Enum({ '_100ms': 0, '_50ms': 1, '_200ms': 2, '_400ms': 3, '_150ms': 4, '_250ms': 5, '_300ms': 6, '_350ms': 7 }, ref.types.int); AlsLtr329IntegrationTime.alignment = 4; var MagBmm150Preset = new Enum({ 'LOW_POWER': 0, 'REGULAR': 1, 'ENHANCED_REGULAR': 2, 'HIGH_ACCURACY': 3 }, ref.types.int); MagBmm150Preset.alignment = 4; var SpiMode = new Enum({ '_0': 0, '_1': 1, '_2': 2, '_3': 3 }, ref.types.int); SpiMode.alignment = 4; var SpiFrequency = new Enum({ '_125KHz': 0, '_250KHz': 1, '_500KHz': 2, '_1MHz': 3, '_2MHz': 4, '_4MHz': 5, '_8MHz': 6 }, ref.types.int); SpiFrequency.alignment = 4; var GyroBoschRange = new Enum({ '_2000dps': 0, '_1000dps': 1, '_500dps': 2, '_250dps': 3, '_125dps': 4 }, ref.types.int); GyroBoschRange.alignment = 4; var AlsLtr329Gain = new Enum({ '_1X': 0, '_2X': 1, '_4X': 2, '_8X': 3, '_48X': 4, '_96X': 5 }, ref.types.int); AlsLtr329Gain.alignment = 4; var FnVoid_VoidP_Int = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.types.int32]); var FnInt_VoidP_UByteP_UByte = ffi.Function(ref.types.int32, [ref.refType(ref.types.void), ref.refType(ref.types.uint8), ref.types.uint8]); var MetaWearBoard = ref.types.void; var FnVoid_MetaWearBoardP = ffi.Function(ref.types.void, [ref.refType(MetaWearBoard)]); var Data = Struct({ 'epoch': ref.types.int64, 'extra': ref.refType(ref.types.void), 'value': ref.refType(ref.types.void), 'type_id': DataTypeId, 'length': ref.types.uint8 }); var FnVoid_VoidP_DataP = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(Data)]); var FnVoid_VoidP_MetaWearBoardP_Int = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(MetaWearBoard), ref.types.int32]); var CalibrationData = Struct({ 'acc': ArrayUByte_10, 'gyro': ArrayUByte_10, 'mag': ArrayUByte_10 }); var FnVoid_VoidP_MetaWearBoardP_CalibrationDataP = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(MetaWearBoard), ref.refType(CalibrationData)]); var DataLogger = ref.types.void; var FnVoid_VoidP_DataLoggerP = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(DataLogger)]); var Event = ref.types.void; var FnVoid_VoidP_EventP_Int = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(Event), ref.types.int32]); var Timer = ref.types.void; var FnVoid_VoidP_TimerP = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(Timer)]); var AnonymousDataSignal = ref.types.void; var FnVoid_VoidP_MetaWearBoardP_AnonymousDataSignalP_UInt = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(MetaWearBoard), ref.refType(AnonymousDataSignal), ref.types.uint32]); var DataProcessor = ref.types.void; var FnVoid_VoidP_DataProcessorP = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(DataProcessor)]); var GattChar = Struct({ 'service_uuid_high': ref.types.uint64, 'service_uuid_low': ref.types.uint64, 'uuid_high': ref.types.uint64, 'uuid_low': ref.types.uint64 }); var FnVoid_VoidP_VoidP_GattCharWriteType_GattCharP_UByteP_UByte = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(ref.types.void), GattCharWriteType, ref.refType(GattChar), ref.refType(ref.types.uint8), ref.types.uint8]); var FnVoid_VoidP_VoidP_GattCharP_FnIntVoidPtrArray = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(ref.types.void), ref.refType(GattChar), FnInt_VoidP_UByteP_UByte]); var FnVoid_VoidP_VoidP_GattCharP_FnIntVoidPtrArray_FnVoidVoidPtrInt = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(ref.types.void), ref.refType(GattChar), FnInt_VoidP_UByteP_UByte, FnVoid_VoidP_Int]); var FnVoid_VoidP_VoidP_FnVoidVoidPtrInt = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(ref.types.void), FnVoid_VoidP_Int]); var BtleConnection = Struct({ 'context': ref.refType(ref.types.void), 'write_gatt_char': FnVoid_VoidP_VoidP_GattCharWriteType_GattCharP_UByteP_UByte, 'read_gatt_char': FnVoid_VoidP_VoidP_GattCharP_FnIntVoidPtrArray, 'enable_notifications': FnVoid_VoidP_VoidP_GattCharP_FnIntVoidPtrArray_FnVoidVoidPtrInt, 'on_disconnect': FnVoid_VoidP_VoidP_FnVoidVoidPtrInt }); var GpioAnalogReadParameters = Struct({ 'pullup_pin': ref.types.uint8, 'pulldown_pin': ref.types.uint8, 'virtual_pin': ref.types.uint8, 'delay_us': ref.types.uint16 }); var BoschTap = Struct({ 'type': ref.types.uint8, 'sign': ref.types.uint8 }); var BtleAddress = Struct({ 'address_type': ref.types.uint8, 'address': ArrayUByte_6 }); var Tcs34725ColorAdc = Struct({ 'clear': ref.types.uint16, 'red': ref.types.uint16, 'green': ref.types.uint16, 'blue': ref.types.uint16 }); var DataSignal = ref.types.void; var BatteryState = Struct({ 'voltage': ref.types.uint16, 'charge': ref.types.uint8 }); var CorrectedCartesianFloat = Struct({ 'x': ref.types.float, 'y': ref.types.float, 'z': ref.types.float, 'accuracy': ref.types.uint8 }); var EulerAngles = Struct({ 'heading': ref.types.float, 'pitch': ref.types.float, 'roll': ref.types.float, 'yaw': ref.types.float }); var OverflowState = Struct({ 'length': ref.types.uint16, 'assert_en': ref.types.uint8 }); var CalibrationState = Struct({ 'accelrometer': ref.types.uint8, 'gyroscope': ref.types.uint8, 'magnetometer': ref.types.uint8 }); var DeviceInformation = Struct({ 'manufacturer': ref.types.CString, 'model_number': ref.types.CString, 'serial_number': ref.types.CString, 'firmware_revision': ref.types.CString, 'hardware_revision': ref.types.CString }); var LoggingTime = Struct({ 'epoch': ref.types.int64, 'reset_uid': ref.types.uint8 }); var FnVoid_VoidP_UInt_UInt = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.types.uint32, ref.types.uint32]); var FnVoid_VoidP_UByte_Long_UByteP_UByte = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.types.uint8, ref.types.int64, ref.refType(ref.types.uint8), ref.types.uint8]); var LogDownloadHandler = Struct({ 'context': ref.refType(ref.types.void), 'received_progress_update': FnVoid_VoidP_UInt_UInt, 'received_unknown_entry': FnVoid_VoidP_UByte_Long_UByteP_UByte, 'received_unhandled_entry': FnVoid_VoidP_DataP }); var FnVoid_VoidP_UByte_UByte_UInt_UInt = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.types.uint8, ref.types.uint8, ref.types.uint32, ref.types.uint32]); var FnVoid_VoidP_MetaWearBoardP_FnBoardPtr = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(MetaWearBoard), FnVoid_MetaWearBoardP]); var RawLogDownloadHandler = Struct({ 'context': ref.refType(ref.types.void), 'received_entry': FnVoid_VoidP_UByte_UByte_UInt_UInt, 'received_progress_update': FnVoid_VoidP_UInt_UInt, 'logging_page_completed': FnVoid_VoidP_MetaWearBoardP_FnBoardPtr }); var Quaternion = Struct({ 'w': ref.types.float, 'x': ref.types.float, 'y': ref.types.float, 'z': ref.types.float }); var CartesianFloat = Struct({ 'x': ref.types.float, 'y': ref.types.float, 'z': ref.types.float }); var ModuleInfo = Struct({ 'name': ref.types.CString, 'extra': ref.refType(ref.types.uint8), 'extra_len': ref.types.uint8, 'present': ref.types.uint8, 'implementation': ref.types.uint8, 'revision': ref.types.uint8 }); var FnVoid_VoidP = ffi.Function(ref.types.void, [ref.refType(ref.types.void)]); var FnVoid_VoidP_charP = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.types.CString]); var DfuDelegate = Struct({ 'context': ref.refType(ref.types.void), 'on_dfu_started': FnVoid_VoidP, 'on_dfu_cancelled': FnVoid_VoidP, 'on_transfer_percentage': FnVoid_VoidP_Int, 'on_successful_file_transferred': FnVoid_VoidP, 'on_error': FnVoid_VoidP_charP }); var LedPattern = Struct({ 'high_intensity': ref.types.uint8, 'low_intensity': ref.types.uint8, 'rise_time_ms': ref.types.uint16, 'high_time_ms': ref.types.uint16, 'fall_time_ms': ref.types.uint16, 'pulse_duration_ms': ref.types.uint16, 'delay_time_ms': ref.types.uint16, 'repeat_count': ref.types.uint8 }); var BoschAnyMotion = Struct({ 'sign': ref.types.uint8, 'x_axis_active': ref.types.uint8, 'y_axis_active': ref.types.uint8, 'z_axis_active': ref.types.uint8 }); var BoschGestureType = Struct({ 'type': ref.types.uint8, 'gesture_code': ref.types.uint8 }); var SpiParameters = Struct({ 'mode': SpiMode, 'frequency': SpiFrequency, 'data': ref.refType(ref.types.uint8), 'data_length': ref.types.uint8, 'slave_select_pin': ref.types.uint8, 'clock_pin': ref.types.uint8, 'mosi_pin': ref.types.uint8, 'miso_pin': ref.types.uint8, 'lsb_first': ref.types.uint8, 'use_nrf_pins': ref.types.uint8 }); var I2cReadParameters = Struct({ 'device_addr': ref.types.uint8, 'register_addr': ref.types.uint8 }); function Const() { } Const.SETTINGS_BATTERY_VOLTAGE_INDEX = 0; Const.STATUS_WARNING_UNEXPECTED_SENSOR_DATA = 1; Const.STATUS_WARNING_INVALID_PROCESSOR_TYPE = 2; Const.STATUS_ERROR_UNSUPPORTED_PROCESSOR = 4; Const.STATUS_OK = 0; Const.STATUS_ERROR_SERIALIZATION_FORMAT = 32; Const.STATUS_ERROR_ENABLE_NOTIFY = 64; Const.SETTINGS_BATTERY_CHARGE_INDEX = 1; Const.CD_TCS34725_ADC_GREEN_INDEX = 2; Const.GYRO_ROTATION_X_AXIS_INDEX = 0; Const.ADDRESS_TYPE_PUBLIC = 0; Const.ADDRESS_TYPE_RANDOM_STATIC = 1; Const.STATUS_WARNING_INVALID_RESPONSE = 8; Const.ADDRESS_TYPE_PRIVATE_RESOLVABLE = 2; Const.ADDRESS_TYPE_PRIVATE_NON_RESOLVABLE = 3; Const.ACC_ACCEL_Z_AXIS_INDEX = 2; Const.ACC_ACCEL_X_AXIS_INDEX = 0; Const.SETTINGS_POWER_STATUS_UNSUPPORTED = -1; Const.SENSOR_FUSION_CALIBRATION_ACCURACY_LOW = 1; Const.SENSOR_FUSION_CALIBRATION_ACCURACY_MEDIUM = 2; Const.MAG_BFIELD_X_AXIS_INDEX = 0; Const.ACC_ACCEL_Y_AXIS_INDEX = 1; Const.STATUS_ERROR_TIMEOUT = 16; Const.SETTINGS_CHARGE_STATUS_UNSUPPORTED = -1; Const.LED_REPEAT_INDEFINITELY = 255; Const.SENSOR_FUSION_CALIBRATION_ACCURACY_UNRELIABLE = 0; Const.SENSOR_FUSION_CALIBRATION_ACCURACY_HIGH = 3; Const.CD_TCS34725_ADC_CLEAR_INDEX = 0; Const.CD_TCS34725_ADC_RED_INDEX = 1; Const.CD_TCS34725_ADC_BLUE_INDEX = 3; Const.GPIO_UNUSED_PIN = 255; Const.MAG_BFIELD_Y_AXIS_INDEX = 1; Const.MAG_BFIELD_Z_AXIS_INDEX = 2; Const.GYRO_ROTATION_Y_AXIS_INDEX = 1; Const.GYRO_ROTATION_Z_AXIS_INDEX = 2; // TODO: This line exisits because the generator doesn't understand array of pointers var ArrayAnonymousDataSignalP = ArrayType(ref.refType(AnonymousDataSignal)); FnVoid_VoidP_MetaWearBoardP_AnonymousDataSignalP_UInt = ffi.Function(ref.types.void, [ref.refType(ref.types.void), ref.refType(MetaWearBoard), ArrayAnonymousDataSignalP, ref.types.uint32]); var ArrayDataSignalP = ArrayType(ref.refType(DataSignal)); var Lib = ffi.Library(LIBMETAWEAR_PATH, { /** * Restarts the board in bootloader mode. * @param board Calling object */ 'mbl_mw_debug_jump_to_bootloader': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Create a comparator processor where signed/unsigned is inferred. * Only allows data through that satisfies a comparison operation. * A pointer representing the processor will be passed back to the user via a callback function. * @param source Data signal providing the input for the processor * @param op Comparison operation to execute (=, !=, <, >) * @param reference Reference value to compare the input to * @param context Pointer to additional data for the callback function * @param processor_created Callback function to be executed when the processor is created */ 'mbl_mw_dataprocessor_comparator_create': [ref.types.int32, [ref.refType(DataSignal), ComparatorOperation, ref.types.float, ref.refType(ref.types.void), FnVoid_VoidP_DataProcessorP]], /** * Sets connection parameters. * @param board Board to modify * @param min_conn_interval Connection interval lower bound, min 7.5ms * @param max_conn_interval Connection interval upper bound, max 4000ms * @param latency Number of connection intervals to skip, betwen [0, 1000] * @param timeout Max time between data exchanges until the connection is considered to be lost, between [10, 32000]ms */ 'mbl_mw_settings_set_connection_parameters': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.float, ref.types.float, ref.types.uint16, ref.types.uint16]], /** * Retrieves the id value identifying the processor. * @param processor Processor to lookup * @return Numerical id of the processor */ 'mbl_mw_dataprocessor_get_id': [ref.types.uint8, [ref.refType(DataProcessor)]], /** * Creates a fake button event with the data value. * Requires that the switch signal be streaming or logging to add a spoofed event in the logger. * @param board Calling object * @param value Value to spoof, 1 byte */ 'mbl_mw_debug_spoof_button_event': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint8]], /** * Retrieves the firmware build id, used for identifying custom firmware build variants. * @param board Calling object */ 'mbl_mw_settings_get_firmware_build_id': [ref.types.uint8, [ref.refType(MetaWearBoard)]], /** * Sets the tilt angle for gesture recognition * Sine of the minimum tilt angle in portrait down direction of the device when wrist is rolled away (roll-out) from user. * The configuration parameter is scaled by 2048 i.e. 2048 * sin(angle). * Range is 1448 to 1774. Default value is 1774. * @param board Pointer to the board to send the command to * @param peak Tilt Angle */ 'mbl_mw_acc_bmi270_wrist_gesture_peak': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint16]], /** * Switches the accelerometer to active mode. * @param board Board the accelerometer is on */ 'mbl_mw_acc_start': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Get the device boot time for a given reset_uid. This reference time * is automatically calulated at connection time. * @param board Board to use * @param reset_uid Reset id * @return Number of milliseconds since epoch that the given reset_uid occured */ 'mbl_mw_logging_get_reference_time': [ref.types.int64, [ref.refType(MetaWearBoard), ref.types.uint8]], /** * Issues a soft reset. * @param board Calling object */ 'mbl_mw_debug_reset': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Sets the iBeacon advertising major number. * @param board Pointer to the board to send the command to * @param major DataSignal output to use as the new major number */ 'mbl_mw_ibeacon_set_major_signal': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(DataSignal)]], /** * Frees allocated memory * @param ptr Pointer to the memory to free */ 'mbl_mw_memory_free': [ref.types.void, [ref.refType(ref.types.void)]], /** * Downsampling for the BMI270 acc * See BMI270 datasheet for more details * @param board Pointer to the board to send the command to * @param gyro_downs Downsampling for Gyroscope (2**downs_gyro) * @param gyro_data Selects filtered or unfiltered Gyroscope data for fifo * @param acc_downs Downsampling for Accelerometer (2**downs_accel) * @param acc_data Selects filtered or unfiltered Accelerometer data for fifo */ 'mbl_mw_acc_bmi270_fifo_downs': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint8, ref.types.uint8, ref.types.uint8, ref.types.uint8]], /** * Sets the key register value. This is a simple 4 byte scratch register. * @param board Board to receive data from */ 'mbl_mw_debug_set_key_register': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint32]], /** * Sends a raw command directly to the MetaWear. Useful for testing. * @param board Calling object * @param value Value to send: [Module ID, Register ID, Optional Index, Data...] * @param lenght Size of the value array */ 'mbl_mw_debug_send_command': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.uint8), ref.types.uint8]], /** * Enables acceleration sampling. * The board will start gathering data from the accelerometer * @param board Calling object */ 'mbl_mw_acc_mma8452q_enable_acceleration_sampling': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Sets the * Sine of the maximum allowed downward tilt angle in landscape left direction of the device, when it is in focus position. * The configuration parameter is scaled by 2048 i.e. 2048 * sin(angle). Range is 700 to 1024. Default value is 700. * @param board Pointer to the board to send the command to * @param angle Maximum tilt angle in Landscape Left mode */ 'mbl_mw_acc_bmi270_wrist_wakeup_tilt_ll': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint16]], /** * Retrieves the data signal representing battery state. * @param board Calling object * @return Pointer to the battery state signal */ 'mbl_mw_settings_get_battery_state_data_signal': [ref.refType(DataSignal), [ref.refType(MetaWearBoard)]], /** * Retrieves supported characteristics from the Device Information service. * The memory allocated by the function must be freed by calling mbl_mw_memory_free. * @return Struct holding the characteristics */ 'mbl_mw_metawearboard_get_device_information': [ref.refType(DeviceInformation), [ref.refType(MetaWearBoard)]], /** * Writes the orientation detection settings to the board * Applies MODE and HYSTERESIS from set_orientation_hysteresis() and set_orientation_mode() * Not supported by the BMI270. * @param board Calling object */ 'mbl_mw_acc_bosch_write_orientation_config': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Enables/disables stack overflow assertion. Function will do nothing if feature is unsupported. * @param board Calling object * @param enable 0 to disable, non-zero value to enable */ 'mbl_mw_debug_set_stack_overflow_assertion': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint8]], /** * Creates an instance of the MblMwMetaWearBoard struct * @param connection Connection struct the new MblMwMetaWearBoard variable will use for btle communication * @return Pointer to the newly created struct */ 'mbl_mw_metawearboard_create': [ref.refType(MetaWearBoard), [ref.refType(BtleConnection)]], /** * Sets the advertisement name. * Can be used to rename the device. * @param board Board to modify * @param device_name Byte array containing the device name, max 8 ASCII characters * @param len Length of the array */ 'mbl_mw_settings_set_device_name': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.uint8), ref.types.uint8]], /** * Remaps the BMI270 axis * If the coordinate system of the MetaWear differs from the sensor coordinate system described in the BMI270 datasheet, * the sensor axis must be remapped to use the orientation dependent features properly. * Axis remapping register allows the host to freely map individual axis to the coordinate system of the used platform. * Individual axis can be mapped to any other defined axis. The sign value of the axis can be also configured. * @param board Pointer to the board to send the command to * @param map X,Y,Z axis remap * @param sign X,Y,Z axis flip/sign */ 'mbl_mw_acc_bmi270_axis_remap': [ref.types.void, [ref.refType(MetaWearBoard), AccBoschAxisXyzRemap, AccBoschAxisXyzSign]], /** * Retrieves the data signal representing the device GAP (MAC) address. * @param board Calling object * @return Pointer to the mac signal */ 'mbl_mw_settings_get_mac_data_signal': [ref.refType(DataSignal), [ref.refType(MetaWearBoard)]], /** * Reads the internal queues' current usage statistics; data is returned as a byte array. * If feature is unspported, nullptr will be passed to the `handler` parameter. * @param board Calling object * @param context Pointer to additional data for the callback function * @param handler Callback function for handling the received data */ 'mbl_mw_debug_read_schedule_queue_usage': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.void), FnVoid_VoidP_DataP]], /** * Manually configure the sensor, only for advanced users. * It is recommended that users use one of the preset configurations. * @param board Calling object * @param xy_reps Repetitions on the x/y-axis * @param z_reps Repetitions on the z-axis * @param odr Sensor data rate */ 'mbl_mw_mag_bmm150_configure': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint16, ref.types.uint16, MagBmm150Odr]], /** * Create a sample delay processor. * Holds data until a certain amount (bin_size) has been collected. * Can be used to delay the input into another processor. * A pointer representing the processor will be passed back to the user via a callback function. * @param source Data signal providing the input for the processor * @param bin_size Number of samples to hold before letting data through * @param context Pointer to additional data for the callback function * @param processor_created Callback function to be executed when the processor is created */ 'mbl_mw_dataprocessor_sample_create': [ref.types.int32, [ref.refType(DataSignal), ref.types.uint8, ref.refType(ref.types.void), FnVoid_VoidP_DataProcessorP]], /** * Sets the cutoff frequency for the high-pass filter. * The high-pass filter cutoff frequency can be set by the user to four different frequencies which are dependent on the output data rate (ODR) * Cutoff frequency is set to 16 Hz @ 800 Hz by default. See the MM8452Q datasheet for available options. * @param board Calling object * @param frequency Hpf cutoff frequency, set to 0 to disable the high pass filter */ 'mbl_mw_acc_mma8452q_set_high_pass_cutoff': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.float]], /** * Sets the output data rate for the BMI160 accelerometer * The ODR sets the output data frequency in Hz. * See MblMwAccBmi160Odr for allowed values. * @param board Pointer to the board to modify * @param odr Output data rate value to assign */ 'mbl_mw_acc_bmi270_set_odr': [ref.types.void, [ref.refType(MetaWearBoard), AccBmi270Odr]], /** * @deprecated In v0.14.0, use <code>mbl_mw_settings_set_ad_parameters</code> instead */ 'mbl_mw_settings_set_ad_interval': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint16, ref.types.uint8]], /** * Sets scan response. * @param board Board to modify * @param response Scan response as a byte array * @param len Length of the array */ 'mbl_mw_settings_set_scan_response': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.uint8), ref.types.uint8]], /** * Write the module configuration to the board. * Applies the MODE and RANGE values set in set_*(). Must be preceeded by set_*() calls. * @param board Calling object */ 'mbl_mw_sensor_fusion_write_config': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Retrieves the data signal representing B field strength in uT (micro Teslas) * This signal is timestamp,x,y,z mag data * @param board Calling object * @return Pointer to the data signal * MblMwCartesianFloat is return signal data type */ 'mbl_mw_mag_bmm150_get_b_field_data_signal': [ref.refType(DataSignal), [ref.refType(MetaWearBoard)]], /** * Subscribes to responses from the data logger. * @param logger Logger to subscribe to * @param context Pointer to additional data for the callback function * @param received_data Callback function to handle data received from the logger */ 'mbl_mw_logger_subscribe': [ref.types.void, [ref.refType(DataLogger), ref.refType(ref.types.void), FnVoid_VoidP_DataP]], /** * Rotates the pixels on a strand. * @param board Pointer to the board to send the command to * @param strand Strand to rotate * @param direction Rotation direction * @param count Number of times to repeat the rotation * @param period_ms Amount of time, in milliseconds, between rotations */ 'mbl_mw_neopixel_rotate': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint8, ref.types.uint8, ref.types.uint16, NeoPixelRotDirection]], /** * Sets the iBeacon advertising minor number. * @param board Pointer to the board to send the command to * @param minor DataSignal output to use as the new minor number */ 'mbl_mw_ibeacon_set_minor_signal': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(DataSignal)]], /** * Adds MAC Addresses for Whitelist filtering. * @param board Board to modify * @param index Whitelist MAC address in range [1, 8], must start at 1 and go in increasing order * @param address Address to add */ 'mbl_mw_settings_get_whitelist_data_signal': [ref.refType(DataSignal), [ref.refType(MetaWearBoard), ref.types.uint8]], /** * Pulls the current accelerometer output data rate and data range from the sensor. * Reads the ODR and RANGE values set in the sensor. * This is a debug function, the data is return in the context ptr as AccBmi160Config->acc/AccBmi270Config->acc/Mma8452qConfig->acc * @param board Calling object * @param context Pointer to additional data for the callback function * @param completed Callback function that is executed when the task is finished */ 'mbl_mw_acc_read_config': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.void), FnVoid_VoidP_MetaWearBoardP_Int]], /** * Retrieves the data signal representing the power status. * @param board Calling object * @return Pointer to the power status signal, nullptr if unsupported */ 'mbl_mw_settings_get_power_status_data_signal': [ref.refType(DataSignal), [ref.refType(MetaWearBoard)]], /** * Sets the iBeacon advertising receiving power. * @param board Pointer to the board to send the command to * @param rx_power New advertising receiving power */ 'mbl_mw_ibeacon_set_rx_power': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.int8]], /** * Retrieves the id value identifying the timer. * @param timer Timer to lookup * @return Numerical id of the timer */ 'mbl_mw_timer_get_id': [ref.types.uint8, [ref.refType(Timer)]], /** * Create a fuser processor which fuses signals or processors together. * Combine data from multiple data sources into 1 data packet. * Popular for combining gyro and acc data into 1 packet. * A pointer representing the processor will be passed back to the user via a callback function. * @param source Data signal providing the input for the processor * @param ops Array of data signals to combine into 1 message * @param n_ops Number of items in the array * @param context Pointer to additional data for the callback function * @param processor_created Callback function to be executed when the processor is created */ 'mbl_mw_dataprocessor_fuser_create': [ref.types.int32, [ref.refType(DataSignal), ArrayDataSignalP, ref.types.uint32, ref.refType(ref.types.void), FnVoid_VoidP_DataProcessorP]], /** * Retrieves an event pointer representing a disconnect event. * @param board Board the event is fired on * @return Pointer to the disconnect event */ 'mbl_mw_settings_get_disconnect_event': [ref.refType(Event), [ref.refType(MetaWearBoard)]], /** * Places the board in a powered down state after the next reset. When in power save mode, press the switch * or plug in the USB charger to wake the board up. * @param board Calling object */ 'mbl_mw_debug_enable_power_save': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Adds a system timer (timestamp) to the input signal. * Not typically used. * Adds additional information to the BTLE packet in the form of a counter * A pointer representing the processor will be passed back to the user via a callback function. * @param source Data signal providing the input for the processor * @param context Pointer to additional data for the callback function * @param processor_created Callback function to be executed when the processor is created */ 'mbl_mw_dataprocessor_accounter_create': [ref.types.int32, [ref.refType(DataSignal), ref.refType(ref.types.void), FnVoid_VoidP_DataProcessorP]], /** * Removes a data processor and its consumers from the board. * @param processor Processor to remove */ 'mbl_mw_dataprocessor_remove': [ref.types.void, [ref.refType(DataProcessor)]], /** * @deprecated As of v0.8.0 and will be removed in v1.0.0. Use mbl_mw_acc_mma8452q_get_packed_acceleration_data_signal instead. */ 'mbl_mw_acc_mma8452q_get_high_freq_acceleration_data_signal': [ref.refType(DataSignal), [ref.refType(MetaWearBoard)]], /** * Check if the data signal can be explicitly read. * @param signal Data signal to check * @return Zero if not readable, non-zero if it is */ 'mbl_mw_datasignal_is_readable': [ref.types.int32, [ref.refType(DataSignal)]], /** * Enables orientation detection. * The board will start gathering orientation data from the accelerometer * @param board Calling object */ 'mbl_mw_acc_mma8452q_enable_orientation_detection': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Drives a buzzer - Pulls down the HCD pin. * The MetaWear has a driver for motor or buzzers that are 3C compatible (check the datasheet) * @param board Pointer to the board to send the command to * @param pulse_width_ms How long to run the buzzer, in milliseconds */ 'mbl_mw_haptic_start_buzzer': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint16]], /** * Starts data logging. * @param board Board to log data on * @param overwrite Non-zero if older entries will be overwritten */ 'mbl_mw_logging_start': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint8]], /** * Sets the rotation range * The range is in units of degrees per second (dps) for Bosch sensors * See MblMwGyroBoschRange for allowed values. * @param board Pointer to the board to modify * @param range New rotation range */ 'mbl_mw_gyro_bmi160_set_range': [ref.types.void, [ref.refType(MetaWearBoard), GyroBoschRange]], /** * Modifies the magnitude that allows data through. * @param delta Delta processor to modify * @param magnitude Min distance from the reference value to allow the input to pass * @return MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if * a non-delta processor was passed in */ 'mbl_mw_dataprocessor_delta_modify_magnitude': [ref.types.int32, [ref.refType(DataProcessor), ref.types.float]], /** * Instructs the board to terminate the connection. * @param board Calling object */ 'mbl_mw_debug_disconnect': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Switches the accelerometer to active mode. * When in active mode, the accelerometer cannot be configured * @param board Calling object */ 'mbl_mw_acc_mma8452q_start': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Reads the current power status if available. The callback function will be called with: * 1 - power source is attached * 0 - no power source atached * -1 - feature not supported * @param board Calling object * @param context Pointer to additional data for the callback function * @param handler Callback function that is executed when the task is finished */ 'mbl_mw_settings_read_current_power_status': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.void), FnVoid_VoidP_MetaWearBoardP_Int]], /** * Sets the conductance measurement mode * @param board Pointer to the board to modify * @param range Range of the conductance values */ 'mbl_mw_conductance_set_range': [ref.types.void, [ref.refType(MetaWearBoard), ConductanceRange]], /** * Determines the board model of the currently connected device. * Only call this function after the board has been initialized. * @return Friendly name representing the board model */ 'mbl_mw_metawearboard_get_model_name': [ref.types.CString, [ref.refType(MetaWearBoard)]], /** * Disables rotation sampling * The board will stop gathering data from the gyroscope * @param board Pointer to the board to send the command to */ 'mbl_mw_gyro_bmi270_disable_rotation_sampling': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Reads the current charge status. The callback function will be called with: * 1 - battery is charging * 0 - battery is not charging * -1 - feature not supported */ 'mbl_mw_settings_read_current_charge_status': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.void), FnVoid_VoidP_MetaWearBoardP_Int]], /** * Disables the BMI160 step detector * @param board Pointer to the board to send the command to */ 'mbl_mw_acc_bmi160_disable_step_detector': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Stops data logging. * @param board Board to stop logging */ 'mbl_mw_logging_stop': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Turns on the 3V regulator. * Needed if IOs / peripherals need 3V power from the MetaSensor * For MMS only, will be ignored for all others * @param board Board to modify * @param index 0: Disable, 1: Enable */ 'mbl_mw_settings_enable_3V_regulator': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.uint8]], /** * Modify the configuration of a pulse detector. * @param pulse Pulse detector to modify * @param threshold New threshold of the detector * @param width New width of the detector * @return MBL_MW_STATUS_OK if processor configuration was updated, MBL_MW_STATUS_WARNING_INVALID_PROCESSOR_TYPE if * a non pulse detector was passed in */ 'mbl_mw_dataprocessor_pulse_modify': [ref.types.int32, [ref.refType(DataProcessor), ref.types.float, ref.types.uint16]], /** * Switches the accelerometer to active mode * When in active mode, the accelerometer cannot be configured. * @param board Pointer to the board to send the command to */ 'mbl_mw_acc_bosch_start': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Ends command recording. * This function is non-blocking and will asynchronously alert the caller when the operation is completed. * @param event Event to end recording for * @param context Pointer to additional data for the callback function * @param commands_recorded Callback function to be executed when commands have been recorded */ 'mbl_mw_event_end_record': [ref.types.void, [ref.refType(Event), ref.refType(ref.types.void), FnVoid_VoidP_EventP_Int]], /** * Remove all recorded events from the board. * @param board Calling object */ 'mbl_mw_event_remove_all': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Ends macro recording. * An numerical id representing the macro will be passed to the callback function when the operation is complete. * @param board Calling object * @param context Pointer to additional data for the callback function * @param commands_recorded Callback function to be executed when the commands are recorded */ 'mbl_mw_macro_end_record': [ref.types.void, [ref.refType(MetaWearBoard), ref.refType(ref.types.void), FnVoid_VoidP_MetaWearBoardP_Int]], /** * Sets advertising transmitting power. If a non valid value is set, the nearest valid value will be used instead. * @param board Board to set the TX power * @param tx_power Valid values are: 4, 0, -4, -8, -12, -16, -20, -30 */ 'mbl_mw_settings_set_tx_power': [ref.types.void, [ref.refType(MetaWearBoard), ref.types.int8]], /** * Create an rms processor. * Computes the root mean square of the input. * Works on inputs such as acc, gyro, and magnetometer data (x,y,z) * A pointer representing the processor will be passed back to the user via a callback function. * @param source Data signal providing the input for the processor * @param context Pointer to additional data for the callback function * @param processor_created Callback function to be executed when the processor is created */ 'mbl_mw_dataprocessor_rms_create': [ref.types.int32, [ref.refType(DataSignal), ref.refType(ref.types.void), FnVoid_VoidP_DataProcessorP]], /** * Retrieves the data signal representing ADC values for the proximity of an object to the MetaWear. * @param board Board the sensor resides on * @return Pointer to the data signal * UINT32 is return signal data type */ 'mbl_mw_proximity_tsl2671_get_adc_data_signal': [ref.refType(DataSignal), [ref.refType(MetaWearBoard)]], /** * Sets the sensor integration time. * Measurement time for each full light measurement (ALS) cycle - 100ms (default) to 350 ms * See MblMwAlsLtr329IntegrationTime for allowed values * @param board Pointer to the board to modify * @param integration_time Integration time value to set */ 'mbl_mw_als_ltr329_set_integration_time': [ref.types.void, [ref.refType(MetaWearBoard), AlsLtr329IntegrationTime]], /** * Flushes logging data (pending writes) to the MMS memory. * Should be called for the MMS when done with logging and ready to download data * For MMS only. * @param board Board to stop logging */ 'mbl_mw_logging_flush_page': [ref.types.void, [ref.refType(MetaWearBoard)]], /** * Create a passthrough processor. * On a pass-count, only the count # of samples will go through and then the processor will shut off. * On a pass-conditional, if the count=0, all data is blocked. if the count>0, all data is passed. * Gate that only allows data though based on a user configured internal state. * A pointer representing the processor will be passed back to the user via a callback function. * @param source Data signal providing the input for the processor * @param mode Processor's operation mode * @param count Internal count to initial the processor with * @param context Pointer to additional data for the callback function * @param processor_created Callback function to be executed when the processor is created */ 'mbl_mw_dataprocessor_passthrough_create': [ref.types.int32, [ref.refType(DataSignal), PassthroughMode, ref.t