Hardware components | ||||||
| × | 1 | ||||
Software apps and online services | ||||||
|
Bonsais are great, and incredibly hard to keep alive in good conditions. Light and temperature levels have to be monitored with precision all day long, and one rarely has time to do so.
The RSL-10 compact design and amazing BLE module is the solution. Just hang it on one of the branches (you won't even see the board, it'll be as discreet as it can be) and, with the power of the atmosphere IoT platform, the needed data collected throughout a day, you'll know if the spot is good for the planet, by measuring the lux level and the temperature level and registering them in an interactive graph that can be accessed on the IoT online platform or directly through the app.
To use it, just set up the needed Atmosphere environment (it is perfectly explained in the site) and import the .atmos file right here:
https://drive.google.com/open?id=1awbuYL3GsKSFEO8zzUWZsX_0xaZ6Yj6m
And that's it, you are ready to go!
You'll notice that it easily adaptable for any other project, so feel free to do so.
I'll still be working in this project to implement it in a meta-project having an Arduino watering system and a central Raspberry pi which will be managing all of the meta-project modules. MYO armband might come into play once I figure out how to connect the RSL-10 to the raspberry pi without any issue (which is way harder than I thought, having little experience with python). The BLE in the RSL-10 will be serving it's full purpose once I come around this issue: it'll be sending data to the raspberry pi and then, the pi can notify through a telegram bot if the plants have to be moved to a better light spot.
{
"name": "Bonsai Monitor",
"createVersion": "2017-08-12",
"description": "Monitors Lux level and temperature level with a RSL10 board ",
"lastModified": "2019-07-19T15:34:44.992Z",
"created": "2019-07-19T15:34:44.992Z",
"meta": {
"projectTypeName": "RSL10-SENSE-GEVK",
"projectTypeId": "RSL10-SENSE-GEVK"
},
"planes": {
"RSL10-SENSE-GEVK": {
"type": "OnSemi",
"compilerVersion": "latest",
"variants": [
"RSL10",
"RSL10-SENSE-GEVK"
],
"meta": {},
"elements": [
{
"name": "Interval",
"type": "EmbeddedInterval",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_INTERVAL_Handle_t intervalHandle;\n ATMO_INTERVAL_AddAbilityInterval(\n\t\tATMO_PROPERTY(Interval, instance), \n\t\tATMO_ABILITY(Interval, interval), \n\t\tATMO_PROPERTY(Interval, time), \n\t\t&intervalHandle\n\t);\n\t\n\treturn ATMO_Status_Success;\n\t",
"interval": "\treturn ATMO_Status_Success;"
},
"variables": {},
"embeddedPropertyConversions": {},
"codeUserChanged": {
"setup": false,
"interval": false
},
"instance": "ATMO_DRIVERINSTANCE_INTERVAL_INTERVAL1",
"time": "600"
},
"meta": {
"editorX": 353,
"editorY": 219,
"lastTrigger": "interval"
},
"triggers": {
"triggered": [],
"interval": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "BME680",
"targetAbility": "readTemperature"
},
{
"mapping": {},
"targetOrder": [],
"targetElement": "NOA1305AmbientLight",
"targetAbility": "readAmbientLight"
}
]
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"interval": true
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "interval",
"triggers": [
"interval"
]
}
]
},
{
"name": "NOA1305AmbientLight",
"type": "EmbeddedNOA1305",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": " if(!NOA1305_Init(ATMO_PROPERTY(NOA1305AmbientLight, i2cInstance)))\n {\n return ATMO_Status_Fail;\n }\n\n return ATMO_Status_Success;",
"readAmbientLight": " uint32_t ambientLightLux = 0;\n if(!NOA1305_GetAmbientLight(&ambientLightLux))\n {\n return ATMO_Status_Fail;\n }\n ATMO_CreateValueUnsignedInt(out, ambientLightLux);\n return ATMO_Status_Success;"
},
"variables": {},
"embeddedPropertyConversions": {},
"codeUserChanged": {
"setup": false,
"readAmbientLight": false
},
"i2cInstance": "ATMO_DRIVERINSTANCE_I2C_I2C1"
},
"meta": {
"editorX": 505,
"editorY": 295,
"lastTrigger": "ambientLightRead"
},
"triggers": {
"triggered": [],
"ambientLightRead": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "Light",
"targetAbility": "setValue"
}
]
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"readAmbientLight": false
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "readAmbientLight",
"triggers": [
"ambientLightRead"
]
}
]
},
{
"name": "BME680",
"type": "EmbeddedBME680",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "BME680_Config_t config;\nconfig.i2cInstance = ATMO_PROPERTY(BME680, i2cInstance );\n\nif ( !BME680_Init( &config ) )\n{\n\treturn ATMO_Status_Fail;\n}\n\nreturn ATMO_Status_Success;",
"readTemperature": "float temperature = 0.0;\n\nif ( BME680_GetTempData( &temperature ) != BME680_Status_Success )\n{\n\treturn ATMO_Status_Fail;\n}\n\nATMO_CreateValueFloat( out, temperature );\n\nreturn ATMO_Status_Success;",
"readHumidity": "float humidity = 0.0;\n\nif ( BME680_GetHumidity( &humidity ) != BME680_Status_Success )\n{\n\treturn ATMO_Status_Fail;\n}\n\nATMO_CreateValueFloat( out, humidity );\n\nreturn ATMO_Status_Success;",
"readPressure": "float pressure = 0.0;\n\nif ( BME680_GetPressure( &pressure ) != BME680_Status_Success )\n{\n\treturn ATMO_Status_Fail;\n}\n\nATMO_CreateValueFloat( out, pressure );\n\nreturn ATMO_Status_Success;"
},
"variables": {},
"embeddedPropertyConversions": {},
"codeUserChanged": {
"setup": false,
"readTemperature": false,
"readHumidity": false,
"readPressure": false
},
"i2cInstance": "ATMO_DRIVERINSTANCE_I2C_I2C1",
"i2cAddress": "0x77"
},
"meta": {
"editorX": 510,
"editorY": 171,
"lastTrigger": "temperatureRead"
},
"triggers": {
"triggered": [],
"temperatureRead": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "Temperature",
"targetAbility": "setValue"
}
],
"humidityRead": [],
"pressureRead": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"readTemperature": false,
"readHumidity": false,
"readPressure": false
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "readTemperature",
"triggers": [
"temperatureRead"
]
},
{
"name": "readHumidity",
"triggers": [
"humidityRead"
]
},
{
"name": "readPressure",
"triggers": [
"pressureRead"
]
}
]
},
{
"name": "Temperature",
"type": "EmbeddedBLECharacteristicCustom",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"ble"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\t&ATMO_VARIABLE(Temperature, bleServiceHandle), \n\t\tATMO_PROPERTY(Temperature, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(Temperature, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(Temperature, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(Temperature, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(Temperature, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(Temperature, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(Temperature, writeDataType), ATMO_PROPERTY(Temperature, readDataType), ATMO_PROPERTY(Temperature, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\t&ATMO_VARIABLE(Temperature, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(Temperature, bleServiceHandle), \n\t\tATMO_PROPERTY(Temperature, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\tATMO_VARIABLE(Temperature, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(Temperature, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(Temperature, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\tATMO_VARIABLE(Temperature, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(Temperature, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
"instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
"bleServiceUuid": "c1b5d405-7209-4ca4-ad71-ed2c24170fd3",
"bleCharacteristicUuid": "c1b5d405-7209-4ca4-ad71-ed2c24170fd4",
"read": true,
"write": true,
"notify": false,
"readDataType": "ATMO_DATATYPE_STRING",
"writeDataType": "ATMO_DATATYPE_STRING",
"notifyDataType": "ATMO_DATATYPE_STRING"
},
"meta": {
"editorX": 722,
"editorY": 168,
"lastTrigger": "written"
},
"triggers": {
"triggered": [],
"written": [],
"subscibed": [],
"unsubscribed": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"setValue": "valueSet",
"written": false,
"subscibed": false,
"unsubscribed": false
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "setValue",
"triggers": []
},
{
"name": "written",
"triggers": [
"written"
]
},
{
"name": "subscibed",
"triggers": [
"subscibed"
]
},
{
"name": "unsubscribed",
"triggers": [
"unsubscribed"
]
}
]
},
{
"name": "Light",
"type": "EmbeddedBLECharacteristicCustom",
"variants": [
"embedded",
"triggers",
"abilities",
"properties",
"variables",
"ble"
],
"properties": {
"errorData": {},
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(Light, instance),\n\t\t&ATMO_VARIABLE(Light, bleServiceHandle), \n\t\tATMO_PROPERTY(Light, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(Light, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(Light, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(Light, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(Light, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(Light, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(Light, writeDataType), ATMO_PROPERTY(Light, readDataType), ATMO_PROPERTY(Light, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(Light, instance),\n\t\t&ATMO_VARIABLE(Light, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(Light, bleServiceHandle), \n\t\tATMO_PROPERTY(Light, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(Light, instance),\n\t\tATMO_VARIABLE(Light, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(Light, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(Light, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(Light, instance),\n\t\tATMO_VARIABLE(Light, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(Light, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
"instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
"bleServiceUuid": "c1b5d405-7209-4ca4-ad71-ed2c24170fd3",
"bleCharacteristicUuid": "c1b5d405-7209-4ca4-ad71-ed2c24170fd5",
"read": true,
"write": true,
"notify": false,
"readDataType": "ATMO_DATATYPE_STRING",
"writeDataType": "ATMO_DATATYPE_STRING",
"notifyDataType": "ATMO_DATATYPE_STRING"
},
"meta": {
"editorX": 710,
"editorY": 296,
"lastTrigger": "written"
},
"triggers": {
"triggered": [],
"written": [],
"subscibed": [],
"unsubscribed": []
},
"interruptAbilities": {
"trigger": false,
"setup": false,
"setValue": "valueSet",
"written": false,
"subscibed": false,
"unsubscribed": false
},
"abilities": [
{
"name": "trigger",
"triggers": [
"triggered"
]
},
{
"name": "setup",
"triggers": []
},
{
"name": "setValue",
"triggers": []
},
{
"name": "written",
"triggers": [
"written"
]
},
{
"name": "subscibed",
"triggers": [
"subscibed"
]
},
{
"name": "unsubscribed",
"triggers": [
"unsubscribed"
]
}
]
}
],
"libraries": {
"bme680": {
"libName": "bme680",
"manufacturer": "Bosch",
"description": "BME680 is a low power gas, pressure, temperature and humidity sensor",
"type": "Environmental sensor",
"icon": "EmbeddedTempHumidity.svg",
"version": "",
"eelVersion": "3",
"shoppingCartLinks": {
"digikey": {
"links": {
"info": " https://www.digikey.com/products/en?keywords=rsl10-sense-gevk"
},
"cartData": {
"part": "",
"source": "dkstudio",
"qty": "1"
}
}
},
"requires": [
"embedded",
"i2c"
],
"elements": [
{
"name": "BME680",
"type": "EmbeddedBME680",
"icon": "EmbeddedTempHumidity.svg",
"defaultAbility": "readTemperature",
"defaultTrigger": "temperatureRead",
"hidden": false,
"abilities": [
{
"name": "setup",
"hidden": true,
"code": "BME680_Config_t config;\nconfig.i2cInstance = ATMO_PROPERTY( undefined, i2cInstance );\n\nif ( !BME680_Init( &config ) )\n{\n\treturn ATMO_Status_Fail;\n}\n\nreturn ATMO_Status_Success;"
},
{
"name": "readTemperature",
"triggers": [
"temperatureRead"
],
"code": "float temperature = 0.0;\n\nif ( BME680_GetTempData( &temperature ) != BME680_Status_Success )\n{\n\treturn ATMO_Status_Fail;\n}\n\nATMO_CreateValueFloat( out, temperature );\n\nreturn ATMO_Status_Success;"
},
{
"name": "readHumidity",
"triggers": [
"humidityRead"
],
"code": "float humidity = 0.0;\n\nif ( BME680_GetHumidity( &humidity ) != BME680_Status_Success )\n{\n\treturn ATMO_Status_Fail;\n}\n\nATMO_CreateValueFloat( out, humidity );\n\nreturn ATMO_Status_Success;"
},
{
"name": "readPressure",
"triggers": [
"pressureRead"
],
"code": "float pressure = 0.0;\n\nif ( BME680_GetPressure( &pressure ) != BME680_Status_Success )\n{\n\treturn ATMO_Status_Fail;\n}\n\nATMO_CreateValueFloat( out, pressure );\n\nreturn ATMO_Status_Success;"
}
],
"properties": [
{
"name": "i2cInstance",
"input": "driverInstance",
"driverType": "i2c"
},
{
"name": "i2cAddress",
"input": "select",
"inputOptions": [
"0x76",
"0x77"
],
"value": "0x77"
}
],
"triggers": [],
"variables": [],
"language": {
"en-US": {
"EmbeddedBME680": "BME680 Environmental",
"i2cInstance": "I2C Driver Instance",
"i2cAddress": "I2C Address",
"setup": "Setup",
"readTemperature": "Read Temperature (C)",
"temperatureRead": "Temperature Read",
"readHumidity": "Read Humidity (%rh)",
"humidityRead": "Humidity Read",
"readPressure": "Read Pressure (Pa)",
"pressureRead": "Pressure Read"
}
}
}
],
"files": {
"common": {
"headers": {
"bme680.h": "#ifndef ATMO_BME680_H_\n#define ATMO_BME680_H_\n\n#include \"../app_src/atmosphere_platform.h\"\n\ntypedef struct\n{\n\tATMO_DriverInstanceHandle_t i2cInstance;\n} BME680_Config_t;\n\ntypedef enum\n{\n\tBME680_Status_Success = 0,\n\tBME680_Status_Fail\n} BME680_Status_t;\n\nBME680_Status_t BME680_Init( BME680_Config_t *config );\n\nBME680_Status_t BME680_GetPressure( float *pressureHpa );\n\nBME680_Status_t BME680_GetTempData( float *tempC );\n\nBME680_Status_t BME680_GetHumidity( float *humidity );\n\n#endif\n",
"bme680_defs.h": "/**\n * Copyright (C) 2017 - 2018 Bosch Sensortec GmbH\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n *\n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n * @file\tbme680_defs.h\n * @date\t22 Feb 2018\n * @version\t3.5.8\n * @brief\n *\n */\n\n/*! @file bme680_defs.h\n @brief Sensor driver for BME680 sensor */\n/*!\n * @defgroup BME680_DRIVER_GRP BME680 SENSOR API\n * @brief\n * @{*/\n#ifndef BME680_DEFS_H_\n#define BME680_DEFS_H_\n\n/********************************************************/\n/* header includes */\n#ifdef __KERNEL__\n#include <linux/types.h>\n#include <linux/kernel.h>\n#else\n#include <stdint.h>\n#include <stddef.h>\n#endif\n\n/******************************************************************************/\n/*! @name\t\tCommon macros\t\t\t\t\t */\n/******************************************************************************/\n\n#if !defined(UINT8_C) && !defined(INT8_C)\n#define INT8_C(x) S8_C(x)\n#define UINT8_C(x) U8_C(x)\n#endif\n\n#if !defined(UINT16_C) && !defined(INT16_C)\n#define INT16_C(x) S16_C(x)\n#define UINT16_C(x) U16_C(x)\n#endif\n\n#if !defined(INT32_C) && !defined(UINT32_C)\n#define INT32_C(x) S32_C(x)\n#define UINT32_C(x) U32_C(x)\n#endif\n\n#if !defined(INT64_C) && !defined(UINT64_C)\n#define INT64_C(x) S64_C(x)\n#define UINT64_C(x) U64_C(x)\n#endif\n\n/**@}*/\n\n/**\\name C standard macros */\n#ifndef NULL\n#ifdef __cplusplus\n#define NULL 0\n#else\n#define NULL ((void *) 0)\n#endif\n#endif\n\n/** BME680 configuration macros */\n/** Enable or un-comment the macro to provide floating point data output */\n#ifndef BME680_FLOAT_POINT_COMPENSATION\n/* #define BME680_FLOAT_POINT_COMPENSATION */\n#endif\n\n/** BME680 General config */\n#define BME680_POLL_PERIOD_MS\t\tUINT8_C(10)\n\n/** BME680 I2C addresses */\n#define BME680_I2C_ADDR_PRIMARY\t\tUINT8_C(0x76)\n#define BME680_I2C_ADDR_SECONDARY\tUINT8_C(0x77)\n\n/** BME680 unique chip identifier */\n#define BME680_CHIP_ID UINT8_C(0x61)\n\n/** BME680 coefficients related defines */\n#define BME680_COEFF_SIZE\t\tUINT8_C(41)\n#define BME680_COEFF_ADDR1_LEN\t\tUINT8_C(25)\n#define BME680_COEFF_ADDR2_LEN\t\tUINT8_C(16)\n\n/** BME680 field_x related defines */\n#define BME680_FIELD_LENGTH\t\tUINT8_C(15)\n#define BME680_FIELD_ADDR_OFFSET\tUINT8_C(17)\n\n/** Soft reset command */\n#define BME680_SOFT_RESET_CMD UINT8_C(0xb6)\n\n/** Error code definitions */\n#define BME680_OK\t\tINT8_C(0)\n/* Errors */\n#define BME680_E_NULL_PTR\t\t INT8_C(-1)\n#define BME680_E_COM_FAIL\t\t INT8_C(-2)\n#define BME680_E_DEV_NOT_FOUND\t\tINT8_C(-3)\n#define BME680_E_INVALID_LENGTH\t\tINT8_C(-4)\n\n/* Warnings */\n#define BME680_W_DEFINE_PWR_MODE\tINT8_C(1)\n#define BME680_W_NO_NEW_DATA INT8_C(2)\n\n/* Info's */\n#define BME680_I_MIN_CORRECTION\t\tUINT8_C(1)\n#define BME680_I_MAX_CORRECTION\t\tUINT8_C(2)\n\n/** Register map */\n/** Other coefficient's address */\n#define BME680_ADDR_RES_HEAT_VAL_ADDR\tUINT8_C(0x00)\n#define BME680_ADDR_RES_HEAT_RANGE_ADDR\tUINT8_C(0x02)\n#define BME680_ADDR_RANGE_SW_ERR_ADDR\tUINT8_C(0x04)\n#define BME680_ADDR_SENS_CONF_START\tUINT8_C(0x5A)\n#define BME680_ADDR_GAS_CONF_START\tUINT8_C(0x64)\n\n/** Field settings */\n#define BME680_FIELD0_ADDR\t\tUINT8_C(0x1d)\n\n/** Heater settings */\n#define BME680_RES_HEAT0_ADDR\t\tUINT8_C(0x5a)\n#define BME680_GAS_WAIT0_ADDR\t\tUINT8_C(0x64)\n\n/** Sensor configuration registers */\n#define BME680_CONF_HEAT_CTRL_ADDR\t\tUINT8_C(0x70)\n#define BME680_CONF_ODR_RUN_GAS_NBC_ADDR\tUINT8_C(0x71)\n#define BME680_CONF_OS_H_ADDR\t\t\tUINT8_C(0x72)\n#define BME680_MEM_PAGE_ADDR\t\t\tUINT8_C(0xf3)\n#define BME680_CONF_T_P_MODE_ADDR\t\tUINT8_C(0x74)\n#define BME680_CONF_ODR_FILT_ADDR\t\tUINT8_C(0x75)\n\n/** Coefficient's address */\n#define BME680_COEFF_ADDR1\tUINT8_C(0x89)\n#define BME680_COEFF_ADDR2\tUINT8_C(0xe1)\n\n/** Chip identifier */\n#define BME680_CHIP_ID_ADDR\tUINT8_C(0xd0)\n\n/** Soft reset register */\n#define BME680_SOFT_RESET_ADDR\t\tUINT8_C(0xe0)\n\n/** Heater control settings */\n#define BME680_ENABLE_HEATER\t\tUINT8_C(0x00)\n#define BME680_DISABLE_HEATER\t\tUINT8_C(0x08)\n\n/** Gas measurement settings */\n#define BME680_DISABLE_GAS_MEAS\t\tUINT8_C(0x00)\n#define BME680_ENABLE_GAS_MEAS\t\tUINT8_C(0x01)\n\n/** Over-sampling settings */\n#define BME680_OS_NONE\t\tUINT8_C(0)\n#define BME680_OS_1X\t\tUINT8_C(1)\n#define BME680_OS_2X\t\tUINT8_C(2)\n#define BME680_OS_4X\t\tUINT8_C(3)\n#define BME680_OS_8X\t\tUINT8_C(4)\n#define BME680_OS_16X\t\tUINT8_C(5)\n\n/** IIR filter settings */\n#define BME680_FILTER_SIZE_0\tUINT8_C(0)\n#define BME680_FILTER_SIZE_1\tUINT8_C(1)\n#define BME680_FILTER_SIZE_3\tUINT8_C(2)\n#define BME680_FILTER_SIZE_7\tUINT8_C(3)\n#define BME680_FILTER_SIZE_15\tUINT8_C(4)\n#define BME680_FILTER_SIZE_31\tUINT8_C(5)\n#define BME680_FILTER_SIZE_63\tUINT8_C(6)\n#define BME680_FILTER_SIZE_127\tUINT8_C(7)\n\n/** Power mode settings */\n#define BME680_SLEEP_MODE\tUINT8_C(0)\n#define BME680_FORCED_MODE\tUINT8_C(1)\n\n/** Delay related macro declaration */\n#define BME680_RESET_PERIOD\tUINT32_C(10)\n\n/** SPI memory page settings */\n#define BME680_MEM_PAGE0\tUINT8_C(0x10)\n#define BME680_MEM_PAGE1\tUINT8_C(0x00)\n\n/** Ambient humidity shift value for compensation */\n#define BME680_HUM_REG_SHIFT_VAL\tUINT8_C(4)\n\n/** Run gas enable and disable settings */\n#define BME680_RUN_GAS_DISABLE\tUINT8_C(0)\n#define BME680_RUN_GAS_ENABLE\tUINT8_C(1)\n\n/** Buffer length macro declaration */\n#define BME680_TMP_BUFFER_LENGTH\tUINT8_C(40)\n#define BME680_REG_BUFFER_LENGTH\tUINT8_C(6)\n#define BME680_FIELD_DATA_LENGTH\tUINT8_C(3)\n#define BME680_GAS_REG_BUF_LENGTH\tUINT8_C(20)\n\n/** Settings selector */\n#define BME680_OST_SEL\t\t\tUINT16_C(1)\n#define BME680_OSP_SEL\t\t\tUINT16_C(2)\n#define BME680_OSH_SEL\t\t\tUINT16_C(4)\n#define BME680_GAS_MEAS_SEL\t\tUINT16_C(8)\n#define BME680_FILTER_SEL\t\tUINT16_C(16)\n#define BME680_HCNTRL_SEL\t\tUINT16_C(32)\n#define BME680_RUN_GAS_SEL\t\tUINT16_C(64)\n#define BME680_NBCONV_SEL\t\tUINT16_C(128)\n#define BME680_GAS_SENSOR_SEL\t\t(BME680_GAS_MEAS_SEL | BME680_RUN_GAS_SEL | BME680_NBCONV_SEL)\n\n/** Number of conversion settings*/\n#define BME680_NBCONV_MIN\t\tUINT8_C(0)\n#define BME680_NBCONV_MAX\t\tUINT8_C(10)\n\n/** Mask definitions */\n#define BME680_GAS_MEAS_MSK\tUINT8_C(0x30)\n#define BME680_NBCONV_MSK\tUINT8_C(0X0F)\n#define BME680_FILTER_MSK\tUINT8_C(0X1C)\n#define BME680_OST_MSK\t\tUINT8_C(0XE0)\n#define BME680_OSP_MSK\t\tUINT8_C(0X1C)\n#define BME680_OSH_MSK\t\tUINT8_C(0X07)\n#define BME680_HCTRL_MSK\tUINT8_C(0x08)\n#define BME680_RUN_GAS_MSK\tUINT8_C(0x10)\n#define BME680_MODE_MSK\t\tUINT8_C(0x03)\n#define BME680_RHRANGE_MSK\tUINT8_C(0x30)\n#define BME680_RSERROR_MSK\tUINT8_C(0xf0)\n#define BME680_NEW_DATA_MSK\tUINT8_C(0x80)\n#define BME680_GAS_INDEX_MSK\tUINT8_C(0x0f)\n#define BME680_GAS_RANGE_MSK\tUINT8_C(0x0f)\n#define BME680_GASM_VALID_MSK\tUINT8_C(0x20)\n#define BME680_HEAT_STAB_MSK\tUINT8_C(0x10)\n#define BME680_MEM_PAGE_MSK\tUINT8_C(0x10)\n#define BME680_SPI_RD_MSK\tUINT8_C(0x80)\n#define BME680_SPI_WR_MSK\tUINT8_C(0x7f)\n#define\tBME680_BIT_H1_DATA_MSK\tUINT8_C(0x0F)\n\n/** Bit position definitions for sensor settings */\n#define BME680_GAS_MEAS_POS\tUINT8_C(4)\n#define BME680_FILTER_POS\tUINT8_C(2)\n#define BME680_OST_POS\t\tUINT8_C(5)\n#define BME680_OSP_POS\t\tUINT8_C(2)\n#define BME680_RUN_GAS_POS\tUINT8_C(4)\n\n/** Array Index to Field data mapping for Calibration Data*/\n#define BME680_T2_LSB_REG\t(1)\n#define BME680_T2_MSB_REG\t(2)\n#define BME680_T3_REG\t\t(3)\n#define BME680_P1_LSB_REG\t(5)\n#define BME680_P1_MSB_REG\t(6)\n#define BME680_P2_LSB_REG\t(7)\n#define BME680_P2_MSB_REG\t(8)\n#define BME680_P3_REG\t\t(9)\n#define BME680_P4_LSB_REG\t(11)\n#define BME680_P4_MSB_REG\t(12)\n#define BME680_P5_LSB_REG\t(13)\n#define BME680_P5_MSB_REG\t(14)\n#define BME680_P7_REG\t\t(15)\n#define BME680_P6_REG\t\t(16)\n#define BME680_P8_LSB_REG\t(19)\n#define BME680_P8_MSB_REG\t(20)\n#define BME680_P9_LSB_REG\t(21)\n#define BME680_P9_MSB_REG\t(22)\n#define BME680_P10_REG\t\t(23)\n#define BME680_H2_MSB_REG\t(25)\n#define BME680_H2_LSB_REG\t(26)\n#define BME680_H1_LSB_REG\t(26)\n#define BME680_H1_MSB_REG\t(27)\n#define BME680_H3_REG\t\t(28)\n#define BME680_H4_REG\t\t(29)\n#define BME680_H5_REG\t\t(30)\n#define BME680_H6_REG\t\t(31)\n#define BME680_H7_REG\t\t(32)\n#define BME680_T1_LSB_REG\t(33)\n#define BME680_T1_MSB_REG\t(34)\n#define BME680_GH2_LSB_REG\t(35)\n#define BME680_GH2_MSB_REG\t(36)\n#define BME680_GH1_REG\t\t(37)\n#define BME680_GH3_REG\t\t(38)\n\n/** BME680 register buffer index settings*/\n#define BME680_REG_FILTER_INDEX\t\tUINT8_C(5)\n#define BME680_REG_TEMP_INDEX\t\tUINT8_C(4)\n#define BME680_REG_PRES_INDEX\t\tUINT8_C(4)\n#define BME680_REG_HUM_INDEX\t\tUINT8_C(2)\n#define BME680_REG_NBCONV_INDEX\t\tUINT8_C(1)\n#define BME680_REG_RUN_GAS_INDEX\tUINT8_C(1)\n#define BME680_REG_HCTRL_INDEX\t\tUINT8_C(0)\n\n/** BME680 pressure calculation macros */\n/*! This max value is used to provide precedence to multiplication or division\n * in pressure compensation equation to achieve least loss of precision and\n * avoiding overflows.\n * i.e Comparing value, BME680_MAX_OVERFLOW_VAL = INT32_C(1 << 30)\n */\n#define BME680_MAX_OVERFLOW_VAL INT32_C(0x40000000)\n\n/** Macro to combine two 8 bit data's to form a 16 bit data */\n#define BME680_CONCAT_BYTES(msb, lsb)\t(((uint16_t)msb << 8) | (uint16_t)lsb)\n\n/** Macro to SET and GET BITS of a register */\n#define BME680_SET_BITS(reg_data, bitname, data) \\\n\t\t((reg_data & ~(bitname##_MSK)) | \\\n\t\t((data << bitname##_POS) & bitname##_MSK))\n#define BME680_GET_BITS(reg_data, bitname)\t((reg_data & (bitname##_MSK)) >> \\\n\t(bitname##_POS))\n\n/** Macro variant to handle the bitname position if it is zero */\n#define BME680_SET_BITS_POS_0(reg_data, bitname, data) \\\n\t\t\t\t((reg_data & ~(bitname##_MSK)) | \\\n\t\t\t\t(data & bitname##_MSK))\n#define BME680_GET_BITS_POS_0(reg_data, bitname) (reg_data & (bitname##_MSK))\n\n/** Type definitions */\n/*!\n * Generic communication function pointer\n * @param[in] dev_id: Place holder to store the id of the device structure\n * Can be used to store the index of the Chip select or\n * I2C address of the device.\n * @param[in] reg_addr:\tUsed to select the register the where data needs to\n * be read from or written to.\n * @param[in/out] reg_data: Data array to read/write\n * @param[in] len: Length of the data array\n */\ntypedef int8_t ( *bme680_com_fptr_t )( uint8_t dev_id, uint8_t reg_addr, uint8_t *data, uint16_t len );\n\n/*!\n * Delay function pointer\n * @param[in] period: Time period in milliseconds\n */\ntypedef void ( *bme680_delay_fptr_t )( uint32_t period );\n\n/*!\n * @brief Interface selection Enumerations\n */\nenum bme680_intf\n{\n\t/*! SPI interface */\n\tBME680_SPI_INTF,\n\t/*! I2C interface */\n\tBME680_I2C_INTF\n};\n\n/* structure definitions */\n/*!\n * @brief Sensor field data structure\n */\nstruct\tbme680_field_data\n{\n\t/*! Contains new_data, gasm_valid & heat_stab */\n\tuint8_t status;\n\t/*! The index of the heater profile used */\n\tuint8_t gas_index;\n\t/*! Measurement index to track order */\n\tuint8_t meas_index;\n\n#ifndef BME680_FLOAT_POINT_COMPENSATION\n\t/*! Temperature in degree celsius x100 */\n\tint16_t temperature;\n\t/*! Pressure in Pascal */\n\tuint32_t pressure;\n\t/*! Humidity in % relative humidity x1000 */\n\tuint32_t humidity;\n\t/*! Gas resistance in Ohms */\n\tuint32_t gas_resistance;\n#else\n\t/*! Temperature in degree celsius */\n\tfloat temperature;\n\t/*! Pressure in Pascal */\n\tfloat pressure;\n\t/*! Humidity in % relative humidity x1000 */\n\tfloat humidity;\n\t/*! Gas resistance in Ohms */\n\tfloat gas_resistance;\n\n#endif\n\n};\n\n/*!\n * @brief Structure to hold the Calibration data\n */\nstruct\tbme680_calib_data\n{\n\t/*! Variable to store calibrated humidity data */\n\tuint16_t par_h1;\n\t/*! Variable to store calibrated humidity data */\n\tuint16_t par_h2;\n\t/*! Variable to store calibrated humidity data */\n\tint8_t par_h3;\n\t/*! Variable to store calibrated humidity data */\n\tint8_t par_h4;\n\t/*! Variable to store calibrated humidity data */\n\tint8_t par_h5;\n\t/*! Variable to store calibrated humidity data */\n\tuint8_t par_h6;\n\t/*! Variable to store calibrated humidity data */\n\tint8_t par_h7;\n\t/*! Variable to store calibrated gas data */\n\tint8_t par_gh1;\n\t/*! Variable to store calibrated gas data */\n\tint16_t par_gh2;\n\t/*! Variable to store calibrated gas data */\n\tint8_t par_gh3;\n\t/*! Variable to store calibrated temperature data */\n\tuint16_t par_t1;\n\t/*! Variable to store calibrated temperature data */\n\tint16_t par_t2;\n\t/*! Variable to store calibrated temperature data */\n\tint8_t par_t3;\n\t/*! Variable to store calibrated pressure data */\n\tuint16_t par_p1;\n\t/*! Variable to store calibrated pressure data */\n\tint16_t par_p2;\n\t/*! Variable to store calibrated pressure data */\n\tint8_t par_p3;\n\t/*! Variable to store calibrated pressure data */\n\tint16_t par_p4;\n\t/*! Variable to store calibrated pressure data */\n\tint16_t par_p5;\n\t/*! Variable to store calibrated pressure data */\n\tint8_t par_p6;\n\t/*! Variable to store calibrated pressure data */\n\tint8_t par_p7;\n\t/*! Variable to store calibrated pressure data */\n\tint16_t par_p8;\n\t/*! Variable to store calibrated pressure data */\n\tint16_t par_p9;\n\t/*! Variable to store calibrated pressure data */\n\tuint8_t par_p10;\n\n#ifndef BME680_FLOAT_POINT_COMPENSATION\n\t/*! Variable to store t_fine size */\n\tint32_t t_fine;\n#else\n\t/*! Variable to store t_fine size */\n\tfloat t_fine;\n#endif\n\t/*! Variable to store heater resistance range */\n\tuint8_t res_heat_range;\n\t/*! Variable to store heater resistance value */\n\tint8_t res_heat_val;\n\t/*! Variable to store error range */\n\tint8_t range_sw_err;\n};\n\n/*!\n * @brief BME680 sensor settings structure which comprises of ODR,\n * over-sampling and filter settings.\n */\nstruct\tbme680_tph_sett\n{\n\t/*! Humidity oversampling */\n\tuint8_t os_hum;\n\t/*! Temperature oversampling */\n\tuint8_t os_temp;\n\t/*! Pressure oversampling */\n\tuint8_t os_pres;\n\t/*! Filter coefficient */\n\tuint8_t filter;\n};\n\n/*!\n * @brief BME680 gas sensor which comprises of gas settings\n * and status parameters\n */\nstruct\tbme680_gas_sett\n{\n\t/*! Variable to store nb conversion */\n\tuint8_t nb_conv;\n\t/*! Variable to store heater control */\n\tuint8_t heatr_ctrl;\n\t/*! Run gas enable value */\n\tuint8_t run_gas;\n\t/*! Heater temperature value */\n\tuint16_t heatr_temp;\n\t/*! Duration profile value */\n\tuint16_t heatr_dur;\n};\n\n/*!\n * @brief BME680 device structure\n */\nstruct\tbme680_dev\n{\n\t/*! Chip Id */\n\tuint8_t chip_id;\n\t/*! Device Id */\n\tuint8_t dev_id;\n\t/*! SPI/I2C interface */\n\tenum bme680_intf intf;\n\t/*! Memory page used */\n\tuint8_t mem_page;\n\t/*! Ambient temperature in Degree C */\n\tint8_t amb_temp;\n\t/*! Sensor calibration data */\n\tstruct bme680_calib_data calib;\n\t/*! Sensor settings */\n\tstruct bme680_tph_sett tph_sett;\n\t/*! Gas Sensor settings */\n\tstruct bme680_gas_sett gas_sett;\n\t/*! Sensor power modes */\n\tuint8_t power_mode;\n\t/*! New sensor fields */\n\tuint8_t new_fields;\n\t/*! Store the info messages */\n\tuint8_t info_msg;\n\t/*! Bus read function pointer */\n\tbme680_com_fptr_t read;\n\t/*! Bus write function pointer */\n\tbme680_com_fptr_t write;\n\t/*! delay function pointer */\n\tbme680_delay_fptr_t delay_ms;\n\t/*! Communication function result */\n\tint8_t com_rslt;\n};\n\n\n\n#endif /* BME680_DEFS_H_ */\n/** @}*/\n/** @}*/\n",
"bme680_env.h": "//-----------------------------------------------------------------------------\n// Copyright (c) 2018 Semiconductor Components Industries LLC\n// (d/b/a \"ON Semiconductor\"). All rights reserved.\n// This software and/or documentation is licensed by ON Semiconductor under\n// limited terms and conditions. The terms and conditions pertaining to the\n// software and/or documentation are available at\n// http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf (\"ON Semiconductor Standard\n// Terms and Conditions of Sale, Section 8 Software\") and if applicable the\n// software license agreement. Do not use this software and/or documentation\n// unless you have carefully read and you agree to the limited terms and\n// conditions. By using this software and/or documentation, you agree to the\n// limited terms and conditions.\n//-----------------------------------------------------------------------------\n//! \\file RTE_BDK_BME680_ENV.h\n//!\n//! This file contains the Run Time Configuration (RTE) options for BME680_ENV\n//! CMSIS Component.\n//!\n//! These options can be edited by opening this file in CMSIS Configuration\n//! Wizard Editor that is part of Eclipse installation.\n//!\n//! \\addtogroup BDK_GRP\n//! \\{\n//! \\addtogroup COMPONENTS\n//! \\{\n//! \\addtogroup BME680_ENV_GRP\n//! \\{\n//! \\name Run Time Environment Configuration\n//!\n//! These parameters are part of the \\ref RTE_BME680_ENV.h RTE configuration\n//! file and can be used to adjust library behavior.\n//! This file is copied into the Eclipse project when the BME680_ENV component\n//! is selected and can be edited by using the <i>CMIS Configuration Wizard</i>\n//! editor.\n//!\n//! \\image html rte_bme680_env.jpg\n//!\n//-----------------------------------------------------------------------------\n\n#ifndef RTE_BME680_ENV_H_\n#define RTE_BME680_ENV_H_\n\n// <<< Use Configuration Wizard in Context Menu >>>\n\n/** \\def RTE_BME680_ENV_TEMP_ENABLE\n * \\brief Enables or disables temperature measurement.\n *\n * Disabling is discouraged as other measurements depend on temperature\n * measurement for calibration.\n *\n * If disabled a constant value of INT16_MAX will be reported in\n * \\ref BME680_ENV_Data::temperature.\n */\n// <e> Temperature measurement\n// <i> Enables temperature measurement.\n// <i> Disabling is discouraged as other measurements depend on temperature measurement for calibration.\n// <i> If disabled a constant value of INT16_MAX will be reported.\n#ifndef RTE_BME680_ENV_TEMP_ENABLE\n#define RTE_BME680_ENV_TEMP_ENABLE 1\n#endif\n\n#if defined RTE_BME680_ENV_TEMP_ENABLE == 1\n\n/** \\def RTE_BME680_ENV_OS_TEMP\n * \\brief Temperature measurement oversampling setting.\n *\n * Oversampling improves temperature measurement resolution by reducing noise.\n * Higher oversampling values will result in longer measurement duration.\n *\n * \\see\n * Section <b>3.3.1 Temperature Measurement</b> of BME680 datasheet for more\n * details.\n */\n// <o> Oversampling\n// <i> Oversampling improves temperature measurement resolution by reducing noise.\n// <i> Higher oversampling values will result in longer measurement duration.\n// <i> See section '3.3.1 Temperature Measurement' of BME680 datasheet for more details.\n// <1=> 1x\n// <2=> 2x\n// <3=> 4x\n// <4=> 8x\n// <5=> 16x\n#define RTE_BME680_ENV_OS_TEMP 2\n\n#else\n#define RTE_BME680_ENV_OS_TEMP 0\n#endif /* defined RTE_BME680_ENV_TEMP_ENABLE == 1 */\n\n// </e>\n\n/** \\def RTE_BME680_ENV_PRES_ENABLE\n * \\brief Enables or disables pressure measurement.\n *\n * If disabled a constant value of UINT32_MAX will be reported in\n * \\ref BME680_ENV_Data::pressure.\n */\n// <e> Pressure measurement\n// <i> Enables pressure measurement.\n// <i> If disabled a constant value of UINT32_MAX will be reported.\n#ifndef RTE_BME680_ENV_PRES_ENABLE\n#define RTE_BME680_ENV_PRES_ENABLE 1\n#endif\n\n#if defined RTE_BME680_ENV_PRES_ENABLE == 1\n\n/** \\def RTE_BME680_ENV_OS_PRES\n * \\brief Pressure measurement oversampling setting.\n *\n * Oversampling improves pressure measurement resolution by reducing noise.\n * Higher oversampling values will result in longer measurement duration.\n *\n * \\see\n * Section <b>3.3.2 Pressure Measurement</b> of BME680 datasheet for more\n * details.\n */\n// <o> Oversampling\n// <i> Oversampling improves pressure measurement resolution by reducing noise.\n// <i> Higher oversampling values will result in longer measurement duration.\n// <i> See section '3.3.2 Pressure Measurement' of BME680 datasheet for more details.\n// <1=> 1x\n// <2=> 2x\n// <3=> 4x\n// <4=> 8x\n// <5=> 16x\n#define RTE_BME680_ENV_OS_PRES 2\n\n#else\n#define RTE_BME680_ENV_OS_PRES 0\n#endif /* defined RTE_BME680_ENV_PRES_ENABLE == 1 */\n\n// </e>\n\n/** \\def RTE_BME680_ENV_HUM_ENABLE\n * \\brief Enables or disables humidity measurement.\n *\n * If disabled a constant value of UINT32_MAX will be reported in\n * \\ref BME680_ENV_Data::humidity.\n */\n// <e> Humidity measurement\n// <i> Enables humidity measurement\n// <i> If disabled a constant value of UINT32_MAX will be reported.\n#ifndef RTE_BME680_ENV_HUM_ENABLE\n#define RTE_BME680_ENV_HUM_ENABLE 1\n#endif\n\n#if defined RTE_BME680_ENV_HUM_ENABLE == 1\n\n/** \\def RTE_BME680_ENV_OS_HUM\n * \\brief Humidity measurement oversampling setting.\n *\n * Oversampling improves humidity measurement by reducing noise.\n * Higher oversampling values will result in longer measurement duration.\n *\n * \\see\n * Section <b>3.3.3 Humidity Measurement</b> of BME680 datasheet for more\n * details.\n */\n// <o> Oversampling\n// <i> Higher oversampling setting reduces noise.\n// <i> Higher oversampling values will result in longer measurement duration.\n// <i> See section '3.3.3 Humidity Measurement' of BME680 datasheet for more details.\n// <1=> 1x\n// <2=> 2x\n// <3=> 4x\n// <4=> 8x\n// <5=> 16x\n#ifndef RTE_BME680_ENV_OS_HUM\n#define RTE_BME680_ENV_OS_HUM 2\n#endif\n\n#else\n#define RTE_BME680_ENV_OS_HUM 0\n#endif /* defined RTE_BME680_ENV_HUM_ENABLE == 1 */\n\n// </e>\n\n/** \\def RTE_BME680_ENV_FILTER_SIZE\n * \\brief IIR filter coefficient value.\n *\n * Reduces the bandwidth of temperature and pressure output signals and\n * increases the resolution of output data to 20 bit.\n *\n * \\see\n * Section <b>3.3.4 IIR filter</b> of BME680 datasheet for more details.\n */\n// <o> IIR Filter Size\n// <i> Reduces the bandwidth of temperature and pressure output signals and increases the resolution of output data to 20 bit.\n// <i> See section '3.3.4 IIR filter' of BME680 datasheet for more details.\n// <0=> 0\n// <1=> 1\n// <2=> 3\n// <3=> 7\n// <4=> 15\n// <5=> 31\n// <6=> 63\n// <7=> 127\n#ifndef RTE_BME680_ENV_FILTER_SIZE\n#define RTE_BME680_ENV_FILTER_SIZE 1\n#endif\n\n// <<< end of configuration section >>>\n\n#endif /* RTE_BME680_ENV_H_ */\n\n//! \\}\n//! \\}\n//! \\}\n//! \\}\n",
"bme680_reg.h": "/**\n * Copyright (C) 2017 - 2018 Bosch Sensortec GmbH\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n *\n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n * @file\tbme680.h\n * @date\t22 Feb 2018\n * @version\t3.5.8\n * @brief\n *\n */\n/*! @file bme680.h\n @brief Sensor driver for BME680 sensor */\n/*!\n * @defgroup BME680_DRIVER_GRP BME680 SENSOR API\n * @{*/\n#ifndef BME680_H_\n#define BME680_H_\n\n/*! CPP guard */\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n/* Header includes */\n#include \"bme680_defs.h\"\n\n/* function prototype declarations */\n/*!\n * @brief This API is the entry point.\n * It reads the chip-id and calibration data from the sensor.\n *\n * @param[in,out] dev : Structure instance of bme680_dev\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\n */\nint8_t bme680_init( struct bme680_dev *dev );\n\n/*!\n * @brief This API writes the given data to the register address\n * of the sensor.\n *\n * @param[in] reg_addr : Register address from where the data to be written.\n * @param[in] reg_data : Pointer to data buffer which is to be written\n * in the sensor.\n * @param[in] len : No of bytes of data to write..\n * @param[in] dev : Structure instance of bme680_dev.\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\n */\nint8_t bme680_set_regs( const uint8_t *reg_addr, const uint8_t *reg_data, uint8_t len, struct bme680_dev *dev );\n\n/*!\n * @brief This API reads the data from the given register address of the sensor.\n *\n * @param[in] reg_addr : Register address from where the data to be read\n * @param[out] reg_data : Pointer to data buffer to store the read data.\n * @param[in] len : No of bytes of data to be read.\n * @param[in] dev : Structure instance of bme680_dev.\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\n */\nint8_t bme680_get_regs( uint8_t reg_addr, uint8_t *reg_data, uint16_t len, struct bme680_dev *dev );\n\n/*!\n * @brief This API performs the soft reset of the sensor.\n *\n * @param[in] dev : Structure instance of bme680_dev.\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error.\n */\nint8_t bme680_soft_reset( struct bme680_dev *dev );\n\n/*!\n * @brief This API is used to set the power mode of the sensor.\n *\n * @param[in] dev : Structure instance of bme680_dev\n * @note : Pass the value to bme680_dev.power_mode structure variable.\n *\n * value\t|\tmode\n * -------------|------------------\n *\t0x00\t|\tBME680_SLEEP_MODE\n *\t0x01\t|\tBME680_FORCED_MODE\n *\n * * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\n */\nint8_t bme680_set_sensor_mode( struct bme680_dev *dev );\n\n/*!\n * @brief This API is used to get the power mode of the sensor.\n *\n * @param[in] dev : Structure instance of bme680_dev\n * @note : bme680_dev.power_mode structure variable hold the power mode.\n *\n * value\t|\tmode\n * ---------|------------------\n *\t0x00\t|\tBME680_SLEEP_MODE\n *\t0x01\t|\tBME680_FORCED_MODE\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\n */\nint8_t bme680_get_sensor_mode( struct bme680_dev *dev );\n\n/*!\n * @brief This API is used to set the profile duration of the sensor.\n *\n * @param[in] dev\t : Structure instance of bme680_dev.\n * @param[in] duration : Duration of the measurement in ms.\n *\n * @return Nothing\n */\nvoid bme680_set_profile_dur( uint16_t duration, struct bme680_dev *dev );\n\n/*!\n * @brief This API is used to get the profile duration of the sensor.\n *\n * @param[in] dev\t : Structure instance of bme680_dev.\n * @param[in] duration : Duration of the measurement in ms.\n *\n * @return Nothing\n */\nvoid bme680_get_profile_dur( uint16_t *duration, const struct bme680_dev *dev );\n\n/*!\n * @brief This API reads the pressure, temperature and humidity and gas data\n * from the sensor, compensates the data and store it in the bme680_data\n * structure instance passed by the user.\n *\n * @param[out] data: Structure instance to hold the data.\n * @param[in] dev : Structure instance of bme680_dev.\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error\n */\nint8_t bme680_get_sensor_data( struct bme680_field_data *data, struct bme680_dev *dev );\n\n/*!\n * @brief This API is used to set the oversampling, filter and T,P,H, gas selection\n * settings in the sensor.\n *\n * @param[in] dev : Structure instance of bme680_dev.\n * @param[in] desired_settings : Variable used to select the settings which\n * are to be set in the sensor.\n *\n *\t Macros\t | Functionality\n *---------------------------------|----------------------------------------------\n *\tBME680_OST_SEL | To set temperature oversampling.\n *\tBME680_OSP_SEL | To set pressure oversampling.\n *\tBME680_OSH_SEL | To set humidity oversampling.\n *\tBME680_GAS_MEAS_SEL | To set gas measurement setting.\n *\tBME680_FILTER_SEL | To set filter setting.\n *\tBME680_HCNTRL_SEL | To set humidity control setting.\n *\tBME680_RUN_GAS_SEL | To set run gas setting.\n *\tBME680_NBCONV_SEL | To set NB conversion setting.\n *\tBME680_GAS_SENSOR_SEL | To set all gas sensor related settings\n *\n * @note : Below are the macros to be used by the user for selecting the\n * desired settings. User can do OR operation of these macros for configuring\n * multiple settings.\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error.\n */\nint8_t bme680_set_sensor_settings( uint16_t desired_settings, struct bme680_dev *dev );\n\n/*!\n * @brief This API is used to get the oversampling, filter and T,P,H, gas selection\n * settings in the sensor.\n *\n * @param[in] dev : Structure instance of bme680_dev.\n * @param[in] desired_settings : Variable used to select the settings which\n * are to be get from the sensor.\n *\n * @return Result of API execution status\n * @retval zero -> Success / +ve value -> Warning / -ve value -> Error.\n */\nint8_t bme680_get_sensor_settings( uint16_t desired_settings, struct bme680_dev *dev );\n#ifdef __cplusplus\n}\n#endif /* End of CPP guard */\n#endif /* BME680_H_ */\n/** @}*/\n"
},
"objects": {
"bme680.c": "#include \"bme680.h\"\n#include \"bme680_reg.h\"\n#include \"bme680_env.h\"\n\nstatic struct bme680_dev _BME680_DriverConfig = {0};\nstatic BME680_Config_t _BME680_PrivConfig;\nstatic uint16_t _BLE680_Meas_Delay_Ms = 0;\n\n\nstatic int8_t BME680_I2C_Write( uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len )\n{\n\tuint8_t status;\n\n\tuint8_t writeData[len + 1];\n\n\twriteData[0] = reg_addr;\n\tmemcpy( &writeData[1], reg_data, len );\n\n\treturn ATMO_I2C_MasterWrite( _BME680_PrivConfig.i2cInstance, dev_id, NULL, 0, writeData, len + 1, 0 ) == ATMO_I2C_Status_Success ? 0 : 1;\n}\n\nstatic int8_t BME680_I2C_Read( uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len )\n{\n\tATMO_I2C_Status_t status = ATMO_I2C_Status_Success;\n\tuint8_t currentReg = reg_addr;\n\n\tunsigned int i;\n\n\tstatus = ATMO_I2C_MasterRead( _BME680_PrivConfig.i2cInstance, dev_id,\n\t ®_addr, 1, reg_data, len, 0 );\n\n\treturn ( status == ATMO_I2C_Status_Success ) ? 0 : 1;\n}\n\nBME680_Status_t BME680_Init( BME680_Config_t *config )\n{\n\tif ( config == NULL )\n\t{\n\t\treturn BME680_Status_Fail;\n\t}\n\n\tmemcpy( &_BME680_PrivConfig, config, sizeof( _BME680_PrivConfig ) );\n\n\tATMO_I2C_Peripheral_t i2cConfig;\n\ti2cConfig.operatingMode = ATMO_I2C_OperatingMode_Master;\n\ti2cConfig.baudRate = ATMO_I2C_BaudRate_Standard_Mode;\n\tATMO_I2C_SetConfiguration( config->i2cInstance, &i2cConfig );\n\n\tATMO_PLATFORM_DelayMilliseconds( 1000 );\n\n\tint8_t status;\n\tuint8_t sel_setting;\n\n\t_BME680_DriverConfig.dev_id = BME680_I2C_ADDR_PRIMARY;\n\t_BME680_DriverConfig.intf = BME680_I2C_INTF;\n\t_BME680_DriverConfig.read = &BME680_I2C_Read;\n\t_BME680_DriverConfig.write = &BME680_I2C_Write;\n\t_BME680_DriverConfig.delay_ms = &ATMO_PLATFORM_DelayMilliseconds;\n\t_BME680_DriverConfig.amb_temp = 25;\n\n\tstatus = bme680_init( &_BME680_DriverConfig );\n\n\tif ( status != BME680_OK )\n\t{\n\t\tATMO_PLATFORM_DelayMilliseconds( \"Error initializing BME680\" );\n\t\treturn BME680_Status_Fail;\n\t}\n\n\t_BME680_DriverConfig.tph_sett.os_hum = RTE_BME680_ENV_OS_HUM;\n\t_BME680_DriverConfig.tph_sett.os_pres = RTE_BME680_ENV_OS_PRES;\n\t_BME680_DriverConfig.tph_sett.os_temp = RTE_BME680_ENV_OS_TEMP;\n\t_BME680_DriverConfig.tph_sett.filter = RTE_BME680_ENV_FILTER_SIZE;\n\n\t_BME680_DriverConfig.gas_sett.run_gas = BME680_DISABLE_GAS_MEAS;\n\t_BME680_DriverConfig.gas_sett.heatr_temp = 320;\n\t_BME680_DriverConfig.gas_sett.heatr_dur = 150;\n\n\t_BME680_DriverConfig.power_mode = BME680_SLEEP_MODE;\n\n\tsel_setting = BME680_OST_SEL | BME680_OSP_SEL | BME680_OSH_SEL\n\t | BME680_FILTER_SEL | BME680_GAS_SENSOR_SEL;\n\n\tstatus = bme680_set_sensor_settings( sel_setting, &_BME680_DriverConfig );\n\n\tif ( status != BME680_OK )\n\t{\n\t\tATMO_PLATFORM_DelayMilliseconds( \"Error setting sensor settings\" );\n\t\treturn BME680_Status_Fail;\n\t}\n\n\tstatus = bme680_set_sensor_mode( &_BME680_DriverConfig );\n\n\tif ( status != BME680_OK )\n\t{\n\t\tATMO_PLATFORM_DelayMilliseconds( \"Error setting sensor mode\" );\n\t\treturn BME680_Status_Fail;\n\t}\n\n\t// How long it takes between turning sensor on and getting a reading\n\tbme680_get_profile_dur( &_BLE680_Meas_Delay_Ms, &_BME680_DriverConfig );\n\n\tATMO_PLATFORM_DebugPrint( \"Meas Delay: %d\\r\\n\", _BLE680_Meas_Delay_Ms );\n\n\treturn 0;\n}\n\nstatic void _BME680_StartMeasurement()\n{\n\t// Turn sensor on to start measure\n\t_BME680_DriverConfig.power_mode = BME680_FORCED_MODE;\n\tbme680_set_sensor_mode( &_BME680_DriverConfig );\n\n\t// Wait for measurement to complete\n\tATMO_PLATFORM_DelayMilliseconds( _BLE680_Meas_Delay_Ms );\n}\n\nstatic void _BME680_Sleep()\n{\n\t// Go back to sleep\n\t_BME680_DriverConfig.power_mode = BME680_SLEEP_MODE;\n\tbme680_set_sensor_mode( &_BME680_DriverConfig );\n}\n\nBME680_Status_t BME680_GetTempData( float *tempC )\n{\n\t_BME680_StartMeasurement();\n\n\tstruct bme680_field_data data;\n\tint8_t retval = bme680_get_sensor_data( &data, &_BME680_DriverConfig );\n\n\tif ( retval != 0 )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"Error getting sensor data! %d\\r\\n\", retval );\n\t\t*tempC = 0;\n\t}\n\telse\n\t{\n\t\t*tempC = data.temperature / 100.0;\n\t}\n\n\t_BME680_Sleep();\n\treturn BME680_Status_Success;\n}\n\nBME680_Status_t BME680_GetPressure( float *pressureHpa )\n{\n\t_BME680_StartMeasurement();\n\n\tstruct bme680_field_data data;\n\tint8_t retval = bme680_get_sensor_data( &data, &_BME680_DriverConfig );\n\n\tif ( retval != 0 )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"Error getting sensor data! %d\\r\\n\", retval );\n\t\t*pressureHpa = 0;\n\t}\n\telse\n\t{\n\t\t*pressureHpa = data.pressure;\n\t}\n\n\t_BME680_Sleep();\n\treturn BME680_Status_Success;\n}\n\nBME680_Status_t BME680_GetHumidity( float *humidity )\n{\n\t_BME680_StartMeasurement();\n\n\tstruct bme680_field_data data;\n\tint8_t retval = bme680_get_sensor_data( &data, &_BME680_DriverConfig );\n\n\tif ( retval != 0 )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"Error getting sensor data! %d\\r\\n\", retval );\n\t\t*humidity = 0;\n\t}\n\telse\n\t{\n\t\t*humidity = data.humidity / 1000.0;\n\t}\n\n\t_BME680_Sleep();\n\treturn BME680_Status_Success;\n}\n",
"bme680_reg.c": "#include \"bme680_reg.h\"\n\nstatic int8_t get_calib_data( struct bme680_dev *dev );\nstatic int8_t set_gas_config( struct bme680_dev *dev );\nstatic int8_t get_gas_config( struct bme680_dev *dev );\nstatic uint8_t calc_heater_dur( uint16_t dur );\n\n#ifndef BME680_FLOAT_POINT_COMPENSATION\nstatic int16_t calc_temperature( uint32_t temp_adc, struct bme680_dev *dev );\nstatic uint32_t calc_pressure( uint32_t pres_adc, const struct bme680_dev *dev );\nstatic uint32_t calc_humidity( uint16_t hum_adc, const struct bme680_dev *dev );\nstatic uint32_t calc_gas_resistance( uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev );\nstatic uint8_t calc_heater_res( uint16_t temp, const struct bme680_dev *dev );\n\n#else\nstatic float calc_temperature( uint32_t temp_adc, struct bme680_dev *dev );\nstatic float calc_pressure( uint32_t pres_adc, const struct bme680_dev *dev );\nstatic float calc_humidity( uint16_t hum_adc, const struct bme680_dev *dev );\nstatic float calc_gas_resistance( uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev );\nstatic float calc_heater_res( uint16_t temp, const struct bme680_dev *dev );\n\n#endif\n\nstatic int8_t read_field_data( struct bme680_field_data *data, struct bme680_dev *dev );\nstatic int8_t set_mem_page( uint8_t reg_addr, struct bme680_dev *dev );\nstatic int8_t get_mem_page( struct bme680_dev *dev );\nstatic int8_t null_ptr_check( const struct bme680_dev *dev );\nstatic int8_t boundary_check( uint8_t *value, uint8_t min, uint8_t max, struct bme680_dev *dev );\n\nint8_t bme680_init( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\trslt = bme680_soft_reset( dev );\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_get_regs( BME680_CHIP_ID_ADDR, &dev->chip_id, 1, dev );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\tif ( dev->chip_id == BME680_CHIP_ID )\n\t\t\t\t{\n\t\t\t\t\trslt = get_calib_data( dev );\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\trslt = BME680_E_DEV_NOT_FOUND;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nint8_t bme680_get_regs( uint8_t reg_addr, uint8_t *reg_data, uint16_t len, struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tif ( dev->intf == BME680_SPI_INTF )\n\t\t{\n\t\t\trslt = set_mem_page( reg_addr, dev );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\treg_addr = reg_addr | BME680_SPI_RD_MSK;\n\t\t\t}\n\t\t}\n\n\t\tdev->com_rslt = dev->read( dev->dev_id, reg_addr, reg_data, len );\n\n\t\tif ( dev->com_rslt != 0 )\n\t\t{\n\t\t\trslt = BME680_E_COM_FAIL;\n\t\t}\n\t}\n\n\treturn rslt;\n}\nint8_t bme680_set_regs( const uint8_t *reg_addr, const uint8_t *reg_data, uint8_t len, struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t tmp_buff[BME680_TMP_BUFFER_LENGTH] = { 0 };\n\tuint16_t index;\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tif ( ( len > 0 ) && ( len < BME680_TMP_BUFFER_LENGTH / 2 ) )\n\t\t{\n\t\t\tfor ( index = 0; index < len; index++ )\n\t\t\t{\n\t\t\t\tif ( dev->intf == BME680_SPI_INTF )\n\t\t\t\t{\n\t\t\t\t\trslt = set_mem_page( reg_addr[index], dev );\n\t\t\t\t\ttmp_buff[( 2 * index )] = reg_addr[index] & BME680_SPI_WR_MSK;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\ttmp_buff[( 2 * index )] = reg_addr[index];\n\t\t\t\t}\n\n\t\t\t\ttmp_buff[( 2 * index ) + 1] = reg_data[index];\n\t\t\t}\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\tdev->com_rslt = dev->write( dev->dev_id, tmp_buff[0], &tmp_buff[1], ( 2 * len ) - 1 );\n\n\t\t\t\tif ( dev->com_rslt != 0 )\n\t\t\t\t{\n\t\t\t\t\trslt = BME680_E_COM_FAIL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\trslt = BME680_E_INVALID_LENGTH;\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nint8_t bme680_soft_reset( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t reg_addr = BME680_SOFT_RESET_ADDR;\n\tuint8_t soft_rst_cmd = BME680_SOFT_RESET_CMD;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tif ( dev->intf == BME680_SPI_INTF )\n\t\t{\n\t\t\trslt = get_mem_page( dev );\n\t\t}\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_set_regs( ®_addr, &soft_rst_cmd, 1, dev );\n\t\t\tdev->delay_ms( BME680_RESET_PERIOD );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\tif ( dev->intf == BME680_SPI_INTF )\n\t\t\t\t{\n\t\t\t\t\trslt = get_mem_page( dev );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nint8_t bme680_set_sensor_settings( uint16_t desired_settings, struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t reg_addr;\n\tuint8_t data = 0;\n\tuint8_t count = 0;\n\tuint8_t reg_array[BME680_REG_BUFFER_LENGTH] = { 0 };\n\tuint8_t data_array[BME680_REG_BUFFER_LENGTH] = { 0 };\n\tuint8_t intended_power_mode = dev->power_mode;\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tif ( desired_settings & BME680_GAS_MEAS_SEL )\n\t\t{\n\t\t\trslt = set_gas_config( dev );\n\t\t}\n\n\t\tdev->power_mode = BME680_SLEEP_MODE;\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_set_sensor_mode( dev );\n\t\t}\n\n\t\tif ( desired_settings & BME680_FILTER_SEL )\n\t\t{\n\t\t\trslt = boundary_check( &dev->tph_sett.filter, BME680_FILTER_SIZE_0, BME680_FILTER_SIZE_127, dev );\n\t\t\treg_addr = BME680_CONF_ODR_FILT_ADDR;\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = bme680_get_regs( reg_addr, &data, 1, dev );\n\t\t\t}\n\n\t\t\tif ( desired_settings & BME680_FILTER_SEL )\n\t\t\t{\n\t\t\t\tdata = BME680_SET_BITS( data, BME680_FILTER, dev->tph_sett.filter );\n\t\t\t}\n\n\t\t\treg_array[count] = reg_addr;\n\t\t\tdata_array[count] = data;\n\t\t\tcount++;\n\t\t}\n\n\t\tif ( desired_settings & BME680_HCNTRL_SEL )\n\t\t{\n\t\t\trslt = boundary_check( &dev->gas_sett.heatr_ctrl, BME680_ENABLE_HEATER,\n\t\t\t BME680_DISABLE_HEATER, dev );\n\t\t\treg_addr = BME680_CONF_HEAT_CTRL_ADDR;\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = bme680_get_regs( reg_addr, &data, 1, dev );\n\t\t\t}\n\n\t\t\tdata = BME680_SET_BITS_POS_0( data, BME680_HCTRL, dev->gas_sett.heatr_ctrl );\n\n\t\t\treg_array[count] = reg_addr;\n\t\t\tdata_array[count] = data;\n\t\t\tcount++;\n\t\t}\n\n\t\tif ( desired_settings & ( BME680_OST_SEL | BME680_OSP_SEL ) )\n\t\t{\n\t\t\trslt = boundary_check( &dev->tph_sett.os_temp, BME680_OS_NONE, BME680_OS_16X, dev );\n\t\t\treg_addr = BME680_CONF_T_P_MODE_ADDR;\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = bme680_get_regs( reg_addr, &data, 1, dev );\n\t\t\t}\n\n\t\t\tif ( desired_settings & BME680_OST_SEL )\n\t\t\t{\n\t\t\t\tdata = BME680_SET_BITS( data, BME680_OST, dev->tph_sett.os_temp );\n\t\t\t}\n\n\t\t\tif ( desired_settings & BME680_OSP_SEL )\n\t\t\t{\n\t\t\t\tdata = BME680_SET_BITS( data, BME680_OSP, dev->tph_sett.os_pres );\n\t\t\t}\n\n\t\t\treg_array[count] = reg_addr;\n\t\t\tdata_array[count] = data;\n\t\t\tcount++;\n\t\t}\n\n\t\tif ( desired_settings & BME680_OSH_SEL )\n\t\t{\n\t\t\trslt = boundary_check( &dev->tph_sett.os_hum, BME680_OS_NONE, BME680_OS_16X, dev );\n\t\t\treg_addr = BME680_CONF_OS_H_ADDR;\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = bme680_get_regs( reg_addr, &data, 1, dev );\n\t\t\t}\n\n\t\t\tdata = BME680_SET_BITS_POS_0( data, BME680_OSH, dev->tph_sett.os_hum );\n\n\t\t\treg_array[count] = reg_addr;\n\t\t\tdata_array[count] = data;\n\t\t\tcount++;\n\t\t}\n\n\t\tif ( desired_settings & ( BME680_RUN_GAS_SEL | BME680_NBCONV_SEL ) )\n\t\t{\n\t\t\trslt = boundary_check( &dev->gas_sett.run_gas, BME680_RUN_GAS_DISABLE,\n\t\t\t BME680_RUN_GAS_ENABLE, dev );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = boundary_check( &dev->gas_sett.nb_conv, BME680_NBCONV_MIN,\n\t\t\t\t BME680_NBCONV_MAX, dev );\n\t\t\t}\n\n\t\t\treg_addr = BME680_CONF_ODR_RUN_GAS_NBC_ADDR;\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = bme680_get_regs( reg_addr, &data, 1, dev );\n\t\t\t}\n\n\t\t\tif ( desired_settings & BME680_RUN_GAS_SEL )\n\t\t\t{\n\t\t\t\tdata = BME680_SET_BITS( data, BME680_RUN_GAS, dev->gas_sett.run_gas );\n\t\t\t}\n\n\t\t\tif ( desired_settings & BME680_NBCONV_SEL )\n\t\t\t{\n\t\t\t\tdata = BME680_SET_BITS_POS_0( data, BME680_NBCONV, dev->gas_sett.nb_conv );\n\t\t\t}\n\n\t\t\treg_array[count] = reg_addr;\n\t\t\tdata_array[count] = data;\n\t\t\tcount++;\n\t\t}\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_set_regs( reg_array, data_array, count, dev );\n\t\t}\n\n\t\tdev->power_mode = intended_power_mode;\n\t}\n\n\treturn rslt;\n}\n\nint8_t bme680_get_sensor_settings( uint16_t desired_settings, struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t reg_addr = BME680_CONF_HEAT_CTRL_ADDR;\n\tuint8_t data_array[BME680_REG_BUFFER_LENGTH] = { 0 };\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\trslt = bme680_get_regs( reg_addr, data_array, BME680_REG_BUFFER_LENGTH, dev );\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\tif ( desired_settings & BME680_GAS_MEAS_SEL )\n\t\t\t{\n\t\t\t\trslt = get_gas_config( dev );\n\t\t\t}\n\n\t\t\tif ( desired_settings & BME680_FILTER_SEL )\n\t\t\t\tdev->tph_sett.filter = BME680_GET_BITS( data_array[BME680_REG_FILTER_INDEX],\n\t\t\t\t BME680_FILTER );\n\n\t\t\tif ( desired_settings & ( BME680_OST_SEL | BME680_OSP_SEL ) )\n\t\t\t{\n\t\t\t\tdev->tph_sett.os_temp = BME680_GET_BITS( data_array[BME680_REG_TEMP_INDEX], BME680_OST );\n\t\t\t\tdev->tph_sett.os_pres = BME680_GET_BITS( data_array[BME680_REG_PRES_INDEX], BME680_OSP );\n\t\t\t}\n\n\t\t\tif ( desired_settings & BME680_OSH_SEL )\n\t\t\t\tdev->tph_sett.os_hum = BME680_GET_BITS_POS_0( data_array[BME680_REG_HUM_INDEX],\n\t\t\t\t BME680_OSH );\n\n\t\t\tif ( desired_settings & BME680_HCNTRL_SEL )\n\t\t\t\tdev->gas_sett.heatr_ctrl = BME680_GET_BITS_POS_0( data_array[BME680_REG_HCTRL_INDEX],\n\t\t\t\t BME680_HCTRL );\n\n\t\t\tif ( desired_settings & ( BME680_RUN_GAS_SEL | BME680_NBCONV_SEL ) )\n\t\t\t{\n\t\t\t\tdev->gas_sett.nb_conv = BME680_GET_BITS_POS_0( data_array[BME680_REG_NBCONV_INDEX],\n\t\t\t\t BME680_NBCONV );\n\t\t\t\tdev->gas_sett.run_gas = BME680_GET_BITS( data_array[BME680_REG_RUN_GAS_INDEX],\n\t\t\t\t BME680_RUN_GAS );\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\trslt = BME680_E_NULL_PTR;\n\t}\n\n\treturn rslt;\n}\n\nint8_t bme680_set_sensor_mode( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t tmp_pow_mode;\n\tuint8_t pow_mode = 0;\n\tuint8_t reg_addr = BME680_CONF_T_P_MODE_ADDR;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tdo\n\t\t{\n\t\t\trslt = bme680_get_regs( BME680_CONF_T_P_MODE_ADDR, &tmp_pow_mode, 1, dev );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\tpow_mode = ( tmp_pow_mode & BME680_MODE_MSK );\n\n\t\t\t\tif ( pow_mode != BME680_SLEEP_MODE )\n\t\t\t\t{\n\t\t\t\t\ttmp_pow_mode = tmp_pow_mode & ( ~BME680_MODE_MSK );\n\t\t\t\t\trslt = bme680_set_regs( ®_addr, &tmp_pow_mode, 1, dev );\n\t\t\t\t\tdev->delay_ms( BME680_POLL_PERIOD_MS );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\twhile ( pow_mode != BME680_SLEEP_MODE );\n\n\t\tif ( dev->power_mode != BME680_SLEEP_MODE )\n\t\t{\n\t\t\ttmp_pow_mode = ( tmp_pow_mode & ~BME680_MODE_MSK ) | ( dev->power_mode & BME680_MODE_MSK );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = bme680_set_regs( ®_addr, &tmp_pow_mode, 1, dev );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nint8_t bme680_get_sensor_mode( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t mode;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\trslt = bme680_get_regs( BME680_CONF_T_P_MODE_ADDR, &mode, 1, dev );\n\t\tdev->power_mode = mode & BME680_MODE_MSK;\n\t}\n\n\treturn rslt;\n}\n\nvoid bme680_set_profile_dur( uint16_t duration, struct bme680_dev *dev )\n{\n\tuint32_t tph_dur;\n\tuint32_t meas_cycles;\n\tuint8_t os_to_meas_cycles[6] = {0, 1, 2, 4, 8, 16};\n\n\tmeas_cycles = os_to_meas_cycles[dev->tph_sett.os_temp];\n\tmeas_cycles += os_to_meas_cycles[dev->tph_sett.os_pres];\n\tmeas_cycles += os_to_meas_cycles[dev->tph_sett.os_hum];\n\n\ttph_dur = meas_cycles * UINT32_C( 1963 );\n\ttph_dur += UINT32_C( 477 * 4 );\n\ttph_dur += UINT32_C( 477 * 5 );\n\ttph_dur += UINT32_C( 500 );\n\ttph_dur /= UINT32_C( 1000 );\n\n\ttph_dur += UINT32_C( 1 );\n\tdev->gas_sett.heatr_dur = duration - ( uint16_t ) tph_dur;\n}\n\nvoid bme680_get_profile_dur( uint16_t *duration, const struct bme680_dev *dev )\n{\n\tuint32_t tph_dur;\n\tuint32_t meas_cycles;\n\tuint8_t os_to_meas_cycles[6] = {0, 1, 2, 4, 8, 16};\n\n\tmeas_cycles = os_to_meas_cycles[dev->tph_sett.os_temp];\n\tmeas_cycles += os_to_meas_cycles[dev->tph_sett.os_pres];\n\tmeas_cycles += os_to_meas_cycles[dev->tph_sett.os_hum];\n\n\ttph_dur = meas_cycles * UINT32_C( 1963 );\n\ttph_dur += UINT32_C( 477 * 4 );\n\ttph_dur += UINT32_C( 477 * 5 );\n\ttph_dur += UINT32_C( 500 );\n\ttph_dur /= UINT32_C( 1000 );\n\n\ttph_dur += UINT32_C( 1 );\n\n\t*duration = ( uint16_t ) tph_dur;\n\n\tif ( dev->gas_sett.run_gas )\n\t{\n\t\t*duration += dev->gas_sett.heatr_dur;\n\t}\n}\n\nint8_t bme680_get_sensor_data( struct bme680_field_data *data, struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\trslt = read_field_data( data, dev );\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\tif ( data->status & BME680_NEW_DATA_MSK )\n\t\t\t{\n\t\t\t\tdev->new_fields = 1;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tdev->new_fields = 0;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nstatic int8_t get_calib_data( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t coeff_array[BME680_COEFF_SIZE] = { 0 };\n\tuint8_t temp_var = 0;\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\trslt = bme680_get_regs( BME680_COEFF_ADDR1, coeff_array, BME680_COEFF_ADDR1_LEN, dev );\n\n\t\tif ( rslt == BME680_OK )\n\t\t\trslt = bme680_get_regs( BME680_COEFF_ADDR2, &coeff_array[BME680_COEFF_ADDR1_LEN]\n\t\t\t , BME680_COEFF_ADDR2_LEN, dev );\n\n\t\tdev->calib.par_t1 = ( uint16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_T1_MSB_REG],\n\t\t coeff_array[BME680_T1_LSB_REG] ) );\n\t\tdev->calib.par_t2 = ( int16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_T2_MSB_REG],\n\t\t coeff_array[BME680_T2_LSB_REG] ) );\n\t\tdev->calib.par_t3 = ( int8_t ) ( coeff_array[BME680_T3_REG] );\n\n\t\tdev->calib.par_p1 = ( uint16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_P1_MSB_REG],\n\t\t coeff_array[BME680_P1_LSB_REG] ) );\n\t\tdev->calib.par_p2 = ( int16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_P2_MSB_REG],\n\t\t coeff_array[BME680_P2_LSB_REG] ) );\n\t\tdev->calib.par_p3 = ( int8_t ) coeff_array[BME680_P3_REG];\n\t\tdev->calib.par_p4 = ( int16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_P4_MSB_REG],\n\t\t coeff_array[BME680_P4_LSB_REG] ) );\n\t\tdev->calib.par_p5 = ( int16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_P5_MSB_REG],\n\t\t coeff_array[BME680_P5_LSB_REG] ) );\n\t\tdev->calib.par_p6 = ( int8_t ) ( coeff_array[BME680_P6_REG] );\n\t\tdev->calib.par_p7 = ( int8_t ) ( coeff_array[BME680_P7_REG] );\n\t\tdev->calib.par_p8 = ( int16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_P8_MSB_REG],\n\t\t coeff_array[BME680_P8_LSB_REG] ) );\n\t\tdev->calib.par_p9 = ( int16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_P9_MSB_REG],\n\t\t coeff_array[BME680_P9_LSB_REG] ) );\n\t\tdev->calib.par_p10 = ( uint8_t ) ( coeff_array[BME680_P10_REG] );\n\n\t\tdev->calib.par_h1 = ( uint16_t ) ( ( ( uint16_t ) coeff_array[BME680_H1_MSB_REG] << BME680_HUM_REG_SHIFT_VAL )\n\t\t | ( coeff_array[BME680_H1_LSB_REG] & BME680_BIT_H1_DATA_MSK ) );\n\t\tdev->calib.par_h2 = ( uint16_t ) ( ( ( uint16_t ) coeff_array[BME680_H2_MSB_REG] << BME680_HUM_REG_SHIFT_VAL )\n\t\t | ( ( coeff_array[BME680_H2_LSB_REG] ) >> BME680_HUM_REG_SHIFT_VAL ) );\n\t\tdev->calib.par_h3 = ( int8_t ) coeff_array[BME680_H3_REG];\n\t\tdev->calib.par_h4 = ( int8_t ) coeff_array[BME680_H4_REG];\n\t\tdev->calib.par_h5 = ( int8_t ) coeff_array[BME680_H5_REG];\n\t\tdev->calib.par_h6 = ( uint8_t ) coeff_array[BME680_H6_REG];\n\t\tdev->calib.par_h7 = ( int8_t ) coeff_array[BME680_H7_REG];\n\n\t\tdev->calib.par_gh1 = ( int8_t ) coeff_array[BME680_GH1_REG];\n\t\tdev->calib.par_gh2 = ( int16_t ) ( BME680_CONCAT_BYTES( coeff_array[BME680_GH2_MSB_REG],\n\t\t coeff_array[BME680_GH2_LSB_REG] ) );\n\t\tdev->calib.par_gh3 = ( int8_t ) coeff_array[BME680_GH3_REG];\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_get_regs( BME680_ADDR_RES_HEAT_RANGE_ADDR, &temp_var, 1, dev );\n\n\t\t\tdev->calib.res_heat_range = ( ( temp_var & BME680_RHRANGE_MSK ) / 16 );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\trslt = bme680_get_regs( BME680_ADDR_RES_HEAT_VAL_ADDR, &temp_var, 1, dev );\n\n\t\t\t\tdev->calib.res_heat_val = ( int8_t ) temp_var;\n\n\t\t\t\tif ( rslt == BME680_OK )\n\t\t\t\t{\n\t\t\t\t\trslt = bme680_get_regs( BME680_ADDR_RANGE_SW_ERR_ADDR, &temp_var, 1, dev );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdev->calib.range_sw_err = ( ( int8_t ) temp_var & ( int8_t ) BME680_RSERROR_MSK ) / 16;\n\t}\n\n\treturn rslt;\n}\n\nstatic int8_t set_gas_config( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\n\t\tuint8_t reg_addr[2] = {0};\n\t\tuint8_t reg_data[2] = {0};\n\n\t\tif ( dev->power_mode == BME680_FORCED_MODE )\n\t\t{\n\t\t\treg_addr[0] = BME680_RES_HEAT0_ADDR;\n\t\t\treg_data[0] = calc_heater_res( dev->gas_sett.heatr_temp, dev );\n\t\t\treg_addr[1] = BME680_GAS_WAIT0_ADDR;\n\t\t\treg_data[1] = calc_heater_dur( dev->gas_sett.heatr_dur );\n\t\t\tdev->gas_sett.nb_conv = 0;\n\t\t}\n\t\telse\n\t\t{\n\t\t\trslt = BME680_W_DEFINE_PWR_MODE;\n\t\t}\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_set_regs( reg_addr, reg_data, 2, dev );\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nstatic int8_t get_gas_config( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t reg_addr1 = BME680_ADDR_SENS_CONF_START;\n\tuint8_t reg_addr2 = BME680_ADDR_GAS_CONF_START;\n\tuint8_t reg_data = 0;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tif ( BME680_SPI_INTF == dev->intf )\n\t\t{\n\t\t\trslt = set_mem_page( reg_addr1, dev );\n\t\t}\n\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_get_regs( reg_addr1, ®_data, 1, dev );\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\tdev->gas_sett.heatr_temp = reg_data;\n\t\t\t\trslt = bme680_get_regs( reg_addr2, ®_data, 1, dev );\n\n\t\t\t\tif ( rslt == BME680_OK )\n\t\t\t\t{\n\t\t\t\t\tdev->gas_sett.heatr_dur = reg_data;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\n#ifndef BME680_FLOAT_POINT_COMPENSATION\n\nstatic int16_t calc_temperature( uint32_t temp_adc, struct bme680_dev *dev )\n{\n\tint64_t var1;\n\tint64_t var2;\n\tint64_t var3;\n\tint16_t calc_temp;\n\n\tvar1 = ( ( int32_t ) temp_adc >> 3 ) - ( ( int32_t ) dev->calib.par_t1 << 1 );\n\tvar2 = ( var1 * ( int32_t ) dev->calib.par_t2 ) >> 11;\n\tvar3 = ( ( var1 >> 1 ) * ( var1 >> 1 ) ) >> 12;\n\tvar3 = ( ( var3 ) * ( ( int32_t ) dev->calib.par_t3 << 4 ) ) >> 14;\n\tdev->calib.t_fine = ( int32_t ) ( var2 + var3 );\n\tcalc_temp = ( int16_t ) ( ( ( dev->calib.t_fine * 5 ) + 128 ) >> 8 );\n\n\treturn calc_temp;\n}\n\nstatic uint32_t calc_pressure( uint32_t pres_adc, const struct bme680_dev *dev )\n{\n\tint32_t var1 = 0;\n\tint32_t var2 = 0;\n\tint32_t var3 = 0;\n\tint32_t pressure_comp = 0;\n\n\tvar1 = ( ( ( int32_t )dev->calib.t_fine ) >> 1 ) - 64000;\n\tvar2 = ( ( ( ( var1 >> 2 ) * ( var1 >> 2 ) ) >> 11 ) *\n\t ( int32_t )dev->calib.par_p6 ) >> 2;\n\tvar2 = var2 + ( ( var1 * ( int32_t )dev->calib.par_p5 ) << 1 );\n\tvar2 = ( var2 >> 2 ) + ( ( int32_t )dev->calib.par_p4 << 16 );\n\tvar1 = ( ( ( ( ( var1 >> 2 ) * ( var1 >> 2 ) ) >> 13 ) *\n\t ( ( int32_t )dev->calib.par_p3 << 5 ) ) >> 3 ) +\n\t ( ( ( int32_t )dev->calib.par_p2 * var1 ) >> 1 );\n\tvar1 = var1 >> 18;\n\tvar1 = ( ( 32768 + var1 ) * ( int32_t )dev->calib.par_p1 ) >> 15;\n\tpressure_comp = 1048576 - pres_adc;\n\tpressure_comp = ( int32_t )( ( pressure_comp - ( var2 >> 12 ) ) * ( ( uint32_t )3125 ) );\n\n\tif ( pressure_comp >= BME680_MAX_OVERFLOW_VAL )\n\t{\n\t\tpressure_comp = ( ( pressure_comp / ( uint32_t )var1 ) << 1 );\n\t}\n\telse\n\t{\n\t\tpressure_comp = ( ( pressure_comp << 1 ) / ( uint32_t )var1 );\n\t}\n\n\tvar1 = ( ( int32_t )dev->calib.par_p9 * ( int32_t )( ( ( pressure_comp >> 3 ) *\n\t ( pressure_comp >> 3 ) ) >> 13 ) ) >> 12;\n\tvar2 = ( ( int32_t )( pressure_comp >> 2 ) *\n\t ( int32_t )dev->calib.par_p8 ) >> 13;\n\tvar3 = ( ( int32_t )( pressure_comp >> 8 ) * ( int32_t )( pressure_comp >> 8 ) *\n\t ( int32_t )( pressure_comp >> 8 ) *\n\t ( int32_t )dev->calib.par_p10 ) >> 17;\n\n\tpressure_comp = ( int32_t )( pressure_comp ) + ( ( var1 + var2 + var3 +\n\t ( ( int32_t )dev->calib.par_p7 << 7 ) ) >> 4 );\n\n\treturn ( uint32_t )pressure_comp;\n\n}\n\nstatic uint32_t calc_humidity( uint16_t hum_adc, const struct bme680_dev *dev )\n{\n\tint32_t var1;\n\tint32_t var2;\n\tint32_t var3;\n\tint32_t var4;\n\tint32_t var5;\n\tint32_t var6;\n\tint32_t temp_scaled;\n\tint32_t calc_hum;\n\n\ttemp_scaled = ( ( ( int32_t ) dev->calib.t_fine * 5 ) + 128 ) >> 8;\n\tvar1 = ( int32_t ) ( hum_adc - ( ( int32_t ) ( ( int32_t ) dev->calib.par_h1 * 16 ) ) )\n\t - ( ( ( temp_scaled * ( int32_t ) dev->calib.par_h3 ) / ( ( int32_t ) 100 ) ) >> 1 );\n\tvar2 = ( ( int32_t ) dev->calib.par_h2\n\t * ( ( ( temp_scaled * ( int32_t ) dev->calib.par_h4 ) / ( ( int32_t ) 100 ) )\n\t + ( ( ( temp_scaled * ( ( temp_scaled * ( int32_t ) dev->calib.par_h5 ) / ( ( int32_t ) 100 ) ) ) >> 6 )\n\t / ( ( int32_t ) 100 ) ) + ( int32_t ) ( 1 << 14 ) ) ) >> 10;\n\tvar3 = var1 * var2;\n\tvar4 = ( int32_t ) dev->calib.par_h6 << 7;\n\tvar4 = ( ( var4 ) + ( ( temp_scaled * ( int32_t ) dev->calib.par_h7 ) / ( ( int32_t ) 100 ) ) ) >> 4;\n\tvar5 = ( ( var3 >> 14 ) * ( var3 >> 14 ) ) >> 10;\n\tvar6 = ( var4 * var5 ) >> 1;\n\tcalc_hum = ( ( ( var3 + var6 ) >> 10 ) * ( ( int32_t ) 1000 ) ) >> 12;\n\n\tif ( calc_hum > 100000 )\n\t{\n\t\tcalc_hum = 100000;\n\t}\n\telse if ( calc_hum < 0 )\n\t{\n\t\tcalc_hum = 0;\n\t}\n\n\treturn ( uint32_t ) calc_hum;\n}\n\nstatic uint32_t calc_gas_resistance( uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev )\n{\n\tint64_t var1;\n\tuint64_t var2;\n\tint64_t var3;\n\tuint32_t calc_gas_res;\n\tuint32_t lookupTable1[16] = { UINT32_C( 2147483647 ), UINT32_C( 2147483647 ), UINT32_C( 2147483647 ), UINT32_C( 2147483647 ),\n\t UINT32_C( 2147483647 ), UINT32_C( 2126008810 ), UINT32_C( 2147483647 ), UINT32_C( 2130303777 ),\n\t UINT32_C( 2147483647 ), UINT32_C( 2147483647 ), UINT32_C( 2143188679 ), UINT32_C( 2136746228 ),\n\t UINT32_C( 2147483647 ), UINT32_C( 2126008810 ), UINT32_C( 2147483647 ), UINT32_C( 2147483647 )\n\t };\n\tuint32_t lookupTable2[16] = { UINT32_C( 4096000000 ), UINT32_C( 2048000000 ), UINT32_C( 1024000000 ), UINT32_C( 512000000 ),\n\t UINT32_C( 255744255 ), UINT32_C( 127110228 ), UINT32_C( 64000000 ), UINT32_C( 32258064 ), UINT32_C( 16016016 ),\n\t UINT32_C( 8000000 ), UINT32_C( 4000000 ), UINT32_C( 2000000 ), UINT32_C( 1000000 ), UINT32_C( 500000 ),\n\t UINT32_C( 250000 ), UINT32_C( 125000 )\n\t };\n\n\tvar1 = ( int64_t ) ( ( 1340 + ( 5 * ( int64_t ) dev->calib.range_sw_err ) ) *\n\t ( ( int64_t ) lookupTable1[gas_range] ) ) >> 16;\n\tvar2 = ( ( ( int64_t ) ( ( int64_t ) gas_res_adc << 15 ) - ( int64_t ) ( 16777216 ) ) + var1 );\n\tvar3 = ( ( ( int64_t ) lookupTable2[gas_range] * ( int64_t ) var1 ) >> 9 );\n\tcalc_gas_res = ( uint32_t ) ( ( var3 + ( ( int64_t ) var2 >> 1 ) ) / ( int64_t ) var2 );\n\n\treturn calc_gas_res;\n}\n\nstatic uint8_t calc_heater_res( uint16_t temp, const struct bme680_dev *dev )\n{\n\tuint8_t heatr_res;\n\tint32_t var1;\n\tint32_t var2;\n\tint32_t var3;\n\tint32_t var4;\n\tint32_t var5;\n\tint32_t heatr_res_x100;\n\n\tif ( temp > 400 )\n\t{\n\t\ttemp = 400;\n\t}\n\n\tvar1 = ( ( ( int32_t ) dev->amb_temp * dev->calib.par_gh3 ) / 1000 ) * 256;\n\tvar2 = ( dev->calib.par_gh1 + 784 ) * ( ( ( ( ( dev->calib.par_gh2 + 154009 ) * temp * 5 ) / 100 ) + 3276800 ) / 10 );\n\tvar3 = var1 + ( var2 / 2 );\n\tvar4 = ( var3 / ( dev->calib.res_heat_range + 4 ) );\n\tvar5 = ( 131 * dev->calib.res_heat_val ) + 65536;\n\theatr_res_x100 = ( int32_t ) ( ( ( var4 / var5 ) - 250 ) * 34 );\n\theatr_res = ( uint8_t ) ( ( heatr_res_x100 + 50 ) / 100 );\n\n\treturn heatr_res;\n}\n\n#else\n\nstatic float calc_temperature( uint32_t temp_adc, struct bme680_dev *dev )\n{\n\tfloat var1 = 0;\n\tfloat var2 = 0;\n\tfloat calc_temp = 0;\n\n\tvar1 = ( ( ( ( float )temp_adc / 16384.0f ) - ( ( float )dev->calib.par_t1 / 1024.0f ) )\n\t * ( ( float )dev->calib.par_t2 ) );\n\n\tvar2 = ( ( ( ( ( float )temp_adc / 131072.0f ) - ( ( float )dev->calib.par_t1 / 8192.0f ) ) *\n\t ( ( ( float )temp_adc / 131072.0f ) - ( ( float )dev->calib.par_t1 / 8192.0f ) ) ) *\n\t ( ( float )dev->calib.par_t3 * 16.0f ) );\n\n\tdev->calib.t_fine = ( var1 + var2 );\n\n\tcalc_temp = ( ( dev->calib.t_fine ) / 5120.0f );\n\n\treturn calc_temp;\n}\n\nstatic float calc_pressure( uint32_t pres_adc, const struct bme680_dev *dev )\n{\n\tfloat var1 = 0;\n\tfloat var2 = 0;\n\tfloat var3 = 0;\n\tfloat calc_pres = 0;\n\n\tvar1 = ( ( ( float )dev->calib.t_fine / 2.0f ) - 64000.0f );\n\tvar2 = var1 * var1 * ( ( ( float )dev->calib.par_p6 ) / ( 131072.0f ) );\n\tvar2 = var2 + ( var1 * ( ( float )dev->calib.par_p5 ) * 2.0f );\n\tvar2 = ( var2 / 4.0f ) + ( ( ( float )dev->calib.par_p4 ) * 65536.0f );\n\tvar1 = ( ( ( ( ( float )dev->calib.par_p3 * var1 * var1 ) / 16384.0f )\n\t + ( ( float )dev->calib.par_p2 * var1 ) ) / 524288.0f );\n\tvar1 = ( ( 1.0f + ( var1 / 32768.0f ) ) * ( ( float )dev->calib.par_p1 ) );\n\tcalc_pres = ( 1048576.0f - ( ( float )pres_adc ) );\n\n\tif ( ( int )var1 != 0 )\n\t{\n\t\tcalc_pres = ( ( ( calc_pres - ( var2 / 4096.0f ) ) * 6250.0f ) / var1 );\n\t\tvar1 = ( ( ( float )dev->calib.par_p9 ) * calc_pres * calc_pres ) / 2147483648.0f;\n\t\tvar2 = calc_pres * ( ( ( float )dev->calib.par_p8 ) / 32768.0f );\n\t\tvar3 = ( ( calc_pres / 256.0f ) * ( calc_pres / 256.0f ) * ( calc_pres / 256.0f )\n\t\t * ( dev->calib.par_p10 / 131072.0f ) );\n\t\tcalc_pres = ( calc_pres + ( var1 + var2 + var3 + ( ( float )dev->calib.par_p7 * 128.0f ) ) / 16.0f );\n\t}\n\telse\n\t{\n\t\tcalc_pres = 0;\n\t}\n\n\treturn calc_pres;\n}\n\nstatic float calc_humidity( uint16_t hum_adc, const struct bme680_dev *dev )\n{\n\tfloat calc_hum = 0;\n\tfloat var1 = 0;\n\tfloat var2 = 0;\n\tfloat var3 = 0;\n\tfloat var4 = 0;\n\tfloat temp_comp;\n\n\ttemp_comp = ( ( dev->calib.t_fine ) / 5120.0f );\n\n\tvar1 = ( float )( ( float )hum_adc ) - ( ( ( float )dev->calib.par_h1 * 16.0f ) + ( ( ( float )dev->calib.par_h3 / 2.0f )\n\t * temp_comp ) );\n\n\tvar2 = var1 * ( ( float )( ( ( float ) dev->calib.par_h2 / 262144.0f ) * ( 1.0f + ( ( ( float )dev->calib.par_h4 / 16384.0f )\n\t * temp_comp ) + ( ( ( float )dev->calib.par_h5 / 1048576.0f ) * temp_comp * temp_comp ) ) ) );\n\n\tvar3 = ( float ) dev->calib.par_h6 / 16384.0f;\n\n\tvar4 = ( float ) dev->calib.par_h7 / 2097152.0f;\n\n\tcalc_hum = var2 + ( ( var3 + ( var4 * temp_comp ) ) * var2 * var2 );\n\n\tif ( calc_hum > 100.0f )\n\t{\n\t\tcalc_hum = 100.0f;\n\t}\n\telse if ( calc_hum < 0.0f )\n\t{\n\t\tcalc_hum = 0.0f;\n\t}\n\n\treturn calc_hum;\n}\n\nstatic float calc_gas_resistance( uint16_t gas_res_adc, uint8_t gas_range, const struct bme680_dev *dev )\n{\n\tfloat calc_gas_res;\n\tfloat var1 = 0;\n\tfloat var2 = 0;\n\tfloat var3 = 0;\n\n\tconst float lookup_k1_range[16] =\n\t{\n\t\t0.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, -0.8,\n\t\t0.0, 0.0, -0.2, -0.5, 0.0, -1.0, 0.0, 0.0\n\t};\n\tconst float lookup_k2_range[16] =\n\t{\n\t\t0.0, 0.0, 0.0, 0.0, 0.1, 0.7, 0.0, -0.8,\n\t\t-0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0\n\t};\n\n\tvar1 = ( 1340.0f + ( 5.0f * dev->calib.range_sw_err ) );\n\tvar2 = ( var1 ) * ( 1.0f + lookup_k1_range[gas_range] / 100.0f );\n\tvar3 = 1.0f + ( lookup_k2_range[gas_range] / 100.0f );\n\n\tcalc_gas_res = 1.0f / ( float )( var3 * ( 0.000000125f ) * ( float )( 1 << gas_range ) * ( ( ( ( ( float )gas_res_adc )\n\t - 512.0f ) / var2 ) + 1.0f ) );\n\n\treturn calc_gas_res;\n}\n\nstatic float calc_heater_res( uint16_t temp, const struct bme680_dev *dev )\n{\n\tfloat var1 = 0;\n\tfloat var2 = 0;\n\tfloat var3 = 0;\n\tfloat var4 = 0;\n\tfloat var5 = 0;\n\tfloat res_heat = 0;\n\n\tif ( temp > 400 )\n\t{\n\t\ttemp = 400;\n\t}\n\n\tvar1 = ( ( ( float )dev->calib.par_gh1 / ( 16.0f ) ) + 49.0f );\n\tvar2 = ( ( ( ( float )dev->calib.par_gh2 / ( 32768.0f ) ) * ( 0.0005f ) ) + 0.00235f );\n\tvar3 = ( ( float )dev->calib.par_gh3 / ( 1024.0f ) );\n\tvar4 = ( var1 * ( 1.0f + ( var2 * ( float )temp ) ) );\n\tvar5 = ( var4 + ( var3 * ( float )dev->amb_temp ) );\n\tres_heat = ( uint8_t )( 3.4f * ( ( var5 * ( 4 / ( 4 + ( float )dev->calib.res_heat_range ) ) *\n\t ( 1 / ( 1 + ( ( float ) dev->calib.res_heat_val * 0.002f ) ) ) ) - 25 ) );\n\n\treturn res_heat;\n}\n\n#endif\n\nstatic uint8_t calc_heater_dur( uint16_t dur )\n{\n\tuint8_t factor = 0;\n\tuint8_t durval;\n\n\tif ( dur >= 0xfc0 )\n\t{\n\t\tdurval = 0xff; /* Max duration*/\n\t}\n\telse\n\t{\n\t\twhile ( dur > 0x3F )\n\t\t{\n\t\t\tdur = dur / 4;\n\t\t\tfactor += 1;\n\t\t}\n\n\t\tdurval = ( uint8_t ) ( dur + ( factor * 64 ) );\n\t}\n\n\treturn durval;\n}\n\nstatic int8_t read_field_data( struct bme680_field_data *data, struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t buff[BME680_FIELD_LENGTH] = { 0 };\n\tuint8_t gas_range;\n\tuint32_t adc_temp;\n\tuint32_t adc_pres;\n\tuint16_t adc_hum;\n\tuint16_t adc_gas_res;\n\tuint8_t tries = 10;\n\n\trslt = null_ptr_check( dev );\n\n\tdo\n\t{\n\t\tif ( rslt == BME680_OK )\n\t\t{\n\t\t\trslt = bme680_get_regs( ( ( uint8_t ) ( BME680_FIELD0_ADDR ) ), buff, ( uint16_t ) BME680_FIELD_LENGTH,\n\t\t\t dev );\n\n\t\t\tdata->status = buff[0] & BME680_NEW_DATA_MSK;\n\t\t\tdata->gas_index = buff[0] & BME680_GAS_INDEX_MSK;\n\t\t\tdata->meas_index = buff[1];\n\n\t\t\tadc_pres = ( uint32_t ) ( ( ( uint32_t ) buff[2] * 4096 ) | ( ( uint32_t ) buff[3] * 16 )\n\t\t\t | ( ( uint32_t ) buff[4] / 16 ) );\n\t\t\tadc_temp = ( uint32_t ) ( ( ( uint32_t ) buff[5] * 4096 ) | ( ( uint32_t ) buff[6] * 16 )\n\t\t\t | ( ( uint32_t ) buff[7] / 16 ) );\n\t\t\tadc_hum = ( uint16_t ) ( ( ( uint32_t ) buff[8] * 256 ) | ( uint32_t ) buff[9] );\n\t\t\tadc_gas_res = ( uint16_t ) ( ( uint32_t ) buff[13] * 4 | ( ( ( uint32_t ) buff[14] ) / 64 ) );\n\t\t\tgas_range = buff[14] & BME680_GAS_RANGE_MSK;\n\n\t\t\tdata->status |= buff[14] & BME680_GASM_VALID_MSK;\n\t\t\tdata->status |= buff[14] & BME680_HEAT_STAB_MSK;\n\n\t\t\tif ( data->status & BME680_NEW_DATA_MSK )\n\t\t\t{\n\t\t\t\tdata->temperature = calc_temperature( adc_temp, dev );\n\t\t\t\tdata->pressure = calc_pressure( adc_pres, dev );\n\t\t\t\tdata->humidity = calc_humidity( adc_hum, dev );\n\t\t\t\tdata->gas_resistance = calc_gas_resistance( adc_gas_res, gas_range, dev );\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdev->delay_ms( BME680_POLL_PERIOD_MS );\n\t\t}\n\n\t\ttries--;\n\t}\n\twhile ( tries );\n\n\tif ( !tries )\n\t{\n\t\trslt = BME680_W_NO_NEW_DATA;\n\t}\n\n\treturn rslt;\n}\n\nstatic int8_t set_mem_page( uint8_t reg_addr, struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t reg;\n\tuint8_t mem_page;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tif ( reg_addr > 0x7f )\n\t\t{\n\t\t\tmem_page = BME680_MEM_PAGE1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tmem_page = BME680_MEM_PAGE0;\n\t\t}\n\n\t\tif ( mem_page != dev->mem_page )\n\t\t{\n\t\t\tdev->mem_page = mem_page;\n\n\t\t\tdev->com_rslt = dev->read( dev->dev_id, BME680_MEM_PAGE_ADDR | BME680_SPI_RD_MSK, ®, 1 );\n\n\t\t\tif ( dev->com_rslt != 0 )\n\t\t\t{\n\t\t\t\trslt = BME680_E_COM_FAIL;\n\t\t\t}\n\n\t\t\tif ( rslt == BME680_OK )\n\t\t\t{\n\t\t\t\treg = reg & ( ~BME680_MEM_PAGE_MSK );\n\t\t\t\treg = reg | ( dev->mem_page & BME680_MEM_PAGE_MSK );\n\n\t\t\t\tdev->com_rslt = dev->write( dev->dev_id, BME680_MEM_PAGE_ADDR & BME680_SPI_WR_MSK,\n\t\t\t\t ®, 1 );\n\n\t\t\t\tif ( dev->com_rslt != 0 )\n\t\t\t\t{\n\t\t\t\t\trslt = BME680_E_COM_FAIL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nstatic int8_t get_mem_page( struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\tuint8_t reg;\n\n\trslt = null_ptr_check( dev );\n\n\tif ( rslt == BME680_OK )\n\t{\n\t\tdev->com_rslt = dev->read( dev->dev_id, BME680_MEM_PAGE_ADDR | BME680_SPI_RD_MSK, ®, 1 );\n\n\t\tif ( dev->com_rslt != 0 )\n\t\t{\n\t\t\trslt = BME680_E_COM_FAIL;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdev->mem_page = reg & BME680_MEM_PAGE_MSK;\n\t\t}\n\t}\n\n\treturn rslt;\n}\n\nstatic int8_t boundary_check( uint8_t *value, uint8_t min, uint8_t max, struct bme680_dev *dev )\n{\n\tint8_t rslt = BME680_OK;\n\n\tif ( value != NULL )\n\t{\n\t\tif ( *value < min )\n\t\t{\n\t\t\t*value = min;\n\t\t\tdev->info_msg |= BME680_I_MIN_CORRECTION;\n\t\t}\n\n\t\tif ( *value > max )\n\t\t{\n\t\t\t*value = max;\n\t\t\tdev->info_msg |= BME680_I_MAX_CORRECTION;\n\t\t}\n\t}\n\telse\n\t{\n\t\trslt = BME680_E_NULL_PTR;\n\t}\n\n\treturn rslt;\n}\n\nstatic int8_t null_ptr_check( const struct bme680_dev *dev )\n{\n\tint8_t rslt;\n\n\tif ( ( dev == NULL ) || ( dev->read == NULL ) || ( dev->write == NULL ) || ( dev->delay_ms == NULL ) )\n\t{\n\t\trslt = BME680_E_NULL_PTR;\n\t}\n\telse\n\t{\n\t\trslt = BME680_OK;\n\t}\n\n\treturn rslt;\n}\n"
}
}
},
"md5": "d46d0ef80744c4ea0e5f82959873c333"
},
"bhi160": {
"libName": "bhi160",
"manufacturer": "Bosch",
"description": "Sensor Hub",
"type": "Accelerometer Gyroscope",
"icon": "",
"image": "",
"version": "",
"eelVersion": "3",
"shoppingCartLinks": {
"digikey": {
"links": {
"info": "https://www.digikey.com/short/p905n3"
},
"cartData": {
"part": "1471-1676-ND",
"source": "dkstudio",
"qty": "1"
}
}
},
"requires": [
"embedded",
"i2c",
"gpio",
"fpmath"
],
"elements": [
{
"name": "EmbeddedBHI160",
"type": "EmbeddedBHI160",
"icon": "EmbeddedGyroscope.svg",
"defaultAbility": "xAcceleration",
"defaultTrigger": "xAccelerationRead",
"hidden": false,
"abilities": [
{
"name": "setup",
"hidden": true,
"code": " BHI160_Config_t config;\r\n config.i2cInstance = ATMO_PROPERTY(undefined, i2cInstance);\r\n config.gpioInstance = ATMO_PROPERTY(undefined, gpioInstance);\r\n config.intPin = ATMO_PROPERTY(undefined, intPin);\r\n\r\n if(!BHI160_Init(&config))\r\n {\r\n return ATMO_Status_Fail;\r\n }\r\n return ATMO_Status_Success;"
},
{
"name": "xAcceleration",
"triggers": [
"xAccelerationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(&data, NULL, NULL);\r\n ATMO_CreateValueFloat(out, data.x);\r\n return ATMO_Status_Success;"
},
{
"name": "yAcceleration",
"triggers": [
"yAccelerationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(&data, NULL, NULL);\r\n ATMO_CreateValueFloat(out, data.y);\r\n return ATMO_Status_Success;"
},
{
"name": "zAcceleration",
"triggers": [
"zAccelerationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(&data, NULL, NULL);\r\n ATMO_CreateValueFloat(out, data.z);\r\n return ATMO_Status_Success;"
},
{
"name": "acceleration",
"triggers": [
"accelerationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(&data, NULL, NULL);\r\n ATMO_CreateValue3dVectorFloat(out, &data);\r\n return ATMO_Status_Success;"
},
{
"name": "angularRate",
"triggers": [
"angularRateRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, &data, NULL);\r\n ATMO_CreateValue3dVectorFloat(out, &data);\r\n return ATMO_Status_Success;"
},
{
"name": "xAngularRate",
"triggers": [
"xAngularRateRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, &data, NULL);\r\n ATMO_CreateValueFloat(out, data.x);\r\n return ATMO_Status_Success;"
},
{
"name": "yAngularRate",
"triggers": [
"yAngularRateRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, &data, NULL);\r\n ATMO_CreateValueFloat(out, data.y);\r\n return ATMO_Status_Success;"
},
{
"name": "zAngularRate",
"triggers": [
"zAngularRateRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, &data, NULL);\r\n ATMO_CreateValueFloat(out, data.z);\r\n return ATMO_Status_Success;"
},
{
"name": "orientation",
"triggers": [
"orientationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, NULL, &data);\r\n ATMO_CreateValue3dVectorFloat(out, &data);\r\n return ATMO_Status_Success;"
},
{
"name": "xOrientation",
"triggers": [
"xOrientationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, NULL, &data);\r\n ATMO_CreateValueFloat(out, data.x);\r\n return ATMO_Status_Success;"
},
{
"name": "yOrientation",
"triggers": [
"yOrientationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, NULL, &data);\r\n ATMO_CreateValueFloat(out, data.y);\r\n return ATMO_Status_Success;"
},
{
"name": "zOrientation",
"triggers": [
"zOrientationRead"
],
"code": " ATMO_3dFloatVector_t data;\r\n BHI160_GetData(NULL, NULL, &data);\r\n ATMO_CreateValueFloat(out, data.z);\r\n return ATMO_Status_Success;"
}
],
"properties": [
{
"name": "i2cInstance",
"input": "driverInstance",
"driverType": "i2c"
},
{
"name": "gpioInstance",
"input": "driverInstance",
"driverType": "gpio"
},
{
"name": "intPin",
"input": "number",
"value": 9
}
],
"triggers": [],
"variables": [],
"language": {
"en-US": {
"EmbeddedBHI160": "BHI160 Inertial",
"xAcceleration": "Read X Acceleration (g)",
"yAcceleration": "Read Y Acceleration (g)",
"zAcceleration": "Read Z Acceleration (g)",
"xAngularRate": "Read X Rotation Speed (dps)",
"yAngularRate": "Read Y Rotation Speed (dps)",
"zAngularRate": "Read Z Rotation Speed (dps)",
"xAccelerationRead": "X Acceleration Read",
"yAccelerationRead": "Y Acceleration Read",
"zAccelerationRead": "Z Acceleration Read",
"xAngularRateRead": "X Rotation Speed Read",
"yAngularRateRead": "Y Rotation Speed Read",
"zAngularRateRead": "Z Rotation Speed Read",
"xOrientation": "Read X Orientation",
"yOrientation": "Read Y Orientation",
"zOrientation": "Read Z Orientation",
"orientation": "Read Orientation",
"xOrientationRead": "X Orientation Read (deg)",
"yOrientationRead": "Y Orientation Read (deg)",
"zOrientationRead": "Z Orientation Read (deg)",
"orientationRead": "Orientation Read (deg)",
"acceleration": "Read Acceleration",
"accelerationRead": "Acceleration Read",
"i2cAddress": "I2C Address",
"i2cInstance": "I2C Driver Instance",
"angularRate": "Read Rotation Speed",
"angularRateRead": "Rotation Speed Read",
"temperature": "Read Temperature (C)",
"temperatureRead": "Temperature Read",
"intPin": "Interrupt Pin",
"gpioInstance": "GPIO Driver Instance"
}
}
}
],
"files": {
"common": {
"headers": {
"bhi160.h": "#ifndef _BHI160_H_\n#define _BHI160_H_\n\n#include \"../app_src/atmosphere_platform.h\"\n\ntypedef struct\n{\n\tATMO_DriverInstanceHandle_t i2cInstance;\n\tATMO_DriverInstanceHandle_t gpioInstance;\n\tATMO_GPIO_Device_Pin_t intPin;\n} BHI160_Config_t;\n\nATMO_BOOL_t BHI160_Init( BHI160_Config_t *config );\nATMO_BOOL_t BHI160_GetData( ATMO_3dFloatVector_t *acceleration, ATMO_3dFloatVector_t *gyro, ATMO_3dFloatVector_t *mag );\n\n#endif\n",
"bhy.h": "/** \\mainpage\n*\n****************************************************************************\n* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n*\n* File : bhy.h\n*\n* Date : 2016/01/22\n*\n* Revision : 1.0.4 $\n*\n* Usage: Sensor Driver file for BHY sensor\n*\n****************************************************************************\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n* \n* Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n* \n* Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n* \n* Neither the name of the copyright holder nor the names of the\n* contributors may be used to endorse or promote products derived from\n* this software without specific prior written permission.\n* \n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n* CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n* OR CONTRIBUTORS BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n* OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n* ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n* \n* The information provided is believed to be accurate and reliable.\n* The copyright holder assumes no responsibility\n* for the consequences of use\n* of such information nor for any infringement of patents or\n* other rights of third parties which may result from its use.\n* No license is granted by implication or otherwise under any patent or\n* patent rights of the copyright holder.\n*\n**************************************************************************/\n/*! \\file bhy.h\n \\brief BHY Sensor Driver Support Header File */\n\n#ifndef __BHY_H__\n#define __BHY_H__\n/****************************************************************/\n/**\\name DATA TYPES INCLUDES */\n/************************************************************/\n/*!\n* @brief The following definition uses for define the data types\n*\n* @note While porting the API please consider the following\n* @note Please check the version of C standard\n* @note Are you using Linux platform\n*/\n\n/*!\n* @brief For the Linux platform support\n* Please use the types.h for your data types definitions\n*/\n#ifdef __KERNEL__\n\n#include <linux/types.h>\n/* singed integer type*/\ntypedef int8_t s8;/**< used for signed 8bit */\ntypedef int16_t s16;/**< used for signed 16bit */\ntypedef int32_t s32;/**< used for signed 32bit */\ntypedef int64_t s64;/**< used for signed 64bit */\n\ntypedef u_int8_t u8;/**< used for unsigned 8bit */\ntypedef u_int16_t u16;/**< used for unsigned 16bit */\ntypedef u_int32_t u32;/**< used for unsigned 32bit */\ntypedef u_int64_t u64;/**< used for unsigned 64bit */\n\n\n\n#else /* ! __KERNEL__ */\n/**********************************************************\n* These definition uses for define the C\n* standard version data types\n***********************************************************/\n# if !defined(__STDC_VERSION__)\n\n/************************************************\n * compiler is C11 C standard\n************************************************/\n#if (__STDC_VERSION__ == 201112L)\n\n/************************************************/\n#include <stdint.h>\n/************************************************/\n\n/*unsigned integer types*/\ntypedef uint8_t u8;/**< used for unsigned 8bit */\ntypedef uint16_t u16;/**< used for unsigned 16bit */\ntypedef uint32_t u32;/**< used for unsigned 32bit */\ntypedef uint64_t u64;/**< used for unsigned 64bit */\n\n/*signed integer types*/\ntypedef int8_t s8;/**< used for signed 8bit */\ntypedef int16_t s16;/**< used for signed 16bit */\ntypedef int32_t s32;/**< used for signed 32bit */\ntypedef int64_t s64;/**< used for signed 64bit */\n/************************************************\n * compiler is C99 C standard\n************************************************/\n\n#elif (__STDC_VERSION__ == 199901L)\n\n/* stdint.h is a C99 supported c library.\nwhich is used to fixed the integer size*/\n/************************************************/\n#include <stdint.h>\n/************************************************/\n\n/*unsigned integer types*/\ntypedef uint8_t u8;/**< used for unsigned 8bit */\ntypedef uint16_t u16;/**< used for unsigned 16bit */\ntypedef uint32_t u32;/**< used for unsigned 32bit */\ntypedef uint64_t u64;/**< used for unsigned 64bit */\n\n/*signed integer types*/\ntypedef int8_t s8;/**< used for signed 8bit */\ntypedef int16_t s16;/**< used for signed 16bit */\ntypedef int32_t s32;/**< used for signed 32bit */\ntypedef int64_t s64;/**< used for signed 64bit */\n/************************************************\n * compiler is C89 or other C standard\n************************************************/\n\n#else /* !defined(__STDC_VERSION__) */\n/*!\n* @brief By default it is defined as 32 bit machine configuration\n* define your data types based on your\n* machine/compiler/controller configuration\n*/\n#define MACHINE_32_BIT\n\n/*! @brief\n * If your machine support 16 bit\n * define the MACHINE_16_BIT\n */\n#ifdef MACHINE_16_BIT\n#include <limits.h>\n/*signed integer types*/\ntypedef signed char s8;/**< used for signed 8bit */\ntypedef signed short int s16;/**< used for signed 16bit */\ntypedef signed long int s32;/**< used for signed 32bit */\n\n#if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL\ntypedef long int s64;/**< used for signed 64bit */\ntypedef unsigned long int u64;/**< used for unsigned 64bit */\n#elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)\ntypedef long long int s64;/**< used for signed 64bit */\ntypedef unsigned long long int u64;/**< used for unsigned 64bit */\n#else\n#warning Either the correct data type for signed 64 bit integer \\\ncould not be found, or 64 bit integers are not supported in your environment.\n#warning If 64 bit integers are supported on your platform, \\\nplease set s64 manually.\n#endif\n\n/*unsigned integer types*/\ntypedef unsigned char u8;/**< used for unsigned 8bit */\ntypedef unsigned short int u16;/**< used for unsigned 16bit */\ntypedef unsigned long int u32;/**< used for unsigned 32bit */\n\n/* If your machine support 32 bit\ndefine the MACHINE_32_BIT*/\n#elif defined MACHINE_32_BIT\n/*signed integer types*/\ntypedef signed char s8;/**< used for signed 8bit */\ntypedef signed short int s16;/**< used for signed 16bit */\ntypedef signed int s32;/**< used for signed 32bit */\n\n/*unsigned integer types*/\ntypedef unsigned char u8;/**< used for unsigned 8bit */\ntypedef unsigned short int u16;/**< used for unsigned 16bit */\ntypedef unsigned int u32;/**< used for unsigned 32bit */\n\n/* If your machine support 64 bit\ndefine the MACHINE_64_BIT*/\n#elif defined MACHINE_64_BIT\n/*signed integer types*/\ntypedef signed char s8;/**< used for signed 8bit */\ntypedef signed short int s16;/**< used for signed 16bit */\ntypedef signed int s32;/**< used for signed 32bit */\ntypedef signed long int s64;/**< used for signed 64bit */\n\n/*unsigned integer types*/\ntypedef unsigned char u8;/**< used for unsigned 8bit */\ntypedef unsigned short int u16;/**< used for unsigned 16bit */\ntypedef unsigned int u32;/**< used for unsigned 32bit */\ntypedef unsigned long int u64;/**< used for unsigned 64bit */\n\n#else\n#warning The data types defined above which not supported \\\ndefine the data types manually\n#endif\n#endif\n\n/*** This else will execute for the compilers\n * which are not supported the C standards\n * Like C89/C99/C11***/\n#else\n/*!\n* @brief By default it is defined as 32 bit machine configuration\n* define your data types based on your\n* machine/compiler/controller configuration\n*/\n#define MACHINE_32_BIT\n\n/* If your machine support 16 bit\ndefine the MACHINE_16_BIT*/\n#ifdef MACHINE_16_BIT\n#include <limits.h>\n/*signed integer types*/\ntypedef signed char s8;/**< used for signed 8bit */\ntypedef signed short int s16;/**< used for signed 16bit */\ntypedef signed long int s32;/**< used for signed 32bit */\n\n#if defined(LONG_MAX) && LONG_MAX == 0x7fffffffffffffffL\ntypedef long int s64;/**< used for signed 64bit */\ntypedef unsigned long int u64;/**< used for unsigned 64bit */\n#elif defined(LLONG_MAX) && (LLONG_MAX == 0x7fffffffffffffffLL)\ntypedef long long int s64;/**< used for signed 64bit */\ntypedef unsigned long long int u64;/**< used for unsigned 64bit */\n#else\n#warning Either the correct data type for signed 64 bit integer \\\ncould not be found, or 64 bit integers are not supported in your environment.\n#warning If 64 bit integers are supported on your platform, \\\nplease set s64 manually.\n#endif\n\n/*unsigned integer types*/\ntypedef unsigned char u8;/**< used for unsigned 8bit */\ntypedef unsigned short int u16;/**< used for unsigned 16bit */\ntypedef unsigned long int u32;/**< used for unsigned 32bit */\n\n/*! @brief If your machine support 32 bit\ndefine the MACHINE_32_BIT*/\n#elif defined MACHINE_32_BIT\n/*signed integer types*/\ntypedef signed char s8;/**< used for signed 8bit */\ntypedef signed short int s16;/**< used for signed 16bit */\ntypedef signed int s32;/**< used for signed 32bit */\n\n/*unsigned integer types*/\ntypedef unsigned char u8;/**< used for unsigned 8bit */\ntypedef unsigned short int u16;/**< used for unsigned 16bit */\ntypedef unsigned int u32;/**< used for unsigned 32bit */\n\n/* If your machine support 64 bit\ndefine the MACHINE_64_BIT*/\n#elif defined MACHINE_64_BIT\n/*signed integer types*/\ntypedef signed char s8;/**< used for signed 8bit */\ntypedef signed short int s16;/**< used for signed 16bit */\ntypedef signed int s32;/**< used for signed 32bit */\ntypedef signed long int s64;/**< used for signed 64bit */\n\n/*unsigned integer types*/\ntypedef unsigned char u8;/**< used for unsigned 8bit */\ntypedef unsigned short int u16;/**< used for unsigned 16bit */\ntypedef unsigned int u32;/**< used for unsigned 32bit */\ntypedef unsigned long int u64;/**< used for unsigned 64bit */\n\n#else\n#warning The data types defined above which not supported \\\ndefine the data types manually\n#endif\n#endif\n#endif\n/***************************************************************/\n/**\\name BUS READ AND WRITE FUNCTION POINTERS */\n/***************************************************************/\n/*!\n @brief Define the calling convention of YOUR bus communication routine.\n @note This includes types of parameters. This example shows the\n configuration for an SPI bus link.\n\n If your communication function looks like this:\n\n write_my_bus_xy(u8 device_addr, u8 register_addr,\n u8 * data, u8 length);\n\n The BHY_WR_FUNC_PTR would equal:\n\n BHY_WR_FUNC_PTR s8 (* bus_write)(u8,\n u8, u8 *, u8)\n\n Parameters can be mixed as needed refer to the\n @ref BHY_BUS_WRITE_FUNC macro.\n\n\n*/\n#define BHY_WR_FUNC_PTR s8 (*bus_write)(u8, u8,\\\nu8 *, u16)\n/**< link macro between API function calls and bus write function\n @note The bus write function can change since this is a\n system dependant issue.\n\n If the bus_write parameter calling order is like: reg_addr,\n reg_data, wr_len it would be as it is here.\n\n If the parameters are differently ordered or your communication\n function like I2C need to know the device address,\n you can change this macro accordingly.\n\n\n BHY_BUS_WRITE_FUNC(device_addr, reg_addr, reg_data, wr_len)\\\n bus_write(device_addr, reg_addr, reg_data, wr_len)\n\n This macro lets all API functions call YOUR communication routine in a\n way that equals your definition in the\n @ref BHY_WR_FUNC_PTR definition.\n\n*/\n#define BHY_BUS_WRITE_FUNC(device_addr, reg_addr, reg_data, wr_len)\\\nbus_write(device_addr, reg_addr, reg_data, wr_len)\n\n/**< Define the calling convention of YOUR bus communication routine.\n @note This includes types of parameters. This example shows the\n configuration for an SPI bus link.\n\n If your communication function looks like this:\n\n read_my_bus_xy(u8 device_addr, u8 register_addr,\n u8 * data, u8 length);\n\n The BHY_RD_FUNC_PTR would equal:\n\n BHY_RD_FUNC_PTR s8 (* bus_read)(u8,\n u8, u8 *, u8)\n\n Parameters can be mixed as needed refer to the\n refer BHY_BUS_READ_FUNC macro.\n\n*/\n#define BHY_SPI_READ_MASK 0x80 /* for spi read transactions on SPI the\n MSB has to be set */\n#define BHY_RD_FUNC_PTR s8 (*bus_read)(u8, u8, u8 *, u16)\n\n#define BHY_BRD_FUNC_PTR s8 (*burst_read)(u8, u8, u8 *, u32)\n\n/**< link macro between API function calls and bus read function\n @note The bus write function can change since this is a\n system dependant issue.\n\n If the bus_read parameter calling order is like: reg_addr,\n reg_data, wr_len it would be as it is here.\n\n If the parameters are differently ordered or your communication\n function like I2C need to know the device address,\n you can change this macro accordingly.\n\n\n BHY_BUS_READ_FUNC(device_addr, reg_addr, reg_data, wr_len)\\\n bus_read(device_addr, reg_addr, reg_data, wr_len)\n\n This macro lets all API functions call YOUR communication routine in a\n way that equals your definition in the\n refer BHY_WR_FUNC_PTR definition.\n\n @note: this macro also includes the \"MSB='1'\n for reading BHY addresses.\n\n*/\n#define BHY_BUS_READ_FUNC(device_addr, reg_addr, reg_data, r_len)\\\n bus_read(device_addr, reg_addr, reg_data, r_len)\n\n#define BHY_BURST_READ_FUNC(device_addr, register_addr, register_data, rd_len)\\\n burst_read(device_addr, register_addr, register_data, rd_len)\n\n\n#define BHY_MDELAY_DATA_TYPE u32\n/***************************************************************/\n/**\\name I2C ADDRESS DEFINITIONS */\n/***************************************************************/\n#define BHY_I2C_ADDR1 (0x28)\n#define BHY_I2C_ADDR2 (0x29)\n/***************************************************************/\n/**\\name CONSTANTS */\n/***************************************************************/\n#define BHY_INIT_VALUE (0)\n#define BHY_GEN_READ_WRITE_LENGTH (1)\n#define BHY_BYTES_REMAINING_LENGTH (2)\n#define BHY_CRC_HOST_LENGTH (4)\n#define BHY_PARAMETER_ACK_LENGTH (250)\n#define BHY_READ_BUFFER_LENGTH (16)\n#define BHY_PARAMETER_ACK_DELAY (50)\n#define BHY_SIGNATURE_MEM_LEN (17)\n/***************************************************************/\n/**\\name BIT SHIFTING DEFINITION */\n/***************************************************************/\n#define BHY_SHIFT_BIT_POSITION_BY_01_BIT (1)\n#define BHY_SHIFT_BIT_POSITION_BY_02_BITS (2)\n#define BHY_SHIFT_BIT_POSITION_BY_03_BITS (3)\n#define BHY_SHIFT_BIT_POSITION_BY_04_BITS (4)\n#define BHY_SHIFT_BIT_POSITION_BY_05_BITS (5)\n#define BHY_SHIFT_BIT_POSITION_BY_06_BITS (6)\n#define BHY_SHIFT_BIT_POSITION_BY_07_BITS (7)\n#define BHY_SHIFT_BIT_POSITION_BY_08_BITS (8)\n#define BHY_SHIFT_BIT_POSITION_BY_16_BITS (16)\n#define BHY_SHIFT_BIT_POSITION_BY_24_BITS (24)\n/****************************************************/\n/**\\name ARRAY SIZE DEFINITIONS */\n/***************************************************/\n#define BHY_BYTES_REMAINING_SIZE (2)\n#define BHY_BYTES_REMAINING_LSB (0)\n#define BHY_BYTES_REMAINING_MSB (1)\n\n#define BHY_CRC_HOST_SIZE (4)\n#define BHY_CRC_HOST_LSB (0)\n#define BHY_CRC_HOST_XLSB (1)\n#define BHY_CRC_HOST_XXLSB (2)\n#define BHY_CRC_HOST_MSB (3)\n#define BHY_CRC_HOST_FILE_LSB (4)\n#define BHY_CRC_HOST_FILE_XLSB (5)\n#define BHY_CRC_HOST_FILE_XXLSB (6)\n#define BHY_CRC_HOST_FILE_MSB (7)\n\n#define BHY_INDEX_LEN (19)\n\n#define BHY_WRITE_BUFFER_SIZE (8)\n#define BHY_WRITE_BUFFER_1_REG (0)\n#define BHY_WRITE_BUFFER_2_REG (1)\n#define BHY_WRITE_BUFFER_3_REG (2)\n#define BHY_WRITE_BUFFER_4_REG (3)\n#define BHY_WRITE_BUFFER_5_REG (4)\n#define BHY_WRITE_BUFFER_6_REG (5)\n#define BHY_WRITE_BUFFER_7_REG (6)\n#define BHY_WRITE_BUFFER_8_REG (7)\n\n#define BHY_READ_BUFFER_SIZE (16)\n#define BHY_READ_BUFFER_1_REG (0)\n#define BHY_READ_BUFFER_2_REG (1)\n#define BHY_READ_BUFFER_3_REG (2)\n#define BHY_READ_BUFFER_4_REG (3)\n#define BHY_READ_BUFFER_5_REG (4)\n#define BHY_READ_BUFFER_6_REG (5)\n#define BHY_READ_BUFFER_7_REG (6)\n#define BHY_READ_BUFFER_8_REG (7)\n#define BHY_READ_BUFFER_9_REG (8)\n#define BHY_READ_BUFFER_10_REG (9)\n#define BHY_READ_BUFFER_11_REG (10)\n#define BHY_READ_BUFFER_12_REG (11)\n#define BHY_READ_BUFFER_13_REG (12)\n#define BHY_READ_BUFFER_14_REG (13)\n#define BHY_READ_BUFFER_15_REG (14)\n#define BHY_READ_BUFFER_16_REG (15)\n\n#define BHY_FIFO_SENSOR_DATA_SIZE (100)\n/****************************************************/\n/**\\name ERROR CODES */\n/***************************************************/\n\n#define BHY_NULL_PTR ((void *) 0)\n#define BHY_NULL ((u8)0)\n#define BHY_COMM_RES ((s8)-1)\n#define BHY_OUT_OF_RANGE ((s8)-2)\n#define BHY_SUCCESS ((u8)0)\n#define BHY_ERROR ((s8)-3)\n#define BHY_RAMPATCH_NOT_MATCH ((s8)-4)\n#define BHY_RAMPATCH_NOT_SUPPORT ((s8)-5)\n#define BHY_CRC_ERROR ((s8)-6)\n#define BHY_PRODUCT_ID_ERROR ((s8)-7)\n\n/* Constants */\n#define BHY_DELAY_SETTLING_TIME (5)\n#define BHY_FIFO_BUFFER_SIZE (50)\n/*This refers BHY return type as s8 */\n#define BHY_RETURN_FUNCTION_TYPE s8\n/****************************************************/\n/**\\name REGISTER DEFINITIONS */\n/***************************************************/\n/****************************************************/\n/**\\name I2C REGISTER MAP DEFINITIONS */\n/***************************************************/\n/* i2c buffer read for sensor fifo data*/\n#define BHY_I2C_REG_BUFFER_ZERO_ADDR (0x00)\n#define BHY_I2C_REG_BUFFER_END_ADDR (0x31)\n#define BHY_I2C_REG_BUFFER_LENGTH ((BHY_I2C_REG_BUFFER_END_ADDR) - (BHY_I2C_REG_BUFFER_ZERO_ADDR) + 1)\n/* fifo flush, chip control and status registers*/\n#define BHY_I2C_REG_FIFO_FLUSH_ADDR (0x32)\n#define BHY_I2C_REG_CHIP_CONTROL_ADDR (0x34)\n#define BHY_I2C_REG_HOST_STATUS_ADDR (0x35)\n#define BHY_I2C_REG_INT_STATUS_ADDR (0x36)\n#define BHY_I2C_REG_CHIP_STATUS_ADDR (0x37)\n/* bytes remaining register*/\n#define BHY_I2C_REG_BYTES_REMAINING_LSB_ADDR (0x38)\n#define BHY_I2C_REG_BYTES_REMAINING_MSB_ADDR (0x39)\n#define BHY_I2C_REG_PARAMETER_ACKNOWLEDGE_ADDR (0x3A)\n/* saved parameter */\n#define BHY_I2C_REG_PARAMETER_READ_BUFFER_ZERO (0x3B)\n\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR (0x54)\n/**< parameter page selection address*/\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR (0x55)\n/**< host interface control address*/\n/*!\n * @brief parameter write buffer*/\n#define BHY_I2C_REG_PARAMETER_WRITE_BUFFER_ZERO (0x5C)\n#define BHY_I2C_REG_PARAMETER_REQUEST_ADDR (0x64)\n/**< used to select the respective parameter number*/\n\n/* product and revision id */\n#define BHY_BHY_HOST_IRQ_TIMESTAMP_ADDR (0x6C)\n/**< host IRQ time stamp address*/\n#define BHY_ROM_VERSION_ADDR (0x70)\n/**< ROM version address*/\n#define BHY_RAM_VERSION_ADDR (0x72)\n/**< RAM version address*/\n#define BHY_I2C_REG_PRODUCT_ID_ADDR (0x90)\n/**< product id address*/\n#define BHY_I2C_REG_REVISION_ID_ADDR (0x91)\n/**< revision id address*/\n#define BHY_I2C_REG_UPLOAD_0_ADDR (0x94)\n#define BHY_I2C_REG_UPLOAD_1_ADDR (0x95)\n/**< upload address for RAM patch*/\n#define BHY_I2C_REG_UPLOAD_DATA_ADDR (0x96)\n/**< upload data address for RAM patch*/\n#define BHY_I2C_REG_CRC_HOST_ADDR (0x97)\n/**< CRC register*/\n#define BHY_I2C_REG_RESET_REQUEST_ADDR (0x9B)\n/**< reset register*/\n/****************************************************/\n/**\\name ARRAY DEFINITIONS FOR IRQ TIME STAMP*/\n/**************************************************************/\n#define BHY_HOST_IRQ_TIMESTAMP_SIZE (4)\n#define BHY_HOST_IRQ_TIMESTAMP_LSB_DATA (0)\n#define BHY_HOST_IRQ_TIMESTAMP_XLSB_DATA (1)\n#define BHY_HOST_IRQ_TIMESTAMP_XXLSB_DATA (2)\n#define BHY_HOST_IRQ_TIMESTAMP_MSB_DATA (3)\n/****************************************************/\n/**\\name ARRAY DEFINITIONS FOR ROM VERSION*/\n/**************************************************************/\n#define BHY_ROM_VERSION_SIZE (2)\n#define BHY_ROM_VERSION_LSB_DATA (0)\n#define BHY_ROM_VERSION_MSB_DATA (1)\n\n#define BHY_RAM_VERSION_SIZE (2)\n#define BHY_RAM_VERSION_LSB_DATA (0)\n#define BHY_RAM_VERSION_MSB_DATA (1)\n#define BHY_FIFO_DATA_BUFFER (200)\n\n#define BHY_ROM_VERSION_DI01 (u16)(0x2112)\n//#define BHY_ROM_VERSION_DI02 (u16)(0x2112) //DI02 is not supported\n#define BHY_ROM_VERSION_DI03 (u16)(0x2DAD)\n/**************************************************************/\n/**\\name STRUCTURE DEFINITIONS */\n/**************************************************************/\n/*!\n* @brief BHY structure\n* This structure holds all relevant information about BHY\n*/\nstruct bhy_t {\nu8 product_id;/**< product id of BHY */\nu8 device_addr;/**< device address of BHY */\nBHY_WR_FUNC_PTR;/**< bus write function pointer\nused to map the user bus write functions*/\nBHY_RD_FUNC_PTR;/**< bus read function pointer\nused to map the user bus read functions*/\nBHY_BRD_FUNC_PTR;/**< burst read function pointer\nused to map the user burst read functions*/\nvoid (*delay_msec)(BHY_MDELAY_DATA_TYPE);/**< delay function pointer */\n};\n/*!\n* @brief BHY parameter read buffer\n* structure holds all relevant information about\n* the respective parameter bytes data\n*/\nstruct parameter_read_buffer_t {\nu8 parameter_1;/**<parameter bytes 1*/\nu8 parameter_2;/**<parameter bytes 1*/\nu8 parameter_3;/**<parameter bytes 1*/\nu8 parameter_4;/**<parameter bytes 1*/\nu8 parameter_5;/**<parameter bytes 1*/\nu8 parameter_6;/**<parameter bytes 1*/\nu8 parameter_7;/**<parameter bytes 1*/\nu8 parameter_8;/**<parameter bytes 1*/\nu8 parameter_9;/**<parameter bytes 1*/\nu8 parameter_10;/**<parameter bytes 1*/\nu8 parameter_11;/**<parameter bytes 1*/\nu8 parameter_12;/**<parameter bytes 1*/\nu8 parameter_13;/**<parameter bytes 1*/\nu8 parameter_14;/**<parameter bytes 1*/\nu8 parameter_15;/**<parameter bytes 1*/\nu8 parameter_16;/**<parameter bytes 1*/\n};\n/*!\n* @brief BHY load parameter bytes structure\n* This structure holds all relevant information about BHY\n* load parameter bytes\n*/\nstruct parameter_write_buffer_t {\nu8 write_parameter_byte1;/**<parameter byte 1*/\nu8 write_parameter_byte2;/**<parameter byte 2*/\nu8 write_parameter_byte3;/**<parameter byte 3*/\nu8 write_parameter_byte4;/**<parameter byte 4*/\nu8 write_parameter_byte5;/**<parameter byte 5*/\nu8 write_parameter_byte6;/**<parameter byte 6*/\nu8 write_parameter_byte7;/**<parameter byte 7*/\nu8 write_parameter_byte8;/**<parameter byte 8*/\n};\n/*!\n* @brief meta event interrupt structure\n* This structure holds meta event\n* interrupt details\n*/\nstruct meta_event_intr_t {\nu8 meta_event1_intr;/**< Meta event1 interrupt */\nu8 meta_event2_intr;/**< Meta event2 interrupt */\nu8 meta_event3_intr;/**< Meta event3 interrupt */\nu8 meta_event4_intr;/**< Meta event4 interrupt */\nu8 meta_event5_intr;/**< Meta event5 interrupt */\nu8 meta_event6_intr;/**< Meta event6 interrupt */\nu8 meta_event7_intr;/**< Meta event7 interrupt */\nu8 meta_event8_intr;/**< Meta event8 interrupt */\nu8 meta_event9_intr;/**< Meta event9 interrupt */\nu8 meta_event10_intr;/**< Meta event10 interrupt */\nu8 meta_event11_intr;/**< Meta event11 interrupt */\nu8 meta_event12_intr;/**< Meta event12 interrupt */\nu8 meta_event13_intr;/**< Meta event13 interrupt */\nu8 meta_event14_intr;/**< Meta event14 interrupt */\nu8 meta_event15_intr;/**< Meta event15 interrupt */\nu8 meta_event16_intr;/**< Meta event16 interrupt */\nu8 meta_event17_intr;/**< Meta event17 interrupt */\nu8 meta_event18_intr;/**< Meta event18 interrupt */\nu8 meta_event19_intr;/**< Meta event19 interrupt */\nu8 meta_event20_intr;/**< Meta event20 interrupt */\nu8 meta_event21_intr;/**< Meta event21 interrupt */\nu8 meta_event22_intr;/**< Meta event22 interrupt */\nu8 meta_event23_intr;/**< Meta event23 interrupt */\nu8 meta_event24_intr;/**< Meta event24 interrupt */\nu8 meta_event25_intr;/**< Meta event25 interrupt */\nu8 meta_event26_intr;/**< Meta event26 interrupt */\nu8 meta_event27_intr;/**< Meta event27 interrupt */\nu8 meta_event28_intr;/**< Meta event28 interrupt */\nu8 meta_event29_intr;/**< Meta event29 interrupt */\nu8 meta_event30_intr;/**< Meta event30 interrupt */\nu8 meta_event31_intr;/**< Meta event31 interrupt */\nu8 meta_event32_intr;/**< Meta event32 interrupt */\n};\n/*!\n* @brief meta event Event structure\n* This structure holds meta event\n* Event details\n*/\nstruct meta_event_event_t {\nu8 meta_event1_event;/**< Meta event1 event */\nu8 meta_event2_event;/**< Meta event2 event */\nu8 meta_event3_event;/**< Meta event3 event */\nu8 meta_event4_event;/**< Meta event4 event */\nu8 meta_event5_event;/**< Meta event5 event */\nu8 meta_event6_event;/**< Meta event6 event */\nu8 meta_event7_event;/**< Meta event7 event */\nu8 meta_event8_event;/**< Meta event8 event */\nu8 meta_event9_event;/**< Meta event9 event */\nu8 meta_event10_event;/**< Meta event10 event */\nu8 meta_event11_event;/**< Meta event11 event */\nu8 meta_event12_event;/**< Meta event12 event */\nu8 meta_event13_event;/**< Meta event13 event */\nu8 meta_event14_event;/**< Meta event14 event */\nu8 meta_event15_event;/**< Meta event15 event */\nu8 meta_event16_event;/**< Meta event16 event */\nu8 meta_event17_event;/**< Meta event17 event */\nu8 meta_event18_event;/**< Meta event18 event */\nu8 meta_event19_event;/**< Meta event19 event */\nu8 meta_event20_event;/**< Meta event20 event */\nu8 meta_event21_event;/**< Meta event21 event */\nu8 meta_event22_event;/**< Meta event22 event */\nu8 meta_event23_event;/**< Meta event23 event */\nu8 meta_event24_event;/**< Meta event24 event */\nu8 meta_event25_event;/**< Meta event25 event */\nu8 meta_event26_event;/**< Meta event26 event */\nu8 meta_event27_event;/**< Meta event27 event */\nu8 meta_event28_event;/**< Meta event28 event */\nu8 meta_event29_event;/**< Meta event29 event */\nu8 meta_event30_event;/**< Meta event30 event */\nu8 meta_event31_event;/**< Meta event31 event */\nu8 meta_event32_event;/**< Meta event32 event */\n};\n/*!\n* @brief sensor status bank structure\n* This structure holds sensor status bank information\n*/\nstruct sensor_status_bank_t {\nu8 data_available;/**<contains the status bank data available information*/\nu8 i2c_nack;/**<contains the status bank i2c NACK information*/\nu8 device_id_error;/**<contains the status bank device id error information*/\nu8 transient_error;/**<contains the status bank transient error information*/\nu8 data_lost;/**<contains the status bank data loss information*/\nu8 sensor_power_mode;\n/**<contains the status bank sensor power mode information*/\n};\n/*!\n* @brief physical sensor status\n* This structure holds accel physical sensor status\n*/\nstruct accel_physical_status_t {\nu16 accel_sample_rate;/**<contains the accel sampling rate information*/\nu16 accel_dynamic_range;/**<contains the accel dynamic range information*/\nu8 accel_flag;/**<contains the accel flag information*/\n};\n/*!\n* @brief physical sensor status\n* This structure holds gyro physical sensor status\n*/\nstruct gyro_physical_status_t {\nu16 gyro_sample_rate;/**<contains the gyro sampling rate information*/\nu16 gyro_dynamic_range;/**<contains the gyro dynamic range information*/\nu8 gyro_flag;/**<contains the gyro flag information*/\n};\n/*!\n* @brief physical sensor status\n* This structure holds mag physical sensor status\n*/\nstruct mag_physical_status_t {\nu16 mag_sample_rate;/**<contains the mag sampling rate information*/\nu16 mag_dynamic_range;/**<contains the mag dynamic range information*/\nu8 mag_flag;/**<contains the mag flag information*/\n};\n/*!\n* @brief Sensor information\n* This structure holds non wakeup sensor information\n*/\nstruct sensor_information_non_wakeup_t {\nu8 non_wakeup_sensor_type;/**<contains the sensor type*/\nu8 non_wakeup_driver_id;/**<contains the driver id*/\nu8 non_wakeup_driver_version;/**<contains the driver version*/\nu8 non_wakeup_power;/**<contains the power example 0.1mA*/\nu16 non_wakeup_max_range;\n/**<contains the maxim range of sensor data in SI units*/\nu16 non_wakeup_resolution;\n/**<contains the no of bit resolution of underlying sensor*/\nu16 non_wakeup_max_rate;/**<contains the maximum rate in Hz*/\nu16 non_wakeup_fifo_reserved;/**< contains the fifo size*/\nu16 non_wakeup_fifo_max;/**< contains the entire fifo size*/\nu8 non_wakeup_event_size;/**< contains the no of bytes sensor data packet*/\nu8 non_wakeup_min_rate;/**<contains the minimum rate in Hz*/\n};\n/*!\n* @brief Sensor information\n* This structure holds wakeup sensor information\n*/\nstruct sensor_information_wakeup_t {\nu8 wakeup_sensor_type;/**<contains the sensor type*/\nu8 wakeup_driver_id;/**<contains the driver id*/\nu8 wakeup_driver_version;/**<contains the driver version*/\nu8 wakeup_power;/**<contains the power example 0.1mA*/\nu16 wakeup_max_range;\n/**<contains the maxim range of sensor data in SI units*/\nu16 wakeup_resolution;\n/**<contains the no of bit resolution of underlying sensor*/\nu16 wakeup_max_rate;/**<contains the maximum rate in Hz*/\nu16 wakeup_fifo_reserved;/**< contains the fifo size*/\nu16 wakeup_fifo_max;/**< contains the entire fifo size*/\nu8 wakeup_event_size;/**< contains the no of bytes sensor data packet*/\nu8 wakeup_min_rate;/**<contains the minimum rate in Hz*/\n};\n/*!\n* @brief Sensor configuration\n* This structure holds non wakeup sensor configuration\n*/\nstruct sensor_configuration_non_wakeup_t {\nu16 non_wakeup_sample_rate;/**<contains the sample rate information*/\nu16 non_wakeup_max_report_latency;/**<contains the maximum report latency*/\nu16 non_wakeup_change_sensitivity;/**<contains the sensitivity*/\nu16 non_wakeup_dynamic_range;/**<contains the dynamic range*/\n};\n/*!\n* @brief Sensor configuration\n* This structure holds wakeup sensor configuration\n*/\nstruct sensor_configuration_wakeup_t {\nu16 wakeup_sample_rate;/**<contains the sample rate information*/\nu16 wakeup_max_report_latency;/**<contains the maximum report latency*/\nu16 wakeup_change_sensitivity;/**<contains the sensitivity*/\nu16 wakeup_dynamic_range;/**<contains the dynamic range*/\n};\n/*!\n* @brief Sensor configuration\n* This structure holds soft pass through informations\n*/\nstruct soft_pass_through_read_t {\nu8 i2c_slave_address;/**< contain the value of I2C slave address*/\nu8 start_register;/**< contain the value of start register*/\nu8 read_length;/**< contain the value of read length*/\nu8 completion_status;/**< contain the value of completion status*/\nu8 reg_value_byte1;/**< contain the value of returned register value1*/\nu8 reg_value_byte2;/**< contain the value of returned register value2*/\nu8 reg_value_byte3;/**< contain the value of returned register value3*/\nu8 reg_value_byte4;/**< contain the value of returned register value4*/\n};\n/*!\n* @brief Sensor configuration\n* This structure holds write soft pass through informations\n*/\nstruct soft_pass_through_write_t {\nu8 i2c_slave_address;/**< contain the value of I2C slave address*/\nu8 start_register;/**< contain the value of start register*/\nu8 write_length;/**< contain the value of read length*/\nu8 completion_status;/**< contain the value of completion status*/\nu8 reg_value_byte1;/**< contain the value of returned register value1*/\nu8 reg_value_byte2;/**< contain the value of returned register value2*/\nu8 reg_value_byte3;/**< contain the value of returned register value3*/\nu8 reg_value_byte4;/**< contain the value of returned register value4*/\n};\n\n\n/**************************************************************/\n/**\\name COMMON STRUCTURE FOR DATA PROCESSING */\n/**************************************************************/\n/*!\n* @brief used for x,y,z and accuracy status\n* data processing\n*/\nstruct xyz_accuracy_t {\ns16 x;/**<contains the\nx axis data */\ns16 y;/**<contains the\ny axis data */\ns16 z;/**<contains the\nz axis data */\nu8 accuracy;/**<contains the\naccuracy data */\n};\n/*!\n* @brief used for x,y,z,w and radians status\n* data processing\n*/\nstruct xyzw_radians_t {\ns16 x;/**<contains the\nx axis data */\ns16 y;/**<contains the\ny axis data */\ns16 z;/**<contains the\nz axis data */\ns16 w;/**<contains the\nw axis data */\ns16 radians;/**<contains the\nradians data */\n};\n/*!\n* @brief used for only one data validation of unsigned integer\n* like light,humidity,proximity,step counter\n* activity and time stamp.\n*/\nstruct fifo_size_two_t {\nu16 data_process;/**< value of unsigned processed data*/\n};\n/*!\n* @brief used for processing the temperature data\n*/\nstruct process_temperature_t {\ns16 temperature;/**< value of temperature data*/\n};\n/*!\n* @brief used for processing the meta events\n*/\nstruct process_meta_event_t {\nu8 event_number;/**< value of meta event number*/\nu8 sensor_type;/**< value of sensor type*/\nu8 event_spec;/**< value of event specific value*/\n};\n/*!\n* @brief used for processing the uncalib\n* mag and gyro data\n*/\nstruct uncalib_bias_t {\ns16 uncalib_x;/**<contains the signed 16bit uncalib x data*/\ns16 uncalib_y;/**<contains the signed 16bit uncalib y data*/\ns16 uncalib_z;/**<contains the signed 16bit uncalib z data*/\ns16 bias_x;/**<contains the signed 16bit bias x data*/\ns16 bias_y;/**<contains the signed 16bit bias y data*/\ns16 bias_z;/**<contains the signed 16bit bias z data*/\nu8 accuracy;/**<contains the signed\n16bit estimation accuracy data*/\n};\n/*!\n* @brief used for processing the activity data\n*/\nstruct activity_t {\nu8 bit_on;/**< value of activity bits on*/\nu8 bit_off;/**< value of activity bits off*/\n};\n/*!\n* @brief barometer data\n*/\nstruct barometer_process_t {\nu32 barometer;/**<contains the\n24 bit unsigned barometer data*/\n};\n/*!\n* @brief processing the one byte data\n* like heart rate\n*/\nstruct heart_rate_data_process_t {\nu8 data;/**<contains the\none byte data data*/\n};\n/*!\n* @brief used to process BSX_A, BSX_B and BSX_C data\n*/\nstruct bsx_process_data_t {\ns32 x;/**<contains the signed 32bit x data*/\ns32 y;/**<contains the signed 32bit y data*/\ns32 z;/**<contains the signed 32bit z data*/\nu32 timestamp;/**<contains the signed 32 bit time stamp data*/\nu8 vector;/**< contains the accuracy data*/\n};\n/**************************************************************/\n/**\\name FIFO INDEX DEFINITION */\n/**************************************************************/\n#define BHY_SENSOR_ID_INDEX (1)\n\n/* rotational vector data */\n#define BHY_RVECTOR_X_LSB_DATA (0)\n#define BHY_RVECTOR_X_MSB_DATA (1)\n#define BHY_RVECTOR_Y_LSB_DATA (2)\n#define BHY_RVECTOR_Y_MSB_DATA (3)\n#define BHY_RVECTOR_Z_LSB_DATA (4)\n#define BHY_RVECTOR_Z_MSB_DATA (5)\n#define BHY_RVECTOR_W_LSB_DATA (6)\n#define BHY_RVECTOR_W_MSB_DATA (7)\n#define BHY_RVECTOR_ACCURACY_LSB_DATA (8)\n#define BHY_RVECTOR_ACCURACY_MSB_DATA (9)\n#define BHY_RVECTOR_LENGTH (10)\n\n/* barometer data */\n#define BHY_BAROMETER_LSB_DATA (0)\n#define BHY_BAROMETER_XLSB_DATA (1)\n#define BHY_BAROMETER_MSB_DATA (2)\n#define BHY_BAROMETER_LENGTH (3)\n#define BHY_TWO_BYTE_LENGTH (2)\n#define BHY_STEP_AMBIENT_TEMPERATURE_MSB_DATA (1)\n#define BHY_STEP_AMBIENT_TEMPERATURE_LSB_DATA (0)\n\n\n/* activity*/\n#define BHY_ACTIVITY_BIT_ON (1)\n#define BHY_ACTIVITY_BIT_OFF (0)\n#define BHY_ACTIVITY_LENGTH (2)\n\n\n/* BSX a */\n#define BHY_BSXA_X_LSB_DATA (0)\n#define BHY_BSXA_X_XLSB_DATA (1)\n#define BHY_BSXA_X_XXLSB_DATA (2)\n#define BHY_BSXA_X_MSB_DATA (3)\n#define BHY_BSXA_Y_LSB_DATA (4)\n#define BHY_BSXA_Y_XLSB_DATA (5)\n#define BHY_BSXA_Y_XXLSB_DATA (6)\n#define BHY_BSXA_Y_MSB_DATA (7)\n#define BHY_BSXA_Z_LSB_DATA (8)\n#define BHY_BSXA_Z_XLSB_DATA (9)\n#define BHY_BSXA_Z_XXLSB_DATA (10)\n#define BHY_BSXA_Z_MSB_DATA (11)\n#define BHY_BSXA_TIMESTAMP_LSB_DATA (12)\n#define BHY_BSXA_TIMESTAMP_XLSB_DATA (13)\n#define BHY_BSXA_TIMESTAMP_XXLSB_DATA (14)\n#define BHY_BSXA_TIMESTAMP_MSB_DATA (15)\n#define BHY_BSXA_VECTOR_DATA (16)\n#define BHY_BSXA_LENGTH (17)\n\n/* meta event*/\n#define BHY_BHY_META_EVENT_NUMBER (0)\n#define BHY_BHY_META_EVENT_SENSOR_TYPE (1)\n#define BHY_BHY_META_EVENT_SPEC_VALUE (2)\n#define BHY_BHY_META_EVENT_LENGTH (3)\n/* RAM PATCH definitions*/\n/* accel data */\n#define BHY_X_LSB_DATA (0)\n#define BHY_X_MSB_DATA (1)\n#define BHY_Y_LSB_DATA (2)\n#define BHY_Y_MSB_DATA (3)\n#define BHY_Z_LSB_DATA (4)\n#define BHY_Z_MSB_DATA (5)\n#define BHY_VECTOR_DATA (6)\n#define BHY_XYZ_VECTOR_LENGTH (7)\n#define INCREMENT_INDEX (1)\n#define DECREMENT_INDEX (1)\n\n#define BHY_TWO_LENGTH (2)\n#define BHY_LSB_DATA (0)\n#define BHY_MSB_DATA (1)\n#define BHY_FALSE (0)\n#define BHY_TRUE (1)\n\n/* rotational vector data */\n#define BHY_RVECTOR_X_LSB_DATA (0)\n#define BHY_RVECTOR_X_MSB_DATA (1)\n#define BHY_RVECTOR_Y_LSB_DATA (2)\n#define BHY_RVECTOR_Y_MSB_DATA (3)\n#define BHY_RVECTOR_Z_LSB_DATA (4)\n#define BHY_RVECTOR_Z_MSB_DATA (5)\n#define BHY_RVECTOR_W_LSB_DATA (6)\n#define BHY_RVECTOR_W_MSB_DATA (7)\n#define BHY_RVECTOR_ACCURACY_LSB_DATA (8)\n#define BHY_RVECTOR_ACCURACY_MSB_DATA (9)\n#define BHY_RVECTOR_LENGTH (10)\n\n/* uncalibration mag data*/\n#define BHY_UNCALIB_X_LSB_DATA (0)\n#define BHY_UNCALIB_X_MSB_DATA (1)\n#define BHY_UNCALIB_Y_LSB_DATA (2)\n#define BHY_UNCALIB_Y_MSB_DATA (3)\n#define BHY_UNCALIB_Z_LSB_DATA (4)\n#define BHY_UNCALIB_Z_MSB_DATA (5)\n#define BHY_BIAS_X_LSB_DATA (6)\n#define BHY_BIAS_X_MSB_DATA (7)\n#define BHY_BIAS_Y_LSB_DATA (8)\n#define BHY_BIAS_Y_MSB_DATA (9)\n#define BHY_BIAS_Z_LSB_DATA (10)\n#define BHY_BIAS_Z_MSB_DATA (11)\n#define BHY_UNCALIB_ACCURACY_DATA (12)\n#define BHY_UNCALIB_LENGTH (13)\n/**************************************************************/\n/**\\name CONSTANT HEX DEFINITION */\n/**************************************************************/\n#define BHY_PARAMETER_ACK_CHECK (0x80)\n#define BHY_MASK_LSB_DATA (0x00FF)\n#define BHY_MASK_MSB_DATA (0xFF00)\n#define BHY_SIC_MASK_MSB_DATA (0x000000FF)\n#define BHY_SIC_MASK_LSB_DATA (0x0000FF00)\n#define BHY_SIC_MASK_LSB1_DATA (0x00FF0000)\n#define BHY_SIC_MASK_LSB2_DATA (0xFF000000)\n#define BHY_MASK_META_EVENT (0xFF)\n\n/**************************************************************/\n/**\\name PAGE SELECTION DEFINITION */\n/**************************************************************/\n#define BHY_PAGE_1 (0x01)\n/**< page 1 system page*/\n#define BHY_PAGE_2 (0x02)\n/**< page 2 system page*/\n#define BHY_PAGE_3 (0x03)\n/**< page 3 sensor page*/\n#define BHY_PAGE_15 (0x0F)\n/**< page 15 sensor page*/\n/**************************************************************/\n/**\\name READ PARAMETER REQUEST */\n/**************************************************************/\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_0 (0x00)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_1 (0x01)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_2 (0x02)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_3 (0x03)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_4 (0x04)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_5 (0x05)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_6 (0x06)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_7 (0x07)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_8 (0x08)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_9 (0x09)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_10 (0x0A)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_11 (0x0B)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_12 (0x0C)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_13 (0x0D)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_14 (0x0E)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_15 (0x0F)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_16 (0x10)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_17 (0x11)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_18 (0x12)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_19 (0x13)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_20 (0x14)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_21 (0x15)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_22 (0x16)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_23 (0x17)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_24 (0x18)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_25 (0x19)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_30 (0x1E)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_31 (0x1F)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_33 (0x21)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_34 (0x22)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_35 (0x23)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_36 (0x24)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_37 (0x25)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_38 (0x26)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_39 (0x27)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_40 (0x28)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_41 (0x29)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_42 (0x2A)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_43 (0x2B)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_44 (0x2C)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_45 (0x2D)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_46 (0x2E)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_47 (0x2F)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_48 (0x30)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_49 (0x31)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_50 (0x32)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_51 (0x33)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_52 (0x34)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_53 (0x35)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_54 (0x36)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_55 (0x37)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_56 (0x38)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_57 (0x39)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_63 (0x3F)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_64 (0x40)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_65 (0x41)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_66 (0x42)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_67 (0x43)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_68 (0x44)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_73 (0x49)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_74 (0x4A)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_75 (0x4B)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_76 (0x4C)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_77 (0x4D)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_78 (0x4E)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_79 (0x4F)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_80 (0x50)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_81 (0x51)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_82 (0x52)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_83 (0x53)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_84 (0x54)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_86 (0x56)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_87 (0x57)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_88 (0x58)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_89 (0x59)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_95 (0x5F)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_97 (0x61)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_98 (0x62)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_99 (0x63)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_100 (0x64)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_101 (0x65)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_102 (0x66)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_103 (0x67)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_104 (0x68)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_105 (0x69)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_106 (0x6A)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_107 (0x6B)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_108 (0x6C)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_109 (0x6D)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_110 (0x6E)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_111 (0x6F)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_112 (0x70)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_113 (0x71)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_114 (0x72)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_115 (0x73)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_116 (0x74)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_117 (0x75)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_118 (0x76)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_119 (0x77)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_120 (0x78)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_121 (0x79)\n#define BHY_PARAMETER_REQUEST_READ_PARAMETER_127 (0x7F)\n/**************************************************************/\n/**\\name WRITE PARAMETER REQUEST */\n/**************************************************************/\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_0 (0x80)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 (0x81)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 (0x82)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 (0x83)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_4 (0x84)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_5 (0x85)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_6 (0x86)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_7 (0x87)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_8 (0x88)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_9 (0x89)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_10 (0x8A)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_11 (0x8B)\n/* non wakeup sensor configuration*/\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_64 (0xC0)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_65 (0xC1)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_66 (0xC2)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_67 (0xC3)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_68 (0xC4)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_69 (0xC5)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_70 (0xC6)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_71 (0xC7)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_72 (0xC8)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_73 (0xC9)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_74 (0xCA)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_75 (0xCB)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_76 (0xCC)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_77 (0xCD)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_78 (0xCE)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_79 (0xCF)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_80 (0xD0)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_81 (0xD1)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_82 (0xD2)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_83 (0xD3)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_84 (0xD4)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_85 (0xD5)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_86 (0xD6)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_87 (0xD7)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_88 (0xD8)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_89 (0xD9)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_90 (0xDA)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_95 (0xDF)\n/* wakeup sensor configuration*/\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_97 (0xE1)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_98 (0xE2)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_99 (0xE3)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_100 (0xE4)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_101 (0xE5)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_102 (0xE6)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_103 (0xE7)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_104 (0xE8)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_105 (0xE9)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_106 (0xEA)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_107 (0xEB)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_108 (0xEC)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_109 (0xED)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_110 (0xEE)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_111 (0xEF)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_112 (0xF0)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_113 (0xF1)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_114 (0xF2)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_115 (0xF3)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_116 (0xF4)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_117 (0xF5)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_118 (0xF6)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_119 (0xF7)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_120 (0xF8)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_121 (0xF9)\n#define BHY_PARAMETER_REQUEST_WRITE_PARAMETER_127 (0xFF)\n\n/****************************************************/\n/**\\name DEFINITIONS FOR PARAM PAGE BHY_PAGE_2 ITEMS */\n/**************************************************************/\n#define PAGE2_SIC_MATRIX_0_1 1 /* X1, X2 */\n#define PAGE2_SIC_MATRIX_2_3 2 /* X3, Y1 */\n#define PAGE2_SIC_MATRIX_4_5 3 /* Y2, Y2 */\n#define PAGE2_SIC_MATRIX_6_7 4 /* Z1, Z2 */\n#define PAGE2_SIC_MATRIX_8 5 /* Z3, */\n\n#define PAGE2_CUS_FIRMWARE_VERSION 125 /* return CUS SDK version information */\n#define PAGE2_BSX_VERSION 126 /* return BSX library version information */\n\n\nstruct cus_version_t\n{\n\tu8 minor; /**< minor version */\n\tu8 major; /**< major version */\n\ts16 base; /**< base version, same as ram_version */\n};\n\n/**************************************************************/\n/**\\name BIT MASK DEFINITION FOR META EVENTS */\n/**************************************************************/\n#define BHY_META_EVENT1_INTR_ENABLE (0x01)\n#define BHY_META_EVENT1_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT2_INTR_ENABLE (0x04)\n#define BHY_META_EVENT2_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT3_INTR_ENABLE (0x10)\n#define BHY_META_EVENT3_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT4_INTR_ENABLE (0x40)\n#define BHY_META_EVENT4_EVENT_ENABLE (0x80)\n\n#define BHY_META_EVENT5_INTR_ENABLE (0x01)\n#define BHY_META_EVENT5_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT6_INTR_ENABLE (0x04)\n#define BHY_META_EVENT6_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT7_INTR_ENABLE (0x10)\n#define BHY_META_EVENT7_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT8_INTR_ENABLE (0x40)\n#define BHY_META_EVENT8_EVENT_ENABLE (0x80)\n\n#define BHY_META_EVENT9_INTR_ENABLE (0x01)\n#define BHY_META_EVENT9_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT10_INTR_ENABLE (0x04)\n#define BHY_META_EVENT10_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT11_INTR_ENABLE (0x10)\n#define BHY_META_EVENT11_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT12_INTR_ENABLE (0x40)\n#define BHY_META_EVENT12_EVENT_ENABLE (0x80)\n\n#define BHY_META_EVENT13_INTR_ENABLE (0x01)\n#define BHY_META_EVENT13_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT14_INTR_ENABLE (0x04)\n#define BHY_META_EVENT14_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT15_INTR_ENABLE (0x10)\n#define BHY_META_EVENT15_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT16_INTR_ENABLE (0x40)\n#define BHY_META_EVENT16_EVENT_ENABLE (0x80)\n\n#define BHY_META_EVENT17_INTR_ENABLE (0x01)\n#define BHY_META_EVENT17_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT18_INTR_ENABLE (0x04)\n#define BHY_META_EVENT18_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT19_INTR_ENABLE (0x10)\n#define BHY_META_EVENT19_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT20_INTR_ENABLE (0x40)\n#define BHY_META_EVENT20_EVENT_ENABLE (0x80)\n\n#define BHY_META_EVENT21_INTR_ENABLE (0x01)\n#define BHY_META_EVENT21_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT22_INTR_ENABLE (0x04)\n#define BHY_META_EVENT22_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT23_INTR_ENABLE (0x10)\n#define BHY_META_EVENT23_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT24_INTR_ENABLE (0x40)\n#define BHY_META_EVENT24_EVENT_ENABLE (0x80)\n\n#define BHY_META_EVENT25_INTR_ENABLE (0x01)\n#define BHY_META_EVENT25_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT26_INTR_ENABLE (0x04)\n#define BHY_META_EVENT26_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT27_INTR_ENABLE (0x10)\n#define BHY_META_EVENT27_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT28_INTR_ENABLE (0x40)\n#define BHY_META_EVENT28_EVENT_ENABLE (0x80)\n\n#define BHY_META_EVENT29_INTR_ENABLE (0x01)\n#define BHY_META_EVENT29_EVENT_ENABLE (0x02)\n\n#define BHY_META_EVENT30_INTR_ENABLE (0x04)\n#define BHY_META_EVENT30_EVENT_ENABLE (0x08)\n\n#define BHY_META_EVENT31_INTR_ENABLE (0x10)\n#define BHY_META_EVENT31_EVENT_ENABLE (0x20)\n\n#define BHY_META_EVENT32_INTR_ENABLE (0x40)\n#define BHY_META_EVENT32_EVENT_ENABLE (0x80)\n\n/**************************************************************/\n/**\\name BIT MASK DEFINITION FOR SENSOR BANKS */\n/**************************************************************/\n#define BHY_SENSOR_BANK_STATUS_DATA_AVAILABLE (0x01)\n#define BHY_SENSOR_BANK_STATUS_I2C_NACK (0x02)\n#define BHY_SENSOR_BANK_STATUS_DEVICE_ID_ERROR (0x04)\n#define BHY_SENSOR_BANK_STATUS_TRANSIENT_ERROR (0x08)\n#define BHY_SENSOR_BANK_STATUS_DATA_LOST (0x10)\n#define BHY_SENSOR_BANK_STATUS_POWER_MODE (0xE0)\n#define BHY_POWER_MODE_SENSOR_NOT_PRESENT (0x00)\n#define BHY_POWER_MODE_POWER_DOWN (0x01)\n#define BHY_POWER_MODE_POWER_SUSPEND (0x02)\n#define BHY_POWER_MODE_POWER_SELFTEST (0x03)\n#define BHY_POWER_MODE_POWER_INTR_MOTION (0x04)\n#define BHY_POWER_MODE_POWER_ONE_SHOT (0x05)\n#define BHY_POWER_MODE_POWER_LOW_POWER (0x06)\n#define BHY_POWER_MODE_POWER_ACTIVE (0x07)\n#define BHY_SIGNATURE_1 (0)\n#define BHY_SIGNATURE_2 (1)\n#define BHY_SIG_FLAG_1_POS (2)\n#define BHY_SIG_FLAG_2_POS (3)\n#define BHY_SIGNATURE_LENGTH (16)\n#define BHY_RAM_WRITE_LENGTH (4)\n#define BHY_RAM_WRITE_LENGTH_API (32)\n#define BHY_CHIP_CTRL_ENABLE_1 (0x02)\n#define BHY_CHIP_CTRL_ENABLE_2 (0x01)\n#define BHY_UPLOAD_DATA (0x00)\n#define BHY_RESET_ENABLE (0x01)\n#define BHY_INIT_READ_BYTES (19)\n#define BHY_INIT_BYTE_MINUS_ONE (1)\n#define BHY_CHECK_BYTE (3)\n#define BHY_IMAGE_SIGNATURE1 (0x2A)\n#define BHY_IMAGE_SIGNATURE2 (0x65)\n#define BHY_GET_ROMVEREXP(bhy_sig_flag) ((bhy_sig_flag>>11)&0x03)\n#define BHY_ROM_VER_ANY (0x00)\n#define BHY_ROM_VER_DI01 (0x01)\n#define BHY_ROM_VER_DI02 (0x02)\n#define BHY_ROM_VER_DI03 (0x03)\n/**************************************************************/\n/**\\name META EVENT DEFINITION */\n/**************************************************************/\n#define BHY_META_EVENT_1 (1)\n#define BHY_META_EVENT_2 (2)\n#define BHY_META_EVENT_3 (3)\n#define BHY_META_EVENT_4 (4)\n#define BHY_META_EVENT_5 (5)\n#define BHY_META_EVENT_6 (6)\n#define BHY_META_EVENT_7 (7)\n#define BHY_META_EVENT_8 (8)\n#define BHY_META_EVENT_9 (9)\n#define BHY_META_EVENT_10 (10)\n#define BHY_META_EVENT_11 (11)\n#define BHY_META_EVENT_12 (12)\n#define BHY_META_EVENT_13 (13)\n#define BHY_META_EVENT_14 (14)\n#define BHY_META_EVENT_15 (15)\n#define BHY_META_EVENT_16 (16)\n#define BHY_META_EVENT_17 (17)\n#define BHY_META_EVENT_18 (18)\n#define BHY_META_EVENT_19 (19)\n#define BHY_META_EVENT_20 (20)\n#define BHY_META_EVENT_21 (21)\n#define BHY_META_EVENT_22 (22)\n#define BHY_META_EVENT_23 (23)\n#define BHY_META_EVENT_24 (24)\n#define BHY_META_EVENT_25 (25)\n#define BHY_META_EVENT_26 (26)\n#define BHY_META_EVENT_27 (27)\n#define BHY_META_EVENT_28 (28)\n#define BHY_META_EVENT_29 (29)\n#define BHY_META_EVENT_30 (30)\n#define BHY_META_EVENT_31 (31)\n#define BHY_META_EVENT_32 (32)\n/**************************************************************/\n/**\\name SENSOR ID DEFINITION FOR NON WAKEUP*/\n/**************************************************************/\n#define BHY_NON_WAKEUP_ROTATION_VECTOR (11)\n#define BHY_NON_WAKEUP_GAME_ROTATION_VECTOR (15)\n#define BHY_NON_WAKEUP_GEOMAG_ROTATION_VECTOR (20)\n#define BHY_NON_WAKEUP_ACCELR (1)\n#define BHY_NON_WAKEUP_MAG (2)\n#define BHY_NON_WAKEUP_ORIENTATION (3)\n#define BHY_NON_WAKEUP_GYRO (4)\n#define BHY_NON_WAKEUP_GRAVITY (9)\n#define BHY_NON_WAKEUP_LINEAR_ACCEL (10)\n#define BHY_NON_WAKEUP_LIGHT (5)\n#define BHY_NON_WAKEUP_PROXIMITY (8)\n#define BHY_NON_WAKEUP_HUMIDITY (12)\n#define BHY_NON_WAKEUP_STEP_COUNTER (19)\n#define BHY_NON_WAKEUP_TEMPERATURE (7)\n#define BHY_NON_WAKEUP_AMBIENT_TEMPERATURE (13)\n#define BHY_NON_WAKEUP_BAROMETER (6)\n#define BHY_NON_WAKEUP_SIGNIFICANT_MOTION (17)\n#define BHY_NON_WAKEUP_STEP_DETECTOR (18)\n#define BHY_NON_WAKEUP_TILT_DETECTOR (22)\n#define BHY_NON_WAKEUP_WAKE_GESTURE (23)\n#define BHY_NON_WAKEUP_GLANCE_GESTURE (24)\n#define BHY_NON_WAKEUP_PICKUP_GESTURE (25)\n#define BHY_NON_WAKEUP_UNCALIB_MAG (14)\n#define BHY_NON_WAKEUP_UNCALIB_GYRO (16)\n#define BHY_NON_WAKEUP_HEART_RATE (21)\n#define BHY_NON_WAKEUP_ACTIVITY (31)\n#define BHY_NON_WAKEUP_BSX_C (249)\n#define BHY_NON_WAKEUP_BSX_B (250)\n#define BHY_NON_WAKEUP_BSX_A (251)\n#define BHY_NON_WAKEUP_TIMESTAMP_LSW (252)\n#define BHY_NON_WAKEUP_TIMESTAMP_MSW (253)\n#define BHY_NON_WAKEUP_META_EVENTS (254)\n\n/**************************************************************/\n/**\\name SENSOR ID DEFINITION FOR WAKEUP*/\n/**************************************************************/\n#define BHY_WAKEUP_ROTATION_VECTOR (43)\n#define BHY_WAKEUP_GAME_ROTATION_VECTOR (47)\n#define WAKEUP_GEOMAG_ROTATION_VECTOR (52)\n#define BHY_WAKEUP_ACCEL (33)\n#define BHY_WAKEUP_MAG (34)\n#define BHY_WAKEUP_ORIENTATION (35)\n#define BHY_WAKEUP_GYRO (36)\n#define BHY_WAKEUP_GRAVITY (41)\n#define BHY_WAKEUP_LINEAR_ACCEL (42)\n#define BHY_WAKEUP_LIGHT (37)\n#define BHY_WAKEUP_PROXIMITY (40)\n#define BHY_WAKEUP_HUMIDITY (44)\n#define BHY_WAKEUP_STEP_COUNTER (51)\n#define BHY_WAKEUP_TEMPERATURE (39)\n#define BHY_WAKEUP_AMBIENT_TEMPERATURE (45)\n#define BHY_WAKEUP_BAROMETER (38)\n#define BHY_WAKEUP_SIGNIFICANT_MOTION (49)\n#define BHY_WAKEUP_STEP_DETECTOR (50)\n#define BHY_WAKEUP_TILT_DETECTOR (54)\n#define BHY_WAKEUP_WAKE_GESTURE (55)\n#define BHY_WAKEUP_GLANCE_GESTURE (56)\n#define BHY_WAKEUP_PICKUP_GESTURE (57)\n#define BHY_WAKEUP_UNCALIB_MAG (46)\n#define BHY_WAKEUP_UNCALIB_GYRO (48)\n#define BHY_WAKEUP_HEART_RATE (53)\n#define BHY_WAKEUP_ACTIVITY (63)\n#define BHY_WAKEUP_TIMESTAMP_LSW (246)\n#define BHY_WAKEUP_TIMESTAMP_MSW (247)\n#define BHY_WAKEUP_META_EVENTS (248)\n/**************************************************************/\n/**\\name USER DATA REGISTERS DEFINITION START */\n/**************************************************************/\n\n/**************************************************************/\n/**\\name FIFO FLUSH LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_FIFO_FLUSH__POS (0)\n#define BHY_I2C_REG_FIFO_FLUSH__MSK (0xFF)\n#define BHY_I2C_REG_FIFO_FLUSH__LEN (8)\n#define BHY_I2C_REG_FIFO_FLUSH__REG (BHY_I2C_REG_FIFO_FLUSH_ADDR)\n/**************************************************************/\n/**\\name CHIP CONTROL LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_CHIP_CONTROL__POS (0)\n#define BHY_I2C_REG_CHIP_CONTROL__MSK (0xFF)\n#define BHY_I2C_REG_CHIP_CONTROL__LEN (8)\n#define BHY_I2C_REG_CHIP_CONTROL__REG \\\n(BHY_I2C_REG_CHIP_CONTROL_ADDR)\n/**************************************************************/\n/**\\name HOST STATUS LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_HOST_STATUS__POS (0)\n#define BHY_I2C_REG_HOST_STATUS__MSK (0xFF)\n#define BHY_I2C_REG_HOST_STATUS__LEN (8)\n#define BHY_I2C_REG_HOST_STATUS__REG (BHY_I2C_REG_HOST_STATUS_ADDR)\n\n#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__POS (1)\n#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__MSK (0x02)\n#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__LEN (1)\n#define BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY__REG \\\n(BHY_I2C_REG_HOST_STATUS_ADDR)\n\n#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__POS (2)\n#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__MSK (0x1C)\n#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__LEN (3)\n#define BHY_I2C_REG_BHY_HOST_INTERFACE_ID__REG \\\n(BHY_I2C_REG_HOST_STATUS_ADDR)\n\n#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__POS (5)\n#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__MSK (0xE0)\n#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__LEN (3)\n#define BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID__REG \\\n(BHY_I2C_REG_HOST_STATUS_ADDR)\n/**************************************************************/\n/**\\name INTERRUPT STATUS LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_INT_STATUS__POS (0)\n#define BHY_I2C_REG_INT_STATUS__MSK (0xFF)\n#define BHY_I2C_REG_INT_STATUS__LEN (8)\n#define BHY_I2C_REG_INT_STATUS__REG (BHY_I2C_REG_INT_STATUS_ADDR)\n\n#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__POS (0)\n#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__MSK (0x01)\n#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__LEN (1)\n#define BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR__REG (BHY_I2C_REG_INT_STATUS_ADDR)\n\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__POS (1)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__MSK (0x02)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__LEN (1)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM__REG \\\n(BHY_I2C_REG_INT_STATUS_ADDR)\n\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__POS (2)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__MSK (0x04)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__LEN (1)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY__REG \\\n(BHY_I2C_REG_INT_STATUS_ADDR)\n\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__POS (3)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__MSK (0x08)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__LEN (1)\n#define BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE__REG \\\n(BHY_I2C_REG_INT_STATUS_ADDR)\n\n#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__POS (4)\n#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__MSK (0x10)\n#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__LEN (1)\n#define BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM__REG \\\n(BHY_I2C_REG_INT_STATUS_ADDR)\n\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__POS (5)\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__MSK (0x20)\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__LEN (1)\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY__REG \\\n(BHY_I2C_REG_INT_STATUS_ADDR)\n\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__POS (6)\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__MSK (0x40)\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__LEN (1)\n#define BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE__REG \\\n(BHY_I2C_REG_INT_STATUS_ADDR)\n/**************************************************************/\n/**\\name CHIP STATUS LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_CHIP_STATUS__POS (0)\n#define BHY_I2C_REG_CHIP_STATUS__MSK (0xFF)\n#define BHY_I2C_REG_CHIP_STATUS__LEN (8)\n#define BHY_I2C_REG_CHIP_STATUS__REG (BHY_I2C_REG_CHIP_STATUS_ADDR)\n\n#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__POS (0)\n#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__MSK (0x01)\n#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__LEN (1)\n#define BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED__REG \\\n(BHY_I2C_REG_CHIP_STATUS_ADDR)\n\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__POS (1)\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__MSK (0x02)\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__LEN (1)\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE__REG \\\n(BHY_I2C_REG_CHIP_STATUS_ADDR)\n\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__POS (2)\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__MSK (0x04)\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__LEN (1)\n#define BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR__REG \\\n(BHY_I2C_REG_CHIP_STATUS_ADDR)\n\n#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__POS (3)\n#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__MSK (0x08)\n#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__LEN (1)\n#define BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE__REG \\\n(BHY_I2C_REG_CHIP_STATUS_ADDR)\n\n#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__POS (4)\n#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__MSK (0x10)\n#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__LEN (1)\n#define BHY_I2C_REG_CHIP_STATUS_NO_EEPROM__REG (BHY_I2C_REG_CHIP_STATUS_ADDR)\n\n/**************************************************************/\n/**\\name PAGE SELECT LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__POS (0)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__MSK (0xFF)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__LEN (8)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG \\\n(BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR)\n\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__POS (0)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__MSK (0x0F)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__LEN (4)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE__REG \\\n(BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR)\n\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__POS (4)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__MSK (0xF0)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__LEN (4)\n#define BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE__REG \\\n(BHY_I2C_REG_PARAMETER_PAGE_SELECT_ADDR)\n/**************************************************************/\n/**\\name HOST INTERFACE SELECTION LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__POS (0)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__MSK (0xFF)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__LEN (8)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__POS (0)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__MSK (0x01)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__LEN (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__POS (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__MSK (0x02)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__LEN (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__POS (2)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__MSK (0x04)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__LEN (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__POS (3)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__MSK (0x08)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__LEN (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__POS (4)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__MSK (0x10)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__LEN (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__POS (5)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__MSK (0x20)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__LEN (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__POS (6)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__MSK (0x40)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__LEN (1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__POS \\\n(7)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__MSK \\\n(0x80)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__LEN \\\n(1)\n#define BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__REG \\\n(BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR)\n/**************************************************************/\n/**\\name LOAD PARAMETER REQUEST SELECTION LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__POS (0)\n#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__MSK (0xFF)\n#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__LEN (8)\n#define BHY_I2C_REG_LOAD_PARAMETER_REQUEST__REG \\\n(BHY_I2C_REG_PARAMETER_REQUEST_ADDR)\n\n/**************************************************************/\n/**\\name RESET REQUEST SELECTION LENGTH, POSITION AND MASK */\n/**************************************************************/\n#define BHY_I2C_REG_RESET_REQUEST__POS (0)\n#define BHY_I2C_REG_RESET_REQUEST__MSK (0xFF)\n#define BHY_I2C_REG_RESET_REQUEST__LEN (8)\n#define BHY_I2C_REG_RESET_REQUEST__REG \\\n(BHY_I2C_REG_RESET_REQUEST_ADDR)\n\n/**************************************************/\n/**\\name BIT SLICE GET AND SET FUNCTIONS */\n/*************************************************/\n#define BHY_GET_BITSLICE(regvar, bitname)\\\n ((regvar & bitname##__MSK) >> bitname##__POS)\n\n\n#define BHY_SET_BITSLICE(regvar, bitname, val)\\\n ((regvar & ~bitname##__MSK) | \\\n ((val<<bitname##__POS)&bitname##__MSK))\n\n/**************************************************************/\n/**\\name USER SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_HOST_STATUS_ALGO_STANDBY (0)\n#define BHY_HOST_STATUS_ALGO_ID (1)\n#define BHY_FIFO_SIZE_WAKEUP (0)\n#define BHY_FIFO_SIZE_NON_WAKEUP (1)\n#define BHY_HOST_IRQ_TIMESTAMP (0)\n#define BHY_CURRENT_TIME_STAMP (1)\n/**************************************************************/\n/**\\name INTERRUPT STATUS SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_INT_STATUS_HOST_INTR (0)\n#define BHY_INT_STATUS_WAKEUP_WM (1)\n#define BHY_INT_STATUS_WAKEUP_LATENCY (2)\n#define BHY_INT_STATUS_WAKEUP_IMMEDIATE (3)\n#define BHY_INT_STATUS_NON_WAKEUP_WM (4)\n#define BHY_INT_STATUS_NON_WAKEUP_LATENCY (5)\n#define BHY_INT_STATUS_NON_WAKEUP (6)\n/**************************************************************/\n/**\\name CHIP STATUS SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_CHIP_STATUS_EEPROM_DETECTED (0)\n#define BHY_CHIP_STATUS_EE_UPLOAD_DONE (1)\n#define BHY_CHIP_STATUS_EE_UPLOAD_ERROR (2)\n#define BHY_CHIP_STATUS_FIRMWARE_IDLE (3)\n#define BHY_CHIP_STATUS_NO_EEPROM (4)\n/**************************************************************/\n/**\\name PARAMETER PAGE SELECTION SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_PAGE_SELECT_PARAMETER_PAGE (0)\n#define BHY_PAGE_SELECT_PARAMETER_SIZE (1)\n/**************************************************************/\n/**\\name HOST INTERFACE CONTROL SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_HOST_ALGO_STANDBY_REQUEST (0)\n#define BHY_HOST_ABORT_TRANSFER (1)\n#define BHY_HOST_UPDATE_TRANSFER_COUNT (2)\n#define BHY_HOST_WAKEUP_FIFO_DISABLE (3)\n#define BHY_HOST_NED_COORDINATE (4)\n#define BHY_HOST_AP_SUSPEND (5)\n#define BHY_HOST_SELFTEST (6)\n#define BHY_HOST_NON_WAKEUP_FIFO_DISABLE (7)\n/**************************************************************/\n/**\\name META EVENT SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_META_EVENT_BYTE_0 (0)\n#define BHY_META_EVENT_BYTE_1 (1)\n#define BHY_META_EVENT_BYTE_2 (2)\n#define BHY_META_EVENT_BYTE_3 (3)\n#define BHY_META_EVENT_BYTE_4 (4)\n#define BHY_META_EVENT_BYTE_5 (5)\n#define BHY_META_EVENT_BYTE_6 (6)\n#define BHY_META_EVENT_BYTE_7 (7)\n/**************************************************************/\n/**\\name META EVENT AND INTERRUPT SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_META_INTR_ENABLE (0)\n#define BHY_META_EVENT_ENABLE (1)\n/**************************************************************/\n/**\\name META EVENT BYTE-0 SELECTION */\n/**************************************************************/\n#define BHY_FLUSH_COMPLETE (0)\n#define BHY_SAMPLE_RATE_CHANGE (1)\n#define BHY_POWER_MODE (2)\n#define BHY_META_ERROR (3)\n/**************************************************************/\n/**\\name META EVENT BYTE-2 SELECTION */\n/**************************************************************/\n#define BHY_SENSOR_ERROR (0)\n#define BHY_FIFO_OVERFLOW (1)\n/**************************************************************/\n/**\\name META EVENT BYTE-3 SELECTION */\n/**************************************************************/\n#define BHY_DYNAMIC_RANGE (0)\n#define BHY_FIFO_WM (1)\n#define BHY_SELF_TEST_RESULT (2)\n#define BHY_INITIALIZED (3)\n/**************************************************************/\n/**************************************************************/\n/**\\name FIFO WATER MARK SELECTION DEFINITIONS */\n/**************************************************************/\n#define BHY_FIFO_WATER_MARK_WAKEUP (0)\n#define BHY_FIFO_WATER_MARK_NON_WAKEUP (1)\n/**************************************************************/\n/**\\name SENSOR STATUS BANK DEFINITIONS */\n/**************************************************************/\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_1 (0)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_2 (1)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_3 (3)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_4 (4)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_5 (5)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_6 (6)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_7 (7)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_8 (8)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_9 (9)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_10 (10)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_11 (11)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_12 (12)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_13 (13)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_14 (14)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_15 (15)\n#define BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_16 (16)\n\n/**************************************************************/\n/**\\name SENSOR STATUS BANK POWER MODE DEFINITION */\n/**************************************************************/\n\n#define BHY_SENSOR_NOT_PRESENT (0x00)\n#define BHY_POWER_DOWN (0x01)\n#define BHY_SUSPEND (0x02)\n#define BHY_SELF_TEST (0x03)\n#define BHY_INTR_MOTION (0x04)\n#define BHY_ONE_SHOT (0x05)\n#define BHY_LOW_POWER_ACTIVE (0x06)\n#define BHY_ACTIVE (0x07)\n\n/**************************************************************/\n/**\\name PRODUCT ID DEFINITION */\n/**************************************************************/\n#define PRODUCT_ID_7183 (0x83)\n\n/**************************************************************/\n/**\\name FUNCTION DECLARATIONS */\n/**************************************************************/\n/*!\n * @brief\n * This function is used for initialize\n * bus read and bus write functions\n * and device address\n * product id is read in the register 0x90 bit from 0 to 7\n *\n * @param bhy : structure pointer\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n * @note\n * While changing the parameter of the bhy_t\n * consider the following point:\n * Changing the reference value of the parameter\n * will changes the local copy or local reference\n * make sure your changes will not\n * affect the reference value of the parameter\n * (Better case don't change the reference value of the parameter)\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_init(struct bhy_t *bhy);\n/*!\n * @brief\n * This API write the data to\n * the given register\n *\n *\n * @param v_addr_u8 -> Address of the register\n * @param v_data_u8 -> The data from the register\n * @param v_len_u8 -> no of bytes to read\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n */\nBHY_RETURN_FUNCTION_TYPE bhy_write_reg(u8 v_addr_u8,\nu8 *v_data_u8, u16 v_len_u16);\n/*!\n * @brief\n * This API reads the data from\n * the given register\n *\n *\n * @param v_addr_u8 -> Address of the register\n * @param v_data_u8 -> The data from the register\n * @param v_len_u8 -> no of bytes to read\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n */\nBHY_RETURN_FUNCTION_TYPE bhy_read_reg(u8 v_addr_u8,\nu8 *v_data_u8, u16 v_len_u16);\n/*!\n * @brief API used to get the FIFO flush from the register 0x32\n * bit 0 to 7\n *\n *\n * @param v_fifo_flush_u8 : The value of fifo flush\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_fifo_flush(u8 *v_fifo_flush_u8);\n/*!\n * @brief API used to set the FIFO flush from the register 0x32\n * bit 0 to 7\n *\n *\n * @param v_fifo_flush_u8 : The value of fifo flush\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_fifo_flush(u8 v_fifo_flush_u8);\n/*!\n * @brief API used to get the chip control from the register 0x34\n * bit 0 to 7\n * @note Chip control used to provide the control fundamental\n * behaviour of the chip\n *\n * @param v_chipcontrol_u8 : The value of chip control\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_chip_control(u8 *v_chipcontrol_u8);\n/*!\n * @brief API used to set the chip control from the register 0x34\n * bit 0 to 7\n * @note Chip control used to provide the control fundamental\n * behaviour of the chip\n *\n * @param v_chipcontrol_u8 : The value of chip control\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_chip_control(u8 v_chipcontrol_u8);\n/*!\n * @brief API used to get the host status from the register 0x35\n * bit 0 to 7\n *\n *\n * @param v_algo_standby_u8 : The value of algorithm standby duration\n * @param v_algo_id_u8 : The value of algorithm id\n * @param v_host_interface_id_u8 : The value of host interface id\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_host_status(\nu8 *v_algo_standby_u8, u8 *v_algo_id_u8,\nu8 *v_host_interface_id_u8);\n/*!\n * @brief API used to get the interrupt status from the register 0x36\n * bit 0 to 7\n *\n *\n * @param v_host_int_u8 :\n * The value of host interrupt status\n * @param v_wakeup_water_mark_u8 :\n * The value of wakeup watermark status\n * @param v_wakeup_latency_u8 :\n * The value of wakeup latency status\n * @param v_wakeup_immediate_u8 :\n * The value of wakeup immediate status\n * @param v_non_wakeup_water_mark_u8 :\n * The value of non wakeup watermark status\n * @param v_non_wakeup_latency_u8 :\n * The value of non wakeup latency status\n * @param v_non_wakeup_immediate_u8 :\n * The value of non wakeup immediate\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_interrupt_status(\nu8 *v_host_int_u8,\nu8 *v_wakeup_water_mark_u8, u8 *v_wakeup_latency_u8,\nu8 *v_wakeup_immediate_u8, u8 *v_non_wakeup_water_mark_u8,\nu8 *v_non_wakeup_latency_u8, u8 *v_non_wakeup_immediate_u8);\n/*!\n * @brief API used to get the chip status from the register 0x37\n * bit 0 to 7\n *\n *\n *\n * @param v_eeprom_detected_u8 : The value of eeprom\n * detected status\n * @param v_ee_upload_done_u8 : The value of ee_upload\n * done status\n * @param v_ee_upload_error_u8 : The value of ee_upload\n * done error\n * @param v_firmware_idle_u8 : The value of firmware error status\n * @param v_no_eeprom_u8 : The value of no eeprom status\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_chip_status(\nu8 *v_eeprom_detected_u8,\nu8 *v_ee_upload_done_u8, u8 *v_ee_upload_error_u8,\nu8 *v_firmware_idle_u8, u8 *v_no_eeprom_u8);\n/*!\n * @brief API used to get the bytes remaining from the register 0x38\n * and 0x39 bit 0 to 7\n *\n *\n * @param v_bytes_remaining_u16 : The value of bytes remaining\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n * @note This indicates how many bytes are available in the FIFO buffer\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_read_bytes_remaining(\nu16 *v_bytes_remaining_u16);\n/*!\n * @brief API used to get the parameter\n * acknowledgement from the register 0x3A\n * bit 0 to 7\n *\n *\n * @param v_parameter_acknowledge_u8:\n * The value of parameter acknowledgement\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n * @note\n *\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_parameter_acknowledge(\nu8 *v_parameter_acknowledge_u8);\n/*!\n * @brief API used to get the parameter\n * page select from the register 0x54\n * bit 0 to 7\n *\n *\n * @param v_page_select_u8 : The value of parameter page selection\n * page information | value\n * ------------------------|----------\n * BHY_PAGE_SELECT_PARAMETER_PAGE | 0\n * BHY_PAGE_SELECT_PARAMETER_SIZE | 1\n *\n * @param v_parameter_page_u8 : The value of page selection\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_parameter_page_select(\nu8 v_page_select_u8, u8 *v_parameter_page_u8);\n/*!\n * @brief API used to set the parameter\n * page select from the register 0x54\n * bit 0 to 7\n *\n *\n * @param v_page_select_u8 : The value of parameter page selection\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_parameter_page_select(\nu8 v_page_select_u8);\n/*!\n * @brief API used to get the host interface control\n * from the register 0x55\n * bit 0 to 7\n *\n *\n *\n * @param v_algo_standby_req_u8 : The value of algorithm standby\n * request\n * @param v_abort_transfer_u8 : The value of abort transfer\n * @param v_update_transfer_cnt_u8 : The value of update\n * transfer count\n * @param v_wakeup_fifo_intr_disable_u8 :\n * The value of wakeup fifo host\n * interrupt disable\n * @param v_ned_coordinates_u8 : The value of NED coordinates\n * @param v_ap_suspend_u8 : The value of AP suspended\n * @param v_sensor_selftest_u8 : The value of sensor self test\n * @param v_non_wakeup_fifo_intr_disable_u8:\n * The value of non wakeup fifo host\n * interrupt disable\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_host_interface_control(\nu8 *v_algo_standby_req_u8,\nu8 *v_abort_transfer_u8, u8 *v_update_transfer_cnt_u8,\nu8 *v_wakeup_fifo_intr_disable_u8, u8 *v_ned_coordinates_u8,\nu8 *v_ap_suspend_u8, u8 *v_sensor_selftest_u8,\nu8 *v_non_wakeup_fifo_intr_disable_u8);\n/*!\n * @brief API used to set the host interface control\n * from the register 0x55\n * bit 0 to 7\n *\n *\n * @param v_host_interface_select_u8 : The value of host interface selection\n * host interface | value\n * -----------------------------------|----------\n * BHY_HOST_ALGO_STANDBY_REQUEST | 0\n * BHY_HOST_ABORT_TRANSFER | 1\n * BHY_HOST_UPDATE_TRANSFER_COUNT | 2\n * BHY_HOST_WAKEUP_FIFO_DISABLE | 3\n * BHY_HOST_NED_COORDINATE | 4\n * BHY_HOST_AP_SUSPEND | 5\n * BHY_HOST_SELFTEST | 6\n * BHY_HOST_NON_WAKEUP_FIFO_DISABLE | 7\n *\n * @param v_host_interface_status_u8 : The value of host interface\n * Data | status\n * -----------------| -----------\n * 0 | DISABLE\n * 1 | ENABLE\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_host_interface_control(\nu8 v_host_interface_select_u8, u8 v_host_interface_status_u8);\n/*!\n * @brief API used to get the parameter\n * request from the register 0x64\n * bit 0 to 7\n *\n *\n * @param v_parameter_request_u8 : The value of parameter request\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_parameter_request(\nu8 *v_parameter_request_u8);\n/*!\n * @brief API used to get the parameter\n * request from the register 0x64\n * bit 0 to 7\n *\n *\n * @param v_parameter_request_u8 : The value of parameter request\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_parameter_request(\nu8 v_parameter_request_u8);\n/*!\n * @brief API used to get the host IRQ time stamp\n * request from the register 0x6C to 0x6F\n * bit 0 to 7\n *\n *\n * @param v_host_irq_timestamp_u32 : The value of host irq time stamp\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_host_irq_timestamp(\nu32 *v_host_irq_timestamp_u32);\n/*!\n * @brief API used to get the ROM version\n * request from the register 0x70 to 0x71\n * bit 0 to 7\n *\n *\n * @param v_rom_version_u16 : The value ROM version\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_rom_version(\nu16 *v_rom_version_u16);\n/*!\n * @brief API used to get the RAM version\n * request from the register 0x72 to 0x73\n * bit 0 to 7\n *\n *\n * @param v_ram_version_u16 : The value RAM version\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_ram_version(\nu16 *v_ram_version_u16);\n/*!\n * @brief API used to get the product id\n * request from the register 0x90\n * bit 0 to 7\n *\n *\n * @param v_product_id_u8 : The value of product id\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_product_id(u8 *v_product_id_u8);\n/*!\n * @brief API used to get the revision id\n * request from the register 0x91\n * bit 0 to 7\n *\n *\n * @param v_revision_id_u8 : The value of revision id\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_revision_id(u8 *v_revision_id_u8);\n/*!\n * @brief API used to get the CRC host\n * request from the register 0x91\n * bit 0 to 7\n *\n *\n * @param v_crc_host_u32 : The value of CRC host\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_crc_host(u32 *v_crc_host_u32);\n/*!\n * @brief API used to set the reset\n * request from the register 0x9B\n * bit 0 to 7\n *\n *\n * @param v_reset_request_u8 : The value of parameter request\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_reset_request(u8 v_reset_request_u8);\n/*!\n * @brief API used to get the meta event control from\n * system page-1 parameter 1\n *\n * @param v_meta_event_u8 : The value of meta event selection\n * meta event | value\n * --------------------------|---------------\n * BHY_META_EVENT_1 | 1\n * BHY_META_EVENT_2 | 2\n * BHY_META_EVENT_3 | 3\n * BHY_META_EVENT_4 | 4\n * BHY_META_EVENT_5 | 5\n * BHY_META_EVENT_6 | 6\n * BHY_META_EVENT_7 | 7\n * BHY_META_EVENT_8 | 8\n * BHY_META_EVENT_9 | 9\n * BHY_META_EVENT_10 | 10\n * BHY_META_EVENT_11 | 11\n * BHY_META_EVENT_12 | 12\n * BHY_META_EVENT_13 | 13\n * BHY_META_EVENT_14 | 14\n * BHY_META_EVENT_15 | 15\n * BHY_META_EVENT_16 | 16\n * BHY_META_EVENT_17 | 17\n * BHY_META_EVENT_18 | 18\n * BHY_META_EVENT_19 | 19\n * BHY_META_EVENT_20 | 20\n * BHY_META_EVENT_21 | 21\n * BHY_META_EVENT_22 | 22\n * BHY_META_EVENT_23 | 23\n * BHY_META_EVENT_24 | 24\n * BHY_META_EVENT_25 | 25\n * BHY_META_EVENT_26 | 26\n * BHY_META_EVENT_27 | 27\n * BHY_META_EVENT_28 | 28\n * BHY_META_EVENT_29 | 29\n * BHY_META_EVENT_30 | 30\n * BHY_META_EVENT_31 | 31\n * BHY_META_EVENT_32 | 32\n *\n * @param meta_intr :\n * The value of meta event interrupt selection\n *\n * @param meta_event :\n * The value of meta event event selection\n *\n * @param v_event_type_u8 : The value of\n * interrupt or event selection\n * value | Event\n * -------------------------|----------------\n * BHY_META_EVENT_INTR_ENABLE | 0\n * BHY_META_EVENT_ENABLE | 1\n *\n * @param v_meta_parameter_request_u8: The value of parameter request\n * for wakeup or non wakeup fifo\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_meta_event(\nu8 v_meta_event_u8,\nu8 v_input_data_u8, u8 v_event_type_u8,\nu8 v_meta_parameter_request_u8);\n/*!\n * @brief API used to get the meta event control from\n * system page-1 parameter 1\n *\n * @param v_meta_event_u8 : The value of meta event selection\n * meta event | value\n * --------------------------|---------------\n * BHY_META_EVENT_1 | 1\n * BHY_META_EVENT_2 | 2\n * BHY_META_EVENT_3 | 3\n * BHY_META_EVENT_4 | 4\n * BHY_META_EVENT_5 | 5\n * BHY_META_EVENT_6 | 6\n * BHY_META_EVENT_7 | 7\n * BHY_META_EVENT_8 | 8\n * BHY_META_EVENT_9 | 9\n * BHY_META_EVENT_10 | 10\n * BHY_META_EVENT_11 | 11\n * BHY_META_EVENT_12 | 12\n * BHY_META_EVENT_13 | 13\n * BHY_META_EVENT_14 | 14\n * BHY_META_EVENT_15 | 15\n * BHY_META_EVENT_16 | 16\n * BHY_META_EVENT_17 | 17\n * BHY_META_EVENT_18 | 18\n * BHY_META_EVENT_19 | 19\n * BHY_META_EVENT_20 | 20\n * BHY_META_EVENT_21 | 21\n * BHY_META_EVENT_22 | 22\n * BHY_META_EVENT_23 | 23\n * BHY_META_EVENT_24 | 24\n * BHY_META_EVENT_25 | 25\n * BHY_META_EVENT_26 | 26\n * BHY_META_EVENT_27 | 27\n * BHY_META_EVENT_28 | 28\n * BHY_META_EVENT_29 | 29\n * BHY_META_EVENT_30 | 30\n * BHY_META_EVENT_31 | 31\n * BHY_META_EVENT_32 | 32\n *\n * @param meta_intr :\n * The value of meta event interrupt selection\n *\n * @param meta_event :\n * The value of meta event event selection\n *\n * @param v_event_type_u8 : The value of\n * interrupt or event selection\n * value | Event\n * -------------------------|----------------\n * BHY_META_EVENT_INTR_ENABLE | 0\n * BHY_META_EVENT_ENABLE | 1\n *\n * @param v_meta_parameter_request_u8: The value of parameter request\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_meta_event(\nu8 v_meta_event_u8, u8 v_event_type_u8,\nu8* meta_event_intr,\nu8* meta_event_event,\nu8 v_meta_parameter_request_u8);\n/*!\n * @brief API used to get the fifo water mark from\n * system page-1 parameter 2\n *\n *\n * @param v_parameter_u8 :\n * The value of fifo water mark wakeup or non-wakeup selection\n * water mark | value\n * --------------------------|---------------\n * FIFO_WM_WAKEUP | 0\n * FIFO_WM_NON_WAKEUP | 1\n *\n * @param v_fifo_water_mark_u16: The value of fifo water mark\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_fifo_water_mark(\nu8 v_parameter_u8, u16 *v_fifo_water_mark_u16);\n/*!\n * @brief API used to set the fifo water mark from\n * system page-1 parameter 2\n *\n *\n * @param v_parameter_u8 :\n * The value of fifo water mark wakeup or non-wakeup selection\n * water mark | value\n * --------------------------|---------------\n * FIFO_WM_WAKEUP | 0\n * FIFO_WM_NON_WAKEUP | 1\n *\n * @param v_fifo_water_mark_u16: The value of fifo water mark\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_fifo_water_mark(u8 v_parameter_u8,\nu16 v_fifo_water_mark_u16);\n/*!\n * @brief API used to get the fifo size from\n * system page-1 parameter 2\n * @note wakeup - bytes from 2 and 3\n * @note non wakeup - bytes from 6 and 7\n *\n *\n * @param v_fifo_size_select_u8 :\n * The value of fifo size mark wakeup or non-wakeup selection\n * water mark | value\n * --------------------------|---------------\n * BHY_FIFO_SIZE_WAKEUP | 0\n * BHY_FIFO_SIZE_NON_WAKEUP | 1\n *\n * @param v_fifo_size_u16 : The value of fifo size\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_fifo_size(\nu8 v_fifo_size_select_u8, u16 *v_fifo_size_u16);\n\n/*!\n * @brief API used to get the sensor status bank from\n * system page-1 parameter 3 to 6\n * @note Sensor status bank 0 : parameter 3 contains 1 to 16 sensor type\n * @note Sensor status bank 1 : parameter 4 contains 17 to 32 sensor type\n * @note Sensor status bank 2 : parameter 5 contains 33 to 48 sensor type\n * @note Sensor status bank 3 : parameter 6 contains 49 to 64 sensor type\n *\n *\n * @param v_sensor_type_u8 :\n * The value of sensor status bank sensor type selection\n * v_sensor_type_u8 | value\n * -----------------------------------|---------------\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_1 | 0\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_2 | 1\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_3 | 3\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_4 | 4\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_5 | 5\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_6 | 6\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_7 | 7\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_8 | 8\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_9 | 9\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_10 | 10\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_11 | 11\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_12 | 12\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_13 | 13\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_14 | 14\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_15 | 15\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_16 | 16\n *\n *\n * @param v_sensor_status_parameter_u8 :\n * The value of sensor status bank parameter selection\n * parameter | value\n * -------------------------------|-----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_sensor_status_bank(\nu8 v_sensor_status_parameter_u8, u8 v_sensor_type_u8);\n/*!\n * @brief API used to get the host IRQ time\n * stamp and current time stamp from\n * system page-1 parameter 30\n * Host IRQ time stamp bytes 0 to 3\n * Current time stamp bytes 4 to 7\n *\n *\n * @param v_time_stamp_selection_u8 :\n * The value of Host IRQ or current time stamp selection\n * time stamp | value\n * --------------------------|---------------\n * BHY_HOST_IRQ_TIMESTAMP | 0\n * BHY_CURRENT_TIME_STAMP | 1\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n * @param v_time_stamp_u32 :\n * The value of Host IRQ or current time stamp\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_time_stamp(\nu8 v_time_stamp_selection_u8, u32 *v_time_stamp_u32);\n/*!\n * @brief API used to get the physical sensor status\n * system page-1 parameter 31\n * @note Accel sample rate byte 0 and 1\n * @note Accel dynamic range byte 2 and 3\n * @note Accel flags byte 4\n * @note Gyro sample rate byte 5 and 6\n * @note Gyro dynamic range byte 7 and 8\n * @note Gyro flags byte 9\n * @note Mag sample rate byte 10 and 11\n * @note Mag dynamic range byte 12 and 13\n * @note Mag flags byte 14\n *\n * @param accel_status : contains the accel physical status\n * @param gyro_status : contains the gyro physical status\n * @param mag_status : contains the mag physical status\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_physical_sensor_status(\nstruct accel_physical_status_t *accel_status,\nstruct gyro_physical_status_t *gyro_status,\nstruct mag_physical_status_t *mag_status);\n/*!\n * @brief API used to get the non wakeup sensor information,\n * Sensor page-3 parameter 1 to 31\n *\n * @param v_parameter_request_u8 :\n * Value desired parameter to read non wakeup sensor information\n * param_request | value\n * -----------------------------------|------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_1 | 0x01\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_2 | 0x02\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_7 | 0x87\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_8 | 0x88\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_9 | 0x89\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_10 | 0x8A\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_11 | 0x8B\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_12 | 0x8C\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_13 | 0x8D\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_14 | 0x8E\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_15 | 0x8F\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_16 | 0x90\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_17 | 0x91\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_18 | 0x92\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_19 | 0x93\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_20 | 0x94\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_21 | 0x95\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_22 | 0x96\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_23 | 0x97\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_24 | 0x98\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_25 | 0x99\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_31 | 0x9F\n *\n * @param sensor_information :\n * holds the value of non wakeup sensor information\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_information(\nu8 v_parameter_request_u8,\nstruct sensor_information_non_wakeup_t *sensor_information);\n/*!\n * @brief API used to get the wakeup sensor information,\n * Sensor page-3 parameter 32 to 63\n *\n * @param v_parameter_request_u8 :\n * Value desired parameter to read non wakeup sensor information\n * param_request | value | Virtual sensor\n * ----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_33 | 0xA1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_34 | 0xA2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_35 | 0xA3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_36 | 0xA4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_37 | 0xA5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_38 | 0xA6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_39 | 0xA7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_40 | 0xA8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_41 | 0xA9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_42 | 0xAA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_43 | 0xAB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_44 | 0xAC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_45 | 0xAD | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_46 | 0xAE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_47 | 0xAF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_48 | 0xB0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_49 | 0xB1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_50 | 0xB2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_51 | 0xB3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_52 | 0xB4 | Geomagnetic rotation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_53 | 0xB5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_54 | 0xB6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_55 | 0xB7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_56 | 0xB8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_57 | 0xB9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_63 | 0xBF | Activity\n *\n * @param sensor_information :\n * holds the value of non wakeup sensor information\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_information(\nu8 v_parameter_request_u8,\nstruct sensor_information_wakeup_t *sensor_information);\n/*!\n * @brief API used to set the sensor non wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param sensor_configuration : contains the non wakeup sensor configuration\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * ----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_non_wakeup_sensor_configuration(\nstruct sensor_configuration_non_wakeup_t *sensor_configuration,\nu8 v_parameter_request_u8);\n/*!\n * @brief API used to get the sensor non wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param v_sample_rate_u16 : contains the non wakeup sample rate data\n * @param v_max_report_latency_u16:\n * contains the non wakeup max report latency\n * @param v_change_sensitivity_u16: contains the non wakeup sensitivity\n * @param v_dynamic_range_u16: contains the non wakeup dynamic range\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * ----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_configuration(\nu8 v_parameter_request_u8, u16 *v_sample_rate_u16,\nu16 *v_max_report_latency_u16,\nu16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16);\n/*!\n * @brief API used to set the sensor wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param sensor_configuration : contains the wakeup sensor configuration\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * -----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_wakeup_sensor_configuration(\nstruct sensor_configuration_wakeup_t *sensor_configuration,\nu8 v_parameter_request_u8);\n/*!\n * @brief API used to get the sensor wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param v_sample_rate_u16 : contains the wakeup sample rate data\n * @param v_max_report_latency_u16: contains the wakeup max report latency\n * @param v_change_sensitivity_u16: contains the wakeup sensitivity\n * @param v_dynamic_range_u16: contains the wakeup dynamic range\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * -----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_configuration(\nu8 v_parameter_request_u8, u16 *v_sample_rate_u16,\nu16 *v_max_report_latency_u16,\nu16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16);\n/*!\n * @brief API used to set the soft pass through\n * Sensor page-15 parameter 0 to 7\n *\n * @param soft_pass_through :\n * contains the value of soft pass through\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * parameter | value\n * ------------------------------------|--------------------\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_soft_pass_through(\nstruct soft_pass_through_write_t *soft_pass_through,\nu8 v_parameter_request_u8);\n/*!\n * @brief API used to get the soft pass through\n * Sensor page-15 parameter 0 to 7\n *\n * @param soft_pass_through :\n * contains the value of soft pass through\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * parameter | value\n * ------------------------------------|--------------------\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_soft_pass_through(\nstruct soft_pass_through_read_t *soft_pass_through,\nu8 v_parameter_request_u8);\n/*!\n * @brief API used to get the data from the parameter\n * I2C page register from 0x3B to 0x4A\n *\n *\n * @param v_page_select_u8 : This input value for set the desired page\n * @param v_parameter_request_u8 :\n * This input value for set the desired parameter\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_read_parameter_bytes(\nu8 v_page_select_u8, u8 v_parameter_request_u8);\n/*!\n * @brief API used to set the data from the parameter\n * I2C page register from 0x5C to 0x63\n *\n *\n * @param v_page_select_u8 : This input value for set the desired page\n * @param v_parameter_request_u8 :\n * This input value for set the desired parameter\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_write_parameter_bytes(\nu8 v_page_select_u8, u8 v_parameter_request_u8);\n/*!\n * @brief API used to flash the ram patch. There is two versions,\n * one that accepts constant input data\n *\n *\n * @param memory : The value of data from the\n * ram patch.\n * @param v_file_length_u32 : Length of the patch data\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_initialize(\nu8 *memory, u32 v_file_length_u32);\nBHY_RETURN_FUNCTION_TYPE bhy_initialize_from_rom(\nconst u8 *memory, const u32 v_file_length_u32);\n\n\n#endif\n",
"bhy1_fw.h": "#ifndef BHY1_FIRMWARE_H_\n#define BHY1_FIRMWARE_H_\n\nextern const unsigned char bhy1_fw[];\n\n#endif /* BHY1_FIRMWARE_H_ */\n",
"bhy_support.h": "/*!\n * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * \n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n * \n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n *\n * @file bhy_support.h\n *\n * @date 12/19/2016\n *\n * @brief driver on MCU for bhy\n *\n *\n */\n\n#ifndef BHY_SUPPORT_H_\n#define BHY_SUPPORT_H_\n\n/********************************************************************************/\n/* HEADER FILES */\n/********************************************************************************/\n#include \"bhy.h\"\n#include \"../app_src/atmosphere_platform.h\"\n#include <stdint.h>\n\n/********************************************************************************/\n/* MACROS */\n/********************************************************************************/\n#define RETRY_NUM 3\n\n/*! determines the I2C slave address of BHy\n* The default I2C address of the BHy device is 0101000b (0x28). */\n/* 0x28 CONFLICTS ON ATMEL DEV KITS WITH THE ONBOARD EDBG!!!! */\n#define BHY_I2C_SLAVE_ADDRESS BHY_I2C_ADDR1\n/*! the delay required to wait for BHY chip to reset */\n#define BHY_RESET_DELAY_MS UINT32_C(50)\n\n/*! these two macros are defined for i2c read/write limitation of host */\n/*! users must modify these two macros according to their own IIC hardware design */\n#define I2C_ONCE_WRITE_MAX_COUNT (8)\n#define I2C_ONCE_READ_MAX_COUNT (8)\n\n//#define BHY_DEBUG 1\n\n/********************************************************************************/\n/* FUNCTION DECLARATIONS */\n/********************************************************************************/\n/*!\n* @brief Initializes BHY smart sensor and its required connections\n*\n*/\nint8_t bhy_initialize_support(void);\n\n/*!\n* @brief Initiates a delay of the length of the argument in milliseconds\n*\n* @param[in] msec Delay length in terms of milliseconds\n*\n*/\nvoid bhy_delay_msec(uint32_t msec);\n\n/*!\n * @brief provides a print function to the bhy driver on DD2.0 platform\n */\nvoid bhy_printf (const char * string);\n\n/*!\n * @brief provides the mcu reference code version\n */\n//uint8_t *bhy_get_version(void);\n\nvoid bhy_set_driver_instance(ATMO_DriverInstanceHandle_t i2cInstance);\n\n\n#endif /* BHY_SUPPORT_H_ */\n",
"bhy_uc_driver.h": "/*!\n * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * \n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n * \n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n *\n * @file bhy_uc_driver.h\n *\n * @date 12/19/2016\n *\n * @brief headfile of driver on MCU for bhy\n *\n *\n */\n\n#ifndef BHY_UC_DRIVER_H_\n#define BHY_UC_DRIVER_H_\n\n#include \"BHy_support.h\"\n#include \"bhy_uc_driver_types.h\"\n\n/****************************************************************************/\n/* Driver Functions */\n/****************************************************************************/\n\n\n/* initializes the driver, the API and loads the ram patch into the sensor */\nBHY_RETURN_FUNCTION_TYPE bhy_driver_init\n (const uint8_t *bhy_fw_data);\n\n/* this function configures meta event */\nBHY_RETURN_FUNCTION_TYPE bhy_meta_event_set_config( bhy_meta_event_type_t meta_event_id,\n bhy_meta_event_fifo_type_t fifo_sel,\n uint8_t enable_state, uint8_t int_enable_state);\n\n/* this function gets configuration from specific meta event */\nBHY_RETURN_FUNCTION_TYPE bhy_meta_event_get_config( bhy_meta_event_type_t meta_event_id,\n bhy_meta_event_fifo_type_t fifo_sel,\n uint8_t* p_enable_state, uint8_t* p_int_enable_state);\n\n/*****************************************************************************\n * Function : bhy_mapping_matrix_set\n * Description : Set mapping matrix to a corresponding physical sensor.\n * Input : index: physical sensor index.\n * PHYSICAL_SENSOR_INDEX_ACC = 0,\n * PHYSICAL_SENSOR_INDEX_MAG = 1,\n * PHYSICAL_SENSOR_INDEX_GYRO = 2,\n * p_mapping_matrix: pointer to a \"int8_t mapping_matrix[9]\".\n * Output : None\n * Return :\n*****************************************************************************/\nBHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_set(bhy_physical_sensor_index_type_t index , int8_t *p_mapping_matrix);\n\n/*****************************************************************************\n * Function : bhy_mapping_matrix_get\n * Description : Get mapping matrix from a corresponding physical sensor.\n * Input : index: physical sensor index.\n * PHYSICAL_SENSOR_INDEX_ACC = 0,\n * PHYSICAL_SENSOR_INDEX_MAG = 1,\n * PHYSICAL_SENSOR_INDEX_GYRO = 2,\n * Output : p_mapping_matrix: pointer to a \"int8_t mapping_matrix[9]\".\n * Return :\n*****************************************************************************/\nBHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_get(bhy_physical_sensor_index_type_t index , int8_t *p_mapping_matrix);\n\n/* This function uses the soft pass-through feature to perform single multi-*/\n/* byte transfers in order to write the data. parameters: */\n/* addr i2c address of the slave device */\n/* reg register address to write to */\n/* data pointer to the data buffer with data to write to the */\n/* slave */\n/* length number of bytes to write to the slave */\n/* increment_reg if true, the function will automatically increment the */\n/* register between successive 4-bytes transfers */\nBHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_write(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg);\n\n/* This function uses the soft pass-through feature to perform single multi-*/\n/* byte transfers in order to read the data. parameters: */\n/* addr i2c address of the slave device */\n/* reg register address to read from */\n/* data pointer to the data buffer where to place the data read */\n/* from the slave */\n/* length number of bytes to fread from the slave */\n/* increment_reg if true, the function will automatically increment the */\n/* register between successive 4-bytes transfers */\nBHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_read(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg);\n\n/*****************************************************************************\n * Function : bhy_gp_register_write\n * Description : Write data to specific GP register.\n * Input : bhy_gp_register_type_t: GP register address.\n * : p_data: pointer to receive buffer.\n * Output :\n * Return :\n*****************************************************************************/\nBHY_RETURN_FUNCTION_TYPE bhy_gp_register_write(bhy_gp_register_type_t gp_reg, uint8_t data);\n\n/*****************************************************************************\n * Function : bhy_gp_register_read\n * Description : Read data from specific GP register.\n * Input : bhy_gp_register_type_t: GP register address.\n * Output : p_data: pointer to receive buffer.\n * Return :\n*****************************************************************************/\nBHY_RETURN_FUNCTION_TYPE bhy_gp_register_read(bhy_gp_register_type_t gp_reg, uint8_t *p_data);\n\n/* this functions enables the selected virtual sensor */\nBHY_RETURN_FUNCTION_TYPE bhy_enable_virtual_sensor\n (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status, uint16_t sample_rate,\n uint16_t max_report_latency_ms, uint8_t flush_sensor, uint16_t change_sensitivity,\n uint16_t dynamic_range);\n\n/* this functions disables the selected virtual sensor */\nBHY_RETURN_FUNCTION_TYPE bhy_disable_virtual_sensor\n (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status);\n\n/* retrieves the fifo data. it needs a buffer of at least 51 bytes to work */\n/* it outputs the data into the variable buffer. the number of bytes read */\n/* into bytes_read and the bytes remaining in the fifo into bytes_left. */\n/* Setting BST_APPLICATION_BOARD to 1 will limit the size to 51 bytes all */\n/* the time. Arguments : */\n/* buffer Pointer to the buffer to use for the fifo readout. */\n/* buffer_size Size of the buffer to work with. Needs to be 51 bytes+ */\n/* bytes_read Pointer to output the number of bytes actually read from*/\n/* the fifo. */\n/* bytes_left Pointer to output the number of bytes still in the fifo.*/\n/* This function automatically keeps track of the current */\n/* fifo readout progress.\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_read_fifo(uint8_t * buffer, uint16_t buffer_size,\n uint16_t * bytes_read, uint16_t * bytes_left);\n\n/* This function parses the next fifo packet and return it into a generic */\n/* data structure while telling you what the data type is so you can */\n/* retrieve it. Here are the parameters: */\n/* fifo_buffer pointer to the fifo byte that is the start of a */\n/* packet. This pointer will be automatically */\n/* incremented so you can call this function in a loop */\n/* fifo_buffer_length pointer to the amount of data left in the */\n/* fifo_buffer. This data will be automatically */\n/* decremented so you can call this function in a loop */\n/* fifo_data_output buffer in which to place the data */\n/* fifo_data_type data type output */\nBHY_RETURN_FUNCTION_TYPE bhy_parse_next_fifo_packet\n (uint8_t **fifo_buffer, uint16_t *fifo_buffer_length,\n bhy_data_generic_t * fifo_data_output, bhy_data_type_t * fifo_data_type);\n\n/* This function will detect the timestamp packet accordingly and update */\n/* either the MSW or the LSW of the system timestamp. Arguments : */\n/* timestamp_packet The timestamp packet processed by the parse_next_ */\n/* fifo_packet, properly typecasted */\n/* system_timestamp Pointer to a 32bit variable holding the system */\n/* timestamp in 1/32000th seconds. it will wrap around */\n/* every 36 hours. */\nBHY_RETURN_FUNCTION_TYPE bhy_update_system_timestamp(bhy_data_scalar_u16_t *timestamp_packet,\n uint32_t * system_timestamp);\n\n/* This function writes arbitrary data to an arbitrary parameter page. To be*/\n/* used carefully since it can override system configurations. Refer to the */\n/* datasheet for free to use parameter pages. Here are the arguments: */\n/* page Page number. Valid range 1 to 15. */\n/* parameter Parameter number. Valid range 0 to 127. */\n/* data Pointer to the data source to write to. */\n/* length Number of bytes to write. Valid range 1 to 8. */\nBHY_RETURN_FUNCTION_TYPE bhy_write_parameter_page(uint8_t page, uint8_t parameter,\n uint8_t *data, uint8_t length);\n\n/* This function reads arbitrary data to an arbitrary parameter page. To be*/\n/* used carefully since it can override system configurations. Refer to the */\n/* datasheet for free to use parameter pages. Here are the arguments: */\n/* page Page number. Valid range 1 to 15. */\n/* parameter Parameter number. Valid range 0 to 127. */\n/* data Pointer to the data source to write to. */\n/* length Number of bytes to read. Valid range 1 to 16. */\nBHY_RETURN_FUNCTION_TYPE bhy_read_parameter_page(uint8_t page, uint8_t parameter,\n uint8_t *data, uint8_t length);\n\n/* This function write a new SIC matrix to the BHy. Arguments are: */\n/* sic_matrix pointer to array of 9 floats with SIC matrix */\nBHY_RETURN_FUNCTION_TYPE bhy_set_sic_matrix(float * sic_matrix);\n\n/* This function reads out the current SIC matrix from BHy. Arguments are: */\n/* sic_matrix pointer to array of 9 floats with SIC matrix */\nBHY_RETURN_FUNCTION_TYPE bhy_get_sic_matrix(float * sic_matrix);\n\n/* This function outputs the debug data to function pointer. You need to */\n/* provide a function that takes as argument a zero-terminated string and */\n/* prints it */\nvoid bhy_print_debug_packet(bhy_data_debug_t *packet, void (*debug_print_ptr)(const uint8_t *));\n\nBHY_RETURN_FUNCTION_TYPE bhy_sync_cus_evt_size(void);\n\nint8_t bhy_get_cus_evt_size(bhy_virtual_sensor_t sensor_id);\n\n\n#if BHY_CALLBACK_MODE\n/* These functions will install the callback and return an error code if */\n/* there is already a callback installed */\nBHY_RETURN_FUNCTION_TYPE bhy_install_sensor_callback (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status, void (*sensor_callback)(bhy_data_generic_t *, bhy_virtual_sensor_t));\nBHY_RETURN_FUNCTION_TYPE bhy_install_timestamp_callback(uint8_t wakeup_status, void (*timestamp_callback)(bhy_data_scalar_u16_t *));\nBHY_RETURN_FUNCTION_TYPE bhy_install_meta_event_callback(bhy_meta_event_type_t meta_event_id, void (*meta_event_callback)(bhy_data_meta_event_t *, bhy_meta_event_type_t));\n\n\n/* These functions will uninstall the callback and return an error code if */\n/* there was no callback installed */\nBHY_RETURN_FUNCTION_TYPE bhy_uninstall_sensor_callback (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status);\nBHY_RETURN_FUNCTION_TYPE bhy_uninstall_timestamp_callback (uint8_t wakeup_status );\nBHY_RETURN_FUNCTION_TYPE bhy_uninstall_meta_event_callback (bhy_meta_event_type_t meta_event_id);\n\n#endif\n\n#endif /* BHY_UC_DRIVER_H_ */\n\n/** @}*/\n",
"bhy_uc_driver_config.h": "/*!\n * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * \n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n * \n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n * @file bhy_uc_driver_config.h\n *\n * @date 12/15/2016\n *\n * @brief header file of bhy_uc_driver.c\n *\n */\n\n\n\n\n#ifndef BHY_UC_DRIVER_CONFIG_H_\n#define BHY_UC_DRIVER_CONFIG_H_\n\n/****************************************************************************/\n/* Driver configuration */\n/****************************************************************************/\n#define BHY_MCU_REFERENCE_VERSION \"1.1.1.0\"\n\n/* Enabling BHY_DEBUG will allow you print all the sensor raw data */\n//#define BHY_DEBUG\n\n/* Enabling BHY_CALLBACK_MODE will allow you to install callback function */\n/* that will be called from the bhy_parse_next_fifo_packet function. is uses*/\n/* ~250 bytes of ROM and ~350 bytes of RAM */\n#define BHY_CALLBACK_MODE 1\n\n\n#endif /* BHY_UC_DRIVER_CONFIG_H_ */\n",
"bhy_uc_driver_constants.h": "/*!\n * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * \n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n * \n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n * @file bhy_uc_driver_constants.h\n *\n * @date 12/15/2016\n *\n * @brief header file of bhy_uc_driver.c\n *\n */\n\n\n#ifndef BHY_UC_DRIVER_CONSTANTS_H_\n#define BHY_UC_DRIVER_CONSTANTS_H_\n\n#include \"bhy_uc_driver_config.h\"\n\n/****************************************************************************/\n/* Constants definitions */\n/****************************************************************************/\n\n/* definition of all the known IDs. User can add their own IDs to the */\n/* bhy_parse_next_fifo_packet function. follow section 15 table 28 of the */\n/* BHI160 datasheet. */\n#define VS_ID_PADDING 0\n#define VS_ID_ACCELEROMETER 1\n#define VS_ID_MAGNETOMETER 2\n#define VS_ID_ORIENTATION 3\n#define VS_ID_GYROSCOPE 4\n#define VS_ID_LIGHT 5\n#define VS_ID_BAROMETER 6\n#define VS_ID_TEMPERATURE 7\n#define VS_ID_PROXIMITY 8\n#define VS_ID_GRAVITY 9\n#define VS_ID_LINEAR_ACCELERATION 10\n#define VS_ID_ROTATION_VECTOR 11\n#define VS_ID_HUMIDITY 12\n#define VS_ID_AMBIENT_TEMPERATURE 13\n#define VS_ID_UNCALIBRATED_MAGNETOMETER 14\n#define VS_ID_GAME_ROTATION_VECTOR 15\n#define VS_ID_UNCALIBRATED_GYROSCOPE 16\n#define VS_ID_SIGNIFICANT_MOTION 17\n#define VS_ID_STEP_DETECTOR 18\n#define VS_ID_STEP_COUNTER 19\n#define VS_ID_GEOMAGNETIC_ROTATION_VECTOR 20\n#define VS_ID_HEART_RATE 21\n#define VS_ID_TILT_DETECTOR 22\n#define VS_ID_WAKE_GESTURE 23\n#define VS_ID_GLANCE_GESTURE 24\n#define VS_ID_PICKUP_GESTURE 25\n#define VS_ID_CUS1 26\n#define VS_ID_CUS2 27\n#define VS_ID_CUS3 28\n#define VS_ID_CUS4 29\n#define VS_ID_CUS5 30\n#define VS_ID_ACTIVITY 31\n\n#define VS_ID_ACCELEROMETER_WAKEUP (VS_ID_ACCELEROMETER+32)\n#define VS_ID_MAGNETOMETER_WAKEUP (VS_ID_MAGNETOMETER+32)\n#define VS_ID_ORIENTATION_WAKEUP (VS_ID_ORIENTATION+32)\n#define VS_ID_GYROSCOPE_WAKEUP (VS_ID_GYROSCOPE+32)\n#define VS_ID_LIGHT_WAKEUP (VS_ID_LIGHT+32)\n#define VS_ID_BAROMETER_WAKEUP (VS_ID_BAROMETER+32)\n#define VS_ID_TEMPERATURE_WAKEUP (VS_ID_TEMPERATURE+32)\n#define VS_ID_PROXIMITY_WAKEUP (VS_ID_PROXIMITY+32)\n#define VS_ID_GRAVITY_WAKEUP (VS_ID_GRAVITY+32)\n#define VS_ID_LINEAR_ACCELERATION_WAKEUP (VS_ID_LINEAR_ACCELERATION+32)\n#define VS_ID_ROTATION_VECTOR_WAKEUP (VS_ID_ROTATION_VECTOR+32)\n#define VS_ID_HUMIDITY_WAKEUP (VS_ID_HUMIDITY+32)\n#define VS_ID_AMBIENT_TEMPERATURE_WAKEUP (VS_ID_AMBIENT_TEMPERATURE+32)\n#define VS_ID_UNCALIBRATED_MAGNETOMETER_WAKEUP (VS_ID_UNCALIBRATED_MAGNETOMETER+32)\n#define VS_ID_GAME_ROTATION_VECTOR_WAKEUP (VS_ID_GAME_ROTATION_VECTOR+32)\n#define VS_ID_UNCALIBRATED_GYROSCOPE_WAKEUP (VS_ID_UNCALIBRATED_GYROSCOPE+32)\n#define VS_ID_SIGNIFICANT_MOTION_WAKEUP (VS_ID_SIGNIFICANT_MOTION+32)\n#define VS_ID_STEP_DETECTOR_WAKEUP (VS_ID_STEP_DETECTOR+32)\n#define VS_ID_STEP_COUNTER_WAKEUP (VS_ID_STEP_COUNTER+32)\n#define VS_ID_GEOMAGNETIC_ROTATION_VECTOR_WAKEUP (VS_ID_GEOMAGNETIC_ROTATION_VECTOR+32)\n#define VS_ID_HEART_RATE_WAKEUP (VS_ID_HEART_RATE+32)\n#define VS_ID_TILT_DETECTOR_WAKEUP (VS_ID_TILT_DETECTOR+32)\n#define VS_ID_WAKE_GESTURE_WAKEUP (VS_ID_WAKE_GESTURE+32)\n#define VS_ID_GLANCE_GESTURE_WAKEUP (VS_ID_GLANCE_GESTURE+32)\n#define VS_ID_PICKUP_GESTURE_WAKEUP (VS_ID_PICKUP_GESTURE+32)\n#define VS_ID_CUS1_WAKEUP \t\t\t\t(VS_ID_CUS1+32)\n#define VS_ID_CUS2_WAKEUP \t\t\t (VS_ID_CUS2+32)\n#define VS_ID_CUS3_WAKEUP \t\t\t (VS_ID_CUS3+32)\n#define VS_ID_CUS4_WAKEUP \t\t\t(VS_ID_CUS4+32)\n#define VS_ID_CUS5_WAKEUP \t\t\t(VS_ID_CUS5+32)\n#define VS_ID_ACTIVITY_WAKEUP (VS_ID_ACTIVITY+32)\n\n#define VS_ID_DEBUG 245\n#define VS_ID_TIMESTAMP_LSW_WAKEUP 246\n#define VS_ID_TIMESTAMP_MSW_WAKEUP 247\n#define VS_ID_META_EVENT_WAKEUP 248\n#define VS_ID_BSX_C 249\n#define VS_ID_BSX_B 250\n#define VS_ID_BSX_A 251\n#define VS_ID_TIMESTAMP_LSW 252\n#define VS_ID_TIMESTAMP_MSW 253\n#define VS_ID_META_EVENT 254\n\n#endif /* BHY_UC_DRIVER_CONSTANTS_H_ */\n",
"bhy_uc_driver_types.h": "/*!\n * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * \n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n * \n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n * @file bhy_uc_driver_types.h\n *\n * @date 12/15/2016\n *\n * @brief header file of bhy_uc_driver.c\n * \n */\n\n\n#ifndef BHY_UC_DRIVER_TYPES_H_\n#define BHY_UC_DRIVER_TYPES_H_\n\n#include \"bhy_uc_driver_constants.h\"\n\n/****************************************************************************/\n/* MACRO */\n/****************************************************************************/\n/* system page */\n#define BHY_PAGE_SYSTEM 1\n#define BHY_PARAM_SYSTEM_META_EVENT_CTRL 1\n#define BHY_PARAM_SYSTEM_FIFO_CTRL 2\n#define BHY_PARAM_SYSTEM_STAUS_BANK_0 3\n#define BHY_PARAM_SYSTEM_STAUS_BANK_1 4\n#define BHY_PARAM_SYSTEM_STAUS_BANK_2 5\n#define BHY_PARAM_SYSTEM_STAUS_BANK_3 6\n#define BHY_PARAM_SYSTEM_CUSTOM_VERSION 24\n#define BHY_PARAM_SYSTEM_WAKE_UP_META_EVENT_CTRL 29\n#define BHY_PARAM_SYSTEM_HOST_IRQ_TIMESTAMP 30\n#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_STATUS 31\n#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_PRESENT 32\n#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_0 32\n#define BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_ACC 33\n\n#define VS_NON_WAKEUP 0\n#define VS_WAKEUP 32\n#define VS_FLUSH_NONE 0x00\n#define VS_FLUSH_ALL 0xFF\n#define VS_FLUSH_SINGLE 0x01\n\n#define META_EVENT_1_INT_ENABLE_BIT (1<<0)\n#define META_EVENT_1_ENABLE_BIT (1<<1)\n\n/****************************************************************************/\n/* ENUM */\n/****************************************************************************/\n/* follows section 9.4 table 14 of the BHI160 datasheet */\ntypedef enum {\n VS_TYPE_ACCELEROMETER = VS_ID_ACCELEROMETER,\n VS_TYPE_GEOMAGNETIC_FIELD = VS_ID_MAGNETOMETER,\n VS_TYPE_ORIENTATION = VS_ID_ORIENTATION,\n VS_TYPE_GYROSCOPE = VS_ID_GYROSCOPE,\n VS_TYPE_LIGHT = VS_ID_LIGHT,\n VS_TYPE_PRESSURE = VS_ID_BAROMETER,\n VS_TYPE_TEMPERATURE = VS_ID_TEMPERATURE,\n VS_TYPE_PROXIMITY = VS_ID_PROXIMITY,\n VS_TYPE_GRAVITY = VS_ID_GRAVITY,\n VS_TYPE_LINEAR_ACCELERATION = VS_ID_LINEAR_ACCELERATION,\n VS_TYPE_ROTATION_VECTOR = VS_ID_ROTATION_VECTOR,\n VS_TYPE_RELATIVE_HUMIDITY = VS_ID_HUMIDITY,\n VS_TYPE_AMBIENT_TEMPERATURE = VS_ID_AMBIENT_TEMPERATURE,\n VS_TYPE_MAGNETIC_FIELD_UNCALIBRATED = VS_ID_UNCALIBRATED_MAGNETOMETER,\n VS_TYPE_GAME_ROTATION_VECTOR = VS_ID_GAME_ROTATION_VECTOR,\n VS_TYPE_GYROSCOPE_UNCALIBRATED = VS_ID_UNCALIBRATED_GYROSCOPE,\n VS_TYPE_SIGNIFICANT_MOTION = VS_ID_SIGNIFICANT_MOTION,\n VS_TYPE_STEP_DETECTOR = VS_ID_STEP_DETECTOR,\n VS_TYPE_STEP_COUNTER = VS_ID_STEP_COUNTER,\n VS_TYPE_GEOMAGNETIC_ROTATION_VECTOR = VS_ID_GEOMAGNETIC_ROTATION_VECTOR,\n VS_TYPE_HEART_RATE = VS_ID_HEART_RATE,\n VS_TYPE_TILT = VS_ID_TILT_DETECTOR,\n VS_TYPE_WAKEUP = VS_ID_WAKE_GESTURE,\n VS_TYPE_GLANCE = VS_ID_GLANCE_GESTURE,\n VS_TYPE_PICKUP = VS_ID_PICKUP_GESTURE,\n VS_TYPE_CUS1 = VS_ID_CUS1,\n VS_TYPE_CUS2 = VS_ID_CUS2,\n VS_TYPE_CUS3 = VS_ID_CUS3,\n VS_TYPE_CUS4 = VS_ID_CUS4,\n VS_TYPE_CUS5 = VS_ID_CUS5,\n VS_TYPE_ACTIVITY_RECOGNITION = VS_ID_ACTIVITY\n} bhy_virtual_sensor_t;\n\ntypedef enum {\n BHY_META_EVENT_TYPE_NOT_USED = 0,\n BHY_META_EVENT_TYPE_FLUSH_COMPLETE = 1,\n BHY_META_EVENT_TYPE_SAMPLE_RATE_CHANGED = 2,\n BHY_META_EVENT_TYPE_POWER_MODE_CHANGED = 3,\n BHY_META_EVENT_TYPE_ERROR = 4,\n BHY_META_EVENT_TYPE_ALGORITHM = 5,\n /* IDs 6-10 are reserved */\n BHY_META_EVENT_TYPE_SENSOR_ERROR = 11,\n BHY_META_EVENT_TYPE_FIFO_OVERFLOW = 12,\n BHY_META_EVENT_TYPE_DYNAMIC_RANGE_CHANGED = 13,\n BHY_META_EVENT_TYPE_FIFO_WATERMARK = 14,\n BHY_META_EVENT_TYPE_SELF_TEST_RESULTS = 15,\n BHY_META_EVENT_TYPE_INITIALIZED = 16,\n\n} bhy_meta_event_type_t;\n\ntypedef enum {\n /* group 1 only read for host -s */\n BHY_GP_REG_20 = 0x4B,\n BHY_GP_REG_21 = 0x4C,\n BHY_GP_REG_22 = 0x4D,\n BHY_GP_REG_23 = 0x4E,\n BHY_GP_REG_24 = 0x4F,\n /* group 1 only read for host -e */\n /* group 2 read & write for host -s */\n BHY_GP_REG_31 = 0x56,\n BHY_GP_REG_32 = 0x57,\n BHY_GP_REG_33 = 0x58,\n BHY_GP_REG_34 = 0x59,\n BHY_GP_REG_35 = 0x5A,\n BHY_GP_REG_36 = 0x5B,\n /* group 2 read & write for host -e */\n /* group 3 read & write for host -s */\n BHY_GP_REG_46 = 0x65,\n BHY_GP_REG_47 = 0x66,\n BHY_GP_REG_48 = 0x67,\n BHY_GP_REG_49 = 0x68,\n BHY_GP_REG_50 = 0x69,\n BHY_GP_REG_51 = 0x6A,\n BHY_GP_REG_52 = 0x6B,\n /* group 3 read & write for host -e */\n} bhy_gp_register_type_t;\n\n/* follows section 15 of the BHI160 datasheet the order of this enumeration */\n/* is important, do not change it */\ntypedef enum {\n BHY_DATA_TYPE_PADDING = 0,\n BHY_DATA_TYPE_QUATERNION = 1,\n BHY_DATA_TYPE_VECTOR = 2,\n BHY_DATA_TYPE_SCALAR_U8 = 3,\n BHY_DATA_TYPE_SCALAR_U16 = 4,\n BHY_DATA_TYPE_SCALAR_S16 = 5,\n BHY_DATA_TYPE_SCALAR_U24 = 6,\n BHY_DATA_TYPE_SENSOR_EVENT = 7,\n BHY_DATA_TYPE_UNCALIB_VECTOR = 8,\n BHY_DATA_TYPE_META_EVENT = 9,\n BHY_DATA_TYPE_BSX = 10,\n BHY_DATA_TYPE_DEBUG = 11,\n BHY_DATA_TYPE_CUS1\t\t\t\t\t= 12,\n BHY_DATA_TYPE_CUS2\t\t\t\t\t= 13,\n BHY_DATA_TYPE_CUS3\t\t\t\t\t= 14,\n BHY_DATA_TYPE_CUS4\t\t\t\t\t= 15,\n BHY_DATA_TYPE_CUS5\t\t\t\t\t= 16,\n} bhy_data_type_t;\n\ntypedef enum {\n META_EVENT_IN_NON_WAKEUP_FIFO = 1,\n META_EVENT_IN_WAKEUP_FIFO = 29,\n} bhy_meta_event_fifo_type_t;\n\ntypedef enum\n{\n PHYSICAL_SENSOR_INDEX_ACC = 0,\n PHYSICAL_SENSOR_INDEX_MAG,\n PHYSICAL_SENSOR_INDEX_GYRO,\n PHYSICAL_SENSOR_COUNT\n} bhy_physical_sensor_index_type_t;\n\n/****************************************************************************/\n/* STRUCTRE DEFINITION */\n/****************************************************************************/\n\n/* definition of structures of all the data types */\ntypedef struct {\n uint8_t sensor_id;\n} bhy_data_padding_t;\n\ntypedef struct {\n uint8_t sensor_id;\n int16_t x;\n int16_t y;\n int16_t z;\n int16_t w;\n int16_t estimated_accuracy;\n} bhy_data_quaternion_t;\n\ntypedef struct {\n uint8_t sensor_id;\n int16_t x;\n int16_t y;\n int16_t z;\n uint8_t status;\n} bhy_data_vector_t;\n\ntypedef struct {\n uint8_t sensor_id;\n uint8_t data;\n} bhy_data_scalar_u8_t;\n\ntypedef struct {\n uint8_t sensor_id;\n uint16_t data;\n} bhy_data_scalar_u16_t;\n\ntypedef struct {\n uint8_t sensor_id;\n int16_t data;\n} bhy_data_scalar_s16_t;\n\ntypedef struct {\n uint8_t sensor_id;\n uint32_t data;\n} bhy_data_scalar_u24_t;\n\ntypedef struct {\n uint8_t sensor_id;\n} bhy_data_sensor_event_t;\n\ntypedef struct {\n uint8_t sensor_id;\n int16_t x;\n int16_t y;\n int16_t z;\n int16_t x_bias;\n int16_t y_bias;\n int16_t z_bias;\n uint8_t status;\n} bhy_data_uncalib_vector_t;\n\ntypedef struct {\n uint8_t meta_event_id;\n bhy_meta_event_type_t event_number;\n uint8_t sensor_type;\n uint8_t event_specific;\n} bhy_data_meta_event_t;\n\ntypedef struct {\n uint8_t sensor_id;\n int32_t x;\n int32_t y;\n int32_t z;\n uint32_t timestamp;\n} bhy_data_bsx_t;\n\ntypedef struct {\n uint8_t sensor_id;\n uint8_t data[13];\n} bhy_data_debug_t;\n\ntypedef struct {\n\tuint8_t sensor_id;\n\tint16_t deltaX;\n\tint16_t deltaY;\n\tint16_t deltaZ;\n\tint16_t confidencelevel;\n\tuint16_t direction;\n\tuint16_t stepCount;\n} bhy_data_pdr_t;\n\ntypedef struct {\n\tuint8_t sensor_id;\n\tuint8_t data[16];\n} bhy_data_custom_t;\n\n\n/* definition of a generic structure that can contain any data type it */\n/* occupies in RAM the size of the largest data structure, which is 18 bytes*/\n/* as of 08/04/2015 */\ntypedef union {\n bhy_data_padding_t data_padding;\n bhy_data_quaternion_t data_quaternion;\n bhy_data_vector_t data_vector;\n bhy_data_scalar_u8_t data_scalar_u8;\n bhy_data_scalar_u16_t data_scalar_u16;\n bhy_data_scalar_s16_t data_scalar_s16;\n bhy_data_scalar_u24_t data_scalar_u24;\n bhy_data_sensor_event_t data_sensor_event;\n bhy_data_uncalib_vector_t data_uncalib_vector;\n bhy_data_meta_event_t data_meta_event;\n bhy_data_bsx_t data_bsx;\n bhy_data_debug_t data_debug;\n\tbhy_data_custom_t data_custom;\n\tbhy_data_pdr_t data_pdr;\n} bhy_data_generic_t;\n\n#endif /* BHY_UC_DRIVER_TYPES_H_ */\n"
},
"objects": {
"bhi160.c": "#include \"bhi160.h\"\n#include \"bhy_support.h\"\n#include \"bhy.h\"\n#include \"bhy_uc_driver.h\"\n#include \"bhy1_fw.h\"\n\nenum BHI160_NDOF_Sensor\n{\n\tBHI160_NDOF_S_ORIENTATION = VS_TYPE_ORIENTATION,\n\tBHI160_NDOF_S_GRAVITY = VS_TYPE_GRAVITY,\n\tBHI160_NDOF_S_LINEAR_ACCELERATION = VS_TYPE_LINEAR_ACCELERATION,\n\tBHI160_NDOF_S_RATE_OF_ROTATION = VS_TYPE_GYROSCOPE,\n\tBHI160_NDOF_S_MAGNETIC_FIELD = VS_TYPE_GEOMAGNETIC_FIELD\n};\n\n#define FIFO_SIZE 300\n#define MAX_PACKET_LENGTH 18\n#define OUT_BUFFER_SIZE 60\n\n/** \\brief Translation matrix used to rotate axes of accelerometer and\n * gyroscope within BHI160.\n *\n * Can contain only values of -1, 0 or 1.\n */\n#define BHI160_NDOF_BHI160_AXIS_MAPPING \\\n { 0, -1, 0, \\\n 1, 0, 0, \\\n 0, 0, 1 }\n\n/** \\brief Translation matrix used to rotate axes of BMM150 magnetometer\n * to adjust for different package orientation on the PCB.\n *\n * Can contain only values of -1, 0 or 1.\n */\n#define BHI160_NDOF_BMM150_AXIS_MAPPING \\\n { -1, 0, 0, \\\n 0, 1, 0, \\\n 0, 0, -1 }\n\nstatic uint8_t bhi160_fifo[FIFO_SIZE];\nstatic uint16_t bhi160_accel_dyn_range = 4;\nstatic uint16_t bhi160_gyro_dyn_range = 2000;\nstatic uint16_t bhi160_mag_dyn_range = 1000;\nstatic uint8_t bhi160_bytes_left_in_fifo = 0;\nstatic uint16_t bytes_remaining = 0;\n\ntypedef void ( *BHI160_NDOF_SensorCallback )( bhy_data_generic_t *data,\n bhy_virtual_sensor_t sensor );\n\nvoid BMI160_MagDataCb( bhy_data_generic_t *data, bhy_virtual_sensor_t sensor );\nvoid BMI160_AccelDataCb( bhy_data_generic_t *data, bhy_virtual_sensor_t sensor );\nvoid BMI160_GyroDataCb( bhy_data_generic_t *data, bhy_virtual_sensor_t sensor );\n\nstatic BHI160_Config_t _BHI160_Config;\n\nstatic ATMO_3dFloatVector_t _BMI160_AccData, _BMI160_GyroData, _BMI160_MagData;\n\nstatic int32_t _BHI160_EnableSensor( enum BHI160_NDOF_Sensor sensor, BHI160_NDOF_SensorCallback cb, uint16_t sample_rate )\n{\n\tint32_t retval = bhy_install_sensor_callback( sensor, VS_WAKEUP, cb );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\treturn retval;\n\t}\n\n\tretval = bhy_enable_virtual_sensor( sensor, VS_WAKEUP,\n\t sample_rate, 0, VS_FLUSH_NONE, 0, 0 );\n\n\treturn retval;\n}\n\nstatic void _BHI160_DynamicRangeCallback( bhy_data_meta_event_t *data, bhy_meta_event_type_t event )\n{\n\tif ( event == BHY_META_EVENT_TYPE_DYNAMIC_RANGE_CHANGED )\n\t{\n\t\tstruct accel_physical_status_t accel;\n\t\tstruct gyro_physical_status_t gyro;\n\t\tstruct mag_physical_status_t mag;\n\n\t\tint32_t retval = bhy_get_physical_sensor_status( &accel, &gyro, &mag );\n\t\tASSERT_DEBUG( retval == BHY_SUCCESS );\n\n\t\tif ( retval == BHY_SUCCESS )\n\t\t{\n\t\t\tbhi160_accel_dyn_range = accel.accel_dynamic_range;\n\t\t\tbhi160_gyro_dyn_range = gyro.gyro_dynamic_range;\n\t\t\tbhi160_mag_dyn_range = mag.mag_dynamic_range;\n\t\t}\n\t}\n}\n\nvoid BMI160_MagDataCb( bhy_data_generic_t *data, bhy_virtual_sensor_t sensor )\n{\n\t_BMI160_MagData.x = data->data_vector.x / 32768.0f * 360.0f;\n\t_BMI160_MagData.y = data->data_vector.y / 32768.0f * 360.0f;\n\t_BMI160_MagData.z = data->data_vector.z / 32768.0f * 360.0f;\n}\n\nvoid BMI160_AccDataCb( bhy_data_generic_t *data, bhy_virtual_sensor_t sensor )\n{\n\t_BMI160_AccData.x = data->data_vector.x / 32768.0f * bhi160_accel_dyn_range;\n\t_BMI160_AccData.y = data->data_vector.y / 32768.0f * bhi160_accel_dyn_range;\n\t_BMI160_AccData.z = data->data_vector.z / 32768.0f * bhi160_accel_dyn_range;\n}\n\nvoid BMI160_GyroDataCb( bhy_data_generic_t *data, bhy_virtual_sensor_t sensor )\n{\n\t_BMI160_GyroData.x = data->data_vector.x / 32768.0f * bhi160_gyro_dyn_range;\n\t_BMI160_GyroData.y = data->data_vector.y / 32768.0f * bhi160_gyro_dyn_range;\n\t_BMI160_GyroData.z = data->data_vector.z / 32768.0f * bhi160_gyro_dyn_range;\n}\n\nstatic void _BHI160_FifoRoutine( void *arg )\n{\n\t( void )arg;\n\tuint8_t *fifoptr = bhi160_fifo;\n\tbhy_data_type_t packet_type = BHY_DATA_TYPE_PADDING;\n\tbhy_data_generic_t fifo_packet;\n\tuint16_t bytes_read = 0;\n\tBHY_RETURN_FUNCTION_TYPE result;\n\n\tbhy_read_fifo( bhi160_fifo + bhi160_bytes_left_in_fifo,\n\t FIFO_SIZE - bhi160_bytes_left_in_fifo, &bytes_read,\n\t &bytes_remaining );\n\tbytes_read += bhi160_bytes_left_in_fifo;\n\n\tdo\n\t{\n\t\t/* this function will call callbacks that are registered */\n\t\tresult = bhy_parse_next_fifo_packet( &fifoptr, &bytes_read, &fifo_packet,\n\t\t &packet_type );\n\n\t\t/* prints all the debug packets */\n\t\tif ( packet_type == BHY_DATA_TYPE_DEBUG )\n\t\t{\n\t\t\tbhy_print_debug_packet( &fifo_packet.data_debug, bhy_printf );\n\t\t}\n\n\t\t/* the logic here is that if doing a partial parsing of the fifo, then we should not parse */\n\t\t/* the last 18 bytes (max length of a packet) so that we don't try to parse an incomplete */\n\t\t/* packet */\n\t}\n\twhile ( ( result == BHY_SUCCESS )\n\t && ( bytes_read > ( bytes_remaining ? MAX_PACKET_LENGTH : 0 ) ) );\n\n\tbhi160_bytes_left_in_fifo = 0;\n\n\tif ( bytes_remaining )\n\t{\n\t\t/* shifts the remaining bytes to the beginning of the buffer */\n\t\twhile ( bhi160_bytes_left_in_fifo < bytes_read )\n\t\t{\n\t\t\tbhi160_fifo[bhi160_bytes_left_in_fifo++] = *( fifoptr++ );\n\t\t}\n\t}\n}\n\n\n\nATMO_BOOL_t BHI160_Init( BHI160_Config_t *config )\n{\n\tmemcpy( &_BHI160_Config, config, sizeof( _BHI160_Config ) );\n\n\tATMO_GPIO_Config_t gpioConfig;\n\tgpioConfig.pinMode = ATMO_GPIO_PinMode_Input_HighImpedance;\n\tATMO_GPIO_SetPinConfiguration( config->gpioInstance, config->intPin, &gpioConfig );\n\n\tbhy_set_driver_instance( config->i2cInstance );\n\n\tint32_t retval = bhy_driver_init( bhy1_fw );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160 low level driver init failed\\r\\n\" );\n\t\treturn false;\n\t}\n\n\t// Wait for reset\n\twhile ( ATMO_GPIO_Read( config->gpioInstance, config->intPin ) == ATMO_GPIO_PinState_High )\n\t{\n\n\t}\n\n\twhile ( ATMO_GPIO_Read( config->gpioInstance, config->intPin ) == ATMO_GPIO_PinState_Low )\n\t{\n\n\t}\n\n\tATMO_PLATFORM_DebugPrint( \"BHI160 Reset Complete\\r\\n\" );\n\n\t// Register for interrupts\n\t//ATMO_GPIO_RegisterInterruptCallback(config->gpioInstance, config->intPin, ATMO_GPIO_InterruptTrigger_RisingEdge, _BHI160_FifoRoutine);\n\n\tATMO_PLATFORM_DebugPrint( \"Interrupts registered\\r\\n\" );\n\n\t/* Remap sensor axes based on relative placement of BHI160 and BMM150 on the\n\t* board */\n\tint8_t bhi160_mapping[9] = BHI160_NDOF_BHI160_AXIS_MAPPING;\n\tint8_t bmm150_mapping[9] = BHI160_NDOF_BMM150_AXIS_MAPPING;\n\n\tretval = bhy_mapping_matrix_set( PHYSICAL_SENSOR_INDEX_ACC, bhi160_mapping );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160: Error mapping accelerometer\\r\\n\" );\n\t\treturn false;\n\t}\n\n\tretval = bhy_mapping_matrix_set( PHYSICAL_SENSOR_INDEX_GYRO, bhi160_mapping );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160: Error mapping gyroscope\\r\\n\" );\n\t\treturn false;\n\t}\n\n\tretval = bhy_mapping_matrix_set( PHYSICAL_SENSOR_INDEX_MAG, bmm150_mapping );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160: Error mapping magnetometer\\r\\n\" );\n\t\treturn false;\n\t}\n\n\tretval = _BHI160_EnableSensor( BHI160_NDOF_S_ORIENTATION, BMI160_MagDataCb, 5 );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160: Error setting magnetometer callback\\r\\n\" );\n\t\treturn false;\n\t}\n\n\tretval = _BHI160_EnableSensor( BHI160_NDOF_S_LINEAR_ACCELERATION, BMI160_AccDataCb, 5 );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160: Error setting accelerometer callback\\r\\n\" );\n\t\treturn false;\n\t}\n\n\tretval = _BHI160_EnableSensor( BHI160_NDOF_S_RATE_OF_ROTATION, BMI160_GyroDataCb, 5 );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160: Error setting gyro callback\\r\\n\" );\n\t\treturn false;\n\t}\n\n\tretval = bhy_install_meta_event_callback( BHY_META_EVENT_TYPE_DYNAMIC_RANGE_CHANGED, &_BHI160_DynamicRangeCallback );\n\n\tif ( retval != BHY_SUCCESS )\n\t{\n\t\tATMO_PLATFORM_DebugPrint( \"BHI160: Error setting dynamic range callback\\r\\n\" );\n\t\treturn false;\n\t}\n\n\tATMO_AddTickCallback( _BHI160_FifoRoutine );\n\n\tATMO_PLATFORM_DebugPrint( \"BHI160 successfully initialized\\r\\n\" );\n\n\treturn true;\n}\n\nATMO_BOOL_t BHI160_GetData( ATMO_3dFloatVector_t *acceleration, ATMO_3dFloatVector_t *gyro, ATMO_3dFloatVector_t *mag )\n{\n\tif ( acceleration != NULL )\n\t{\n\t\tmemcpy( acceleration, &_BMI160_AccData, sizeof( ATMO_3dFloatVector_t ) );\n\t}\n\n\tif ( gyro != NULL )\n\t{\n\t\tmemcpy( gyro, &_BMI160_GyroData, sizeof( ATMO_3dFloatVector_t ) );\n\t}\n\n\tif ( mag != NULL )\n\t{\n\t\tmemcpy( mag, &_BMI160_MagData, sizeof( ATMO_3dFloatVector_t ) );\n\t}\n\n\treturn true;\n}\n\n\n",
"bhy.c": "/*\n****************************************************************************\n* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n*\n* File : bhy.c\n*\n* Date : 2016/01/22\n*\n* Revision : 1.0.4 $\n*\n* Usage: Sensor Driver for BHY sensor\n*\n****************************************************************************\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions are met:\n*\n* Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n*\n* Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n*\n* Neither the name of the copyright holder nor the names of the\n* contributors may be used to endorse or promote products derived from\n* this software without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n* CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n* DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n* OR CONTRIBUTORS BE LIABLE FOR ANY\n* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n* OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n* ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n*\n* The information provided is believed to be accurate and reliable.\n* The copyright holder assumes no responsibility\n* for the consequences of use\n* of such information nor for any infringement of patents or\n* other rights of third parties which may result from its use.\n* No license is granted by implication or otherwise under any patent or\n* patent rights of the copyright holder.\n*\n**************************************************************************/\n/*! file <BHY >\n brief <Sensor driver for BHY> */\n#include \"bhy.h\"\n/* static structure for bhy */\nstatic struct bhy_t *p_bhy;\n/* contain the saved parameters data*/\nstatic struct parameter_read_buffer_t read_buffer;\n/* contain the load parameters data*/\nstatic struct parameter_write_buffer_t write_buffer;\n/* Assign the sensor status bank*/\nstruct sensor_status_bank_t sensor_status_bank;\n\n/*!\n * @brief\n * This function is used for initialize\n * bus read and bus write functions\n * and device address\n * product id is read in the register 0x90 bit from 0 to 7\n *\n * @param bhy : structure pointer\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n * @note\n * While changing the parameter of the bhy_t\n * consider the following point:\n * Changing the reference value of the parameter\n * will changes the local copy or local reference\n * make sure your changes will not\n * affect the reference value of the parameter\n * (Better case don't change the reference value of the parameter)\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_init(struct bhy_t *bhy)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* assign bhy ptr */\n p_bhy = bhy;\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_PRODUCT_ID_ADDR,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n /* read product Id */\n p_bhy->product_id = v_data_u8;\n return com_rslt;\n}\n/*!\n * @brief\n * This API write the data to\n * the given register\n *\n *\n * @param v_addr_u8 -> Address of the register\n * @param v_data_u8 -> The data from the register\n * @param v_len_u8 -> no of bytes to read\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n */\nBHY_RETURN_FUNCTION_TYPE bhy_write_reg(u8 v_addr_u8,\nu8 *v_data_u8, u16 v_len_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* check the p_bhy structure as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* write data from register*/\n com_rslt =\n p_bhy->BHY_BUS_WRITE_FUNC(p_bhy->device_addr,\n v_addr_u8, v_data_u8, v_len_u16);\n }\n return com_rslt;\n}\n/*!\n * @brief\n * This API reads the data from\n * the given register\n *\n *\n * @param v_addr_u8 -> Address of the register\n * @param v_data_u8 -> The data from the register\n * @param v_len_u8 -> no of bytes to read\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n */\nBHY_RETURN_FUNCTION_TYPE bhy_read_reg(u8 v_addr_u8,\nu8 *v_data_u8, u16 v_len_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* check the p_bhy structure as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* Read data from register*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n v_addr_u8, v_data_u8, v_len_u16);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the FIFO flush from the register 0x32\n * bit 0 to 7\n *\n *\n * @param v_fifo_flush_u8 : The value of fifo flush\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_fifo_flush(u8 *v_fifo_flush_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_FIFO_FLUSH__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n *v_fifo_flush_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_FIFO_FLUSH);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to set the FIFO flush from the register 0x32\n * bit 0 to 7\n *\n *\n * @param v_fifo_flush_u8 : The value of fifo flush\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_fifo_flush(u8 v_fifo_flush_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_FIFO_FLUSH__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_FIFO_FLUSH,\n v_fifo_flush_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_FIFO_FLUSH__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the chip control from the register 0x34\n * bit 0 to 7\n * @note Chip control used to provide the control fundamental\n * behaviour of the chip\n *\n * @param v_chipcontrol_u8 : The value of chip control\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_chip_control(u8 *v_chipcontrol_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy structure as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the chip control status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_CHIP_CONTROL__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n *v_chipcontrol_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_CHIP_CONTROL);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to set the chip control from the register 0x34\n * bit 0 to 7\n * @note Chip control used to provide the control fundamental\n * behaviour of the chip\n *\n * @param v_chipcontrol_u8 : The value of chip control\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_chip_control(u8 v_chipcontrol_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy structure as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_CHIP_CONTROL__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_CHIP_CONTROL,\n v_chipcontrol_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_CHIP_CONTROL__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the host status from the register 0x35\n * bit 0 to 7\n *\n *\n * @param v_algo_standby_u8 : The value of algorithm standby duration\n * @param v_algo_id_u8 : The value of algorithm id\n * @param v_host_interface_id_u8 : The value of host interface id\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_host_status(\nu8 *v_algo_standby_u8, u8 *v_algo_id_u8,\nu8 *v_host_interface_id_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the host status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_STATUS__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n /* read the host algo status*/\n *v_algo_standby_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_STATUS_ALGO_STANDBY);\n /* read the host algo id */\n *v_algo_id_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_BHY_HOST_STATUS_ALGO_ID);\n /* host interface id */\n *v_host_interface_id_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_BHY_HOST_INTERFACE_ID);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the interrupt status from the register 0x36\n * bit 0 to 7\n *\n *\n * @param v_host_int_u8 :\n * The value of host interrupt status\n * @param v_wakeup_water_mark_u8 :\n * The value of wakeup watermark status\n * @param v_wakeup_latency_u8 :\n * The value of wakeup latency status\n * @param v_wakeup_immediate_u8 :\n * The value of wakeup immediate status\n * @param v_non_wakeup_water_mark_u8 :\n * The value of non wakeup watermark status\n * @param v_non_wakeup_latency_u8 :\n * The value of non wakeup latency status\n * @param v_non_wakeup_immediate_u8 :\n * The value of non wakeup immediate\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_interrupt_status(\nu8 *v_host_int_u8,\nu8 *v_wakeup_water_mark_u8, u8 *v_wakeup_latency_u8,\nu8 *v_wakeup_immediate_u8, u8 *v_non_wakeup_water_mark_u8,\nu8 *v_non_wakeup_latency_u8, u8 *v_non_wakeup_immediate_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the interrupt status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_INT_STATUS__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n /* read the host interrupt status*/\n *v_host_int_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_BHY_INT_STATUS_HOST_INTR);\n /* read the wakeup watermark interrupt status*/\n *v_wakeup_water_mark_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_WM);\n /* read the wakeup latency interrupt status*/\n *v_wakeup_latency_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_LATENCY);\n /* read the wakeup immediate interrupt status*/\n *v_wakeup_immediate_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_BHY_INT_STATUS_WAKEUP_IMMEDIATE);\n /* read the non wakeup watermark interrupt status*/\n *v_non_wakeup_water_mark_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_BHY_INT_STATUS_NON_WAKEUP_WM);\n /* read the non wakeup latency interrupt status*/\n *v_non_wakeup_latency_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_INT_STATUS_NON_WAKEUP_LATENCY);\n /* read the non wakeup immediate status*/\n *v_non_wakeup_immediate_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_INT_STATUS_NON_WAKEUP_IMMEDIATE);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the chip status from the register 0x37\n * bit 0 to 7\n *\n *\n *\n * @param v_eeprom_detected_u8 : The value of eeprom\n * detected status\n * @param v_ee_upload_done_u8 : The value of ee_upload\n * done status\n * @param v_ee_upload_error_u8 : The value of ee_upload\n * done error\n * @param v_firmware_idle_u8 : The value of firmware error status\n * @param v_no_eeprom_u8 : The value of no eeprom status\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_chip_status(\nu8 *v_eeprom_detected_u8,\nu8 *v_ee_upload_done_u8, u8 *v_ee_upload_error_u8,\nu8 *v_firmware_idle_u8, u8 *v_no_eeprom_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the chip status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_CHIP_STATUS__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n /* read eeprom detected status*/\n *v_eeprom_detected_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_CHIP_STATUS_EEPROM_DETECTED);\n /* read eeprom upload done status*/\n *v_ee_upload_done_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_DONE);\n /* read eeprom upload error status*/\n *v_ee_upload_error_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_CHIP_STATUS_EE_UPLOAD_ERROR);\n /* read firmware idle status*/\n *v_firmware_idle_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_CHIP_STATUS_FIRMWARE_IDLE);\n /* read no eeprom detected status*/\n *v_no_eeprom_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_CHIP_STATUS_NO_EEPROM);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the bytes remaining from the register 0x38\n * and 0x39 bit 0 to 7\n *\n *\n * @param v_bytes_remaining_u16 : The value of bytes remaining\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n * @note This indicates how many bytes are available in the FIFO buffer\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_read_bytes_remaining(u16 *v_bytes_remaining_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* Array contains the bytes reaming of FIFO lSB and MSB data\n v_data_u8[LSB_ZERO] - LSB\n v_data_u8[MSB_ONE] - MSB*/\n u8 v_data_u8[BHY_BYTES_REMAINING_SIZE] = {BHY_INIT_VALUE,\n BHY_INIT_VALUE};\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read bytes remaining data */\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_BYTES_REMAINING_LSB_ADDR,\n v_data_u8, BHY_BYTES_REMAINING_LENGTH);\n /* get the bytes remaining data*/\n *v_bytes_remaining_u16 = (u16)\n ((v_data_u8[BHY_BYTES_REMAINING_MSB]\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (v_data_u8[BHY_BYTES_REMAINING_LSB]));\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the parameter\n * acknowledgement from the register 0x3A\n * bit 0 to 7\n *\n *\n * @param v_parameter_acknowledge_u8:\n * The value of parameter acknowledgement\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_parameter_acknowledge(\nu8 *v_parameter_acknowledge_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the parameter acknowledgement*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_PARAMETER_ACKNOWLEDGE_ADDR,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n *v_parameter_acknowledge_u8 = v_data_u8;\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the parameter\n * page select from the register 0x54\n * bit 0 to 7\n *\n *\n * @param v_page_select_u8 : The value of parameter page selection\n * page information | value\n * ------------------------|----------\n * BHY_PAGE_SELECT_PARAMETER_PAGE | 0\n * BHY_PAGE_SELECT_PARAMETER_SIZE | 1\n *\n * @param v_parameter_page_u8 : The value of page selection\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_parameter_page_select(\nu8 v_page_select_u8, u8 *v_parameter_page_u8)\n{\n/* variable used for return the status of communication result*/\nBHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\nu8 v_data_u8 = BHY_INIT_VALUE;\n/* check the p_bhy pointer as NULL*/\nif (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the parameter page information*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n switch (v_page_select_u8) {\n case BHY_PAGE_SELECT_PARAMETER_PAGE:\n *v_parameter_page_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_PAGE);\n break;\n case BHY_PAGE_SELECT_PARAMETER_SIZE:\n *v_parameter_page_u8\n = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_PARAMETER_PAGE_SELECT_PARAMETER_SIZE);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n }\nreturn com_rslt;\n}\n/*!\n * @brief API used to set the parameter\n * page select from the register 0x54\n * bit 0 to 7\n *\n *\n * @param v_page_select_u8 : The value of parameter page selection\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_parameter_page_select(\nu8 v_page_select_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n v_data_u8 = v_page_select_u8;\n /* read the parameter page information*/\n com_rslt = p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\n return com_rslt;\n }\n\n/*!\n * @brief API used to get the host interface control\n * from the register 0x55\n * bit 0 to 7\n *\n *\n *\n * @param v_algo_standby_req_u8 : The value of algorithm standby\n * request\n * @param v_abort_transfer_u8 : The value of abort transfer\n * @param v_update_transfer_cnt_u8 : The value of update\n * transfer count\n * @param v_wakeup_fifo_intr_disable_u8 :\n * The value of wakeup fifo host\n * interrupt disable\n * @param v_ned_coordinates_u8 : The value of NED coordinates\n * @param v_ap_suspend_u8 : The value of AP suspended\n * @param v_sensor_selftest_u8 : The value of sensor self test\n * @param v_non_wakeup_fifo_intr_disable_u8:\n * The value of non wakeup fifo host\n * interrupt disable\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_host_interface_control(\nu8 *v_algo_standby_req_u8,\nu8 *v_abort_transfer_u8, u8 *v_update_transfer_cnt_u8,\nu8 *v_wakeup_fifo_intr_disable_u8, u8 *v_ned_coordinates_u8,\nu8 *v_ap_suspend_u8, u8 *v_sensor_selftest_u8,\nu8 *v_non_wakeup_fifo_intr_disable_u8)\n{\n/* variable used for return the status of communication result*/\nBHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\nu8 v_data_u8 = BHY_INIT_VALUE;\n/* check the p_bhy pointer as NULL*/\nif (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the host interrupt status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ADDR,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n /* read algorithm standby request status*/\n *v_algo_standby_req_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST);\n /* read host interrupt control status*/\n *v_abort_transfer_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER);\n /* read update transfer control status*/\n *v_update_transfer_cnt_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT);\n /* read wakeup fifo host interrupt disable status*/\n *v_wakeup_fifo_intr_disable_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE);\n /* read ned coordinates status*/\n *v_ned_coordinates_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE);\n /* read AP suspended status*/\n *v_ap_suspend_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND);\n /* read self test status*/\n *v_sensor_selftest_u8 = BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST);\n /* read non wakeup fifo host interrupt disable status*/\n *v_non_wakeup_fifo_intr_disable_u8 =\n BHY_GET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE);\n }\nreturn com_rslt;\n}\n/*!\n * @brief API used to set the host interface control\n * from the register 0x55\n * bit 0 to 7\n *\n *\n * @param v_host_interface_select_u8 : The value of host interface selection\n * host interface | value\n * -----------------------------------|----------\n * BHY_HOST_ALGO_STANDBY_REQUEST | 0\n * BHY_HOST_ABORT_TRANSFER | 1\n * BHY_HOST_UPDATE_TRANSFER_COUNT | 2\n * BHY_HOST_WAKEUP_FIFO_DISABLE | 3\n * BHY_HOST_NED_COORDINATE | 4\n * BHY_HOST_AP_SUSPEND | 5\n * BHY_HOST_SELFTEST | 6\n * BHY_HOST_NON_WAKEUP_FIFO_DISABLE | 7\n *\n * @param v_host_interface_status_u8 : The value of host interface\n * Data | status\n * -----------------| -----------\n * 0 | DISABLE\n * 1 | ENABLE\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_host_interface_control(\nu8 v_host_interface_select_u8, u8 v_host_interface_status_u8)\n{\n/* variable used for return the status of communication result*/\nBHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\nu8 v_data_u8 = BHY_INIT_VALUE;\n/* check the p_bhy pointer as NULL*/\nif (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n} else {\nswitch (v_host_interface_select_u8) {\ncase BHY_HOST_ALGO_STANDBY_REQUEST:\n /* write algorithm standby request status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ALGO_STABDY_REQUEST__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ncase BHY_HOST_ABORT_TRANSFER:\n /* write host interrupt control status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_ABORT_TRANSFER__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ncase BHY_HOST_UPDATE_TRANSFER_COUNT:\n /* write update transfer control status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_TRANSFER_COUNT__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ncase BHY_HOST_WAKEUP_FIFO_DISABLE:\n /* write wakeup fifo host interrupt disable status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_WAKEUP_FIFO_DISABLE__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ncase BHY_HOST_NED_COORDINATE:\n /* write ned coordinates status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NED_COORDINATE__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ncase BHY_HOST_AP_SUSPEND:\n /* write AP suspended status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_AP_SUSPEND__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ncase BHY_HOST_SELFTEST:\n /* write self test status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_SELFTEST__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ncase BHY_HOST_NON_WAKEUP_FIFO_DISABLE:\n/* write non wakeup fifo host interrupt disable status*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n if (BHY_SUCCESS == com_rslt) {\n v_data_u8 = BHY_SET_BITSLICE(v_data_u8,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE,\n v_host_interface_status_u8);\n com_rslt += p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_HOST_INTERFACE_CONTROL_NON_WAKEUP_FIFO_DISABLE__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbreak;\ndefault:\n com_rslt = BHY_OUT_OF_RANGE;\nbreak;\n}\n}\nreturn com_rslt;\n}\n/*!\n * @brief API used to get the parameter\n * request from the register 0x64\n * bit 0 to 7\n *\n *\n * @param v_parameter_request_u8 : The value of parameter request\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_parameter_request(\nu8 *v_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the load parameter request rate*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_PARAMETER_REQUEST_ADDR,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n *v_parameter_request_u8 = v_data_u8;\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the parameter\n * request from the register 0x64\n * bit 0 to 7\n *\n *\n * @param v_parameter_request_u8 : The value of parameter request\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_parameter_request(\nu8 v_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* write load parameter request*/\n v_data_u8 = v_parameter_request_u8;\n com_rslt = p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_LOAD_PARAMETER_REQUEST__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the host IRQ time stamp\n * request from the register 0x6C to 0x6F\n * bit 0 to 7\n *\n *\n * @param v_host_irq_timestamp_u32 : The value of host irq time stamp\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_host_irq_timestamp(\nu32 *v_host_irq_timestamp_u32)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8[BHY_HOST_IRQ_TIMESTAMP_SIZE] = {BHY_INIT_VALUE,\n BHY_INIT_VALUE, BHY_INIT_VALUE, BHY_INIT_VALUE};\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the load parameter request rate*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_BHY_HOST_IRQ_TIMESTAMP_ADDR,\n v_data_u8, BHY_HOST_IRQ_TIMESTAMP_SIZE);\n *v_host_irq_timestamp_u32 =\n (u32)((v_data_u8[BHY_HOST_IRQ_TIMESTAMP_MSB_DATA]\n << BHY_SHIFT_BIT_POSITION_BY_24_BITS)\n |(v_data_u8[BHY_HOST_IRQ_TIMESTAMP_XXLSB_DATA]\n << BHY_SHIFT_BIT_POSITION_BY_16_BITS)\n |(v_data_u8[BHY_HOST_IRQ_TIMESTAMP_XLSB_DATA]\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (v_data_u8[BHY_HOST_IRQ_TIMESTAMP_LSB_DATA]));\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the ROM version\n * request from the register 0x70 to 0x71\n * bit 0 to 7\n *\n *\n * @param v_rom_version_u16 : The value ROM version\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_rom_version(u16 *v_rom_version_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8[BHY_ROM_VERSION_SIZE] = {BHY_INIT_VALUE,\n BHY_INIT_VALUE};\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the load parameter request rate*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_ROM_VERSION_ADDR,\n v_data_u8, BHY_ROM_VERSION_SIZE);\n *v_rom_version_u16 =\n (u16)((v_data_u8[BHY_ROM_VERSION_MSB_DATA]\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (v_data_u8[BHY_ROM_VERSION_LSB_DATA]));\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the RAM version\n * request from the register 0x72 to 0x73\n * bit 0 to 7\n *\n *\n * @param v_ram_version_u16 : The value RAM version\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_ram_version(\nu16 *v_ram_version_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8[BHY_RAM_VERSION_SIZE] = {BHY_INIT_VALUE,\n BHY_INIT_VALUE};\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the load parameter request rate*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_RAM_VERSION_ADDR,\n v_data_u8, BHY_RAM_VERSION_SIZE);\n *v_ram_version_u16 =\n (u16)((v_data_u8[BHY_RAM_VERSION_MSB_DATA]\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (v_data_u8[BHY_RAM_VERSION_LSB_DATA]));\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the product id\n * request from the register 0x90\n * bit 0 to 7\n *\n *\n * @param v_product_id_u8 : The value of product id\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_product_id(u8 *v_product_id_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the load parameter request rate*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_PRODUCT_ID_ADDR,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n *v_product_id_u8 = v_data_u8;\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the revision id\n * request from the register 0x91\n * bit 0 to 7\n *\n *\n * @param v_revision_id_u8 : The value of revision id\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_revision_id(u8 *v_revision_id_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* read the load parameter request rate*/\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_REVISION_ID_ADDR,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n *v_revision_id_u8 = v_data_u8;\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the CRC host\n * request from the register 0x91\n * bit 0 to 7\n *\n *\n * @param v_crc_host_u32 : The value of CRC host\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_crc_host(u32 *v_crc_host_u32)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* Array contains the sensor time it is 32 bit data\n a_data_u8[0] - crc HOST\n a_data_u8[1] - crc HOST\n a_data_u8[2] - crc HOST\n a_data_u8[3] - crc HOST\n */\n u8 a_data_u8[BHY_CRC_HOST_SIZE] = {BHY_INIT_VALUE,\n BHY_INIT_VALUE, BHY_INIT_VALUE, BHY_INIT_VALUE};\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_CRC_HOST_ADDR,\n a_data_u8, BHY_CRC_HOST_LENGTH);\n *v_crc_host_u32 = (u32)\n (((u32)a_data_u8[BHY_CRC_HOST_MSB]\n << BHY_SHIFT_BIT_POSITION_BY_24_BITS) |\n ((u32)a_data_u8[BHY_CRC_HOST_XXLSB]\n << BHY_SHIFT_BIT_POSITION_BY_16_BITS)\n |(a_data_u8[BHY_CRC_HOST_XLSB]\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (a_data_u8[BHY_CRC_HOST_LSB]));\n }\n return com_rslt;\n}\n/*!\n * @brief API used to set the reset\n * request from the register 0x9B\n * bit 0 to 7\n *\n *\n * @param v_reset_request_u8 : The value of parameter request\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_reset_request(u8 v_reset_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n v_data_u8 = v_reset_request_u8;\n /* write load parameter request*/\n com_rslt = p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_RESET_REQUEST__REG,\n &v_data_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\n return com_rslt;\n}\n/*!\n * @brief API used to flash the ram patch\n *\n *\n * @param memory : The value of data from the\n * ram patch.\n * @param v_file_length_u32 : Length of the patch data\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_initialize(u8 *memory, u32 v_file_length_u32)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_upload_addr = BHY_UPLOAD_DATA;\n u8 v_chip_control_u8 = BHY_CHIP_CTRL_ENABLE_1;\n u32 v_crc_from_memory_u32 = BHY_INIT_VALUE;\n u32 v_length_to_process_u32 = BHY_INIT_VALUE;\n u32 v_crc_host_u32 = BHY_INIT_VALUE;\n u32 write_data = BHY_INIT_VALUE;\n u8 data_from_mem[BHY_SIGNATURE_MEM_LEN];\n u8 data_byte[BHY_RAM_WRITE_LENGTH];\n u32 read_index_u8 = BHY_INIT_VALUE;\n s32 reverse_index_s32 = BHY_INIT_VALUE;\n u32 bytes_to_write_u8 = BHY_RAM_WRITE_LENGTH;\n u32 read_bytes_index = BHY_INIT_VALUE;\n u32 write_index_u32 = BHY_INIT_VALUE;\n u32 write_ram_index = BHY_INIT_VALUE;\n u32 index_mem = BHY_INIT_VALUE;\n u32 write_length = BHY_INIT_VALUE;\n u32 data_to_process = BHY_INIT_VALUE;\n u8 init_array_data = BHY_INIT_VALUE;\n /* initialize the array*/\n for (init_array_data = 0; init_array_data < BHY_SIGNATURE_MEM_LEN; init_array_data++)\n {\n data_from_mem[init_array_data] = BHY_INIT_VALUE;\n }\n for (init_array_data = BHY_INIT_VALUE; init_array_data < BHY_RAM_WRITE_LENGTH; init_array_data++)\n {\n data_byte[init_array_data] = BHY_INIT_VALUE;\n }\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy)\n {\n com_rslt = BHY_NULL;\n }\n else\n {\n /* Assign the memory data into the local array*/\n for (read_index_u8 = BHY_INIT_VALUE; read_index_u8 <= BHY_SIGNATURE_LENGTH; read_index_u8++)\n {\n data_from_mem[read_index_u8] = *(memory+read_index_u8);\n }\n /* Verify the signature of the data*/\n if ((data_from_mem[BHY_SIGNATURE_1] == BHY_IMAGE_SIGNATURE1)\n && (data_from_mem[BHY_SIGNATURE_2] == BHY_IMAGE_SIGNATURE2))\n {\n com_rslt = BHY_SUCCESS;\n }\n else\n {\n com_rslt = BHY_ERROR;\n }\n /* read the CRC data from memory */\n v_crc_from_memory_u32 = (u32)\n (((u32)data_from_mem[BHY_CRC_HOST_FILE_MSB]\n << BHY_SHIFT_BIT_POSITION_BY_24_BITS) |\n ((u32)data_from_mem[BHY_CRC_HOST_FILE_XXLSB]\n << BHY_SHIFT_BIT_POSITION_BY_16_BITS)\n |(data_from_mem[BHY_CRC_HOST_FILE_XLSB]\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (data_from_mem[BHY_CRC_HOST_FILE_LSB]));\n /* Remove the first 16 bytes*/\n data_to_process = v_file_length_u32 - BHY_SIGNATURE_LENGTH;\n /* data to write for length calculation*/\n v_length_to_process_u32 = (data_to_process / BHY_RAM_WRITE_LENGTH);\n read_index_u8 = BHY_SIGNATURE_LENGTH;\n read_bytes_index = BHY_INIT_READ_BYTES;\n for (write_index_u32 = BHY_INIT_VALUE; write_index_u32 < v_length_to_process_u32;)\n {\n /* reverse the data*/\n if (read_index_u8 <= read_bytes_index && read_bytes_index <= data_to_process)\n {\n for (reverse_index_s32 = bytes_to_write_u8 - BHY_INIT_BYTE_MINUS_ONE;\n reverse_index_s32 >= BHY_INIT_VALUE;)\n {\n data_byte[reverse_index_s32] = *(memory + read_index_u8);\n read_index_u8++;\n reverse_index_s32--;\n }\n }\n /* write the data into the register*/\n read_bytes_index = read_bytes_index + BHY_RAM_WRITE_LENGTH;\n reverse_index_s32 = BHY_INIT_VALUE;\n\n for (write_ram_index = BHY_INIT_VALUE; write_ram_index <= BHY_CHECK_BYTE;)\n {\n *(memory + index_mem) = data_byte[write_ram_index];\n index_mem++;\n write_ram_index++;\n }\n write_index_u32++;\n }\n /* set the reset as 0x01*/\n com_rslt = bhy_set_reset_request(BHY_RESET_ENABLE);\n com_rslt += bhy_write_reg(BHY_I2C_REG_CHIP_CONTROL_ADDR,\n &v_chip_control_u8, BHY_GEN_READ_WRITE_LENGTH);\n /* set the upload data*/\n com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_0_ADDR,\n &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);\n com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_1_ADDR,\n &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);\n /* write the chip control register as 0x02*/\n write_length =\n data_to_process / BHY_RAM_WRITE_LENGTH_API;\n read_index_u8 = BHY_INIT_VALUE;\n /* write the memory of data */\n if (com_rslt == BHY_SUCCESS) {\n for (read_index_u8 = BHY_INIT_VALUE; read_index_u8 < write_length; read_index_u8++)\n {\n com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_DATA_ADDR, \\\n (u8 *)(memory + write_data), \\\n BHY_RAM_WRITE_LENGTH_API);\n write_data = write_data + BHY_RAM_WRITE_LENGTH_API;\n }\n }\n /* Check the CRC success*/\n com_rslt = bhy_get_crc_host(&v_crc_host_u32);\n if (v_crc_from_memory_u32 == v_crc_host_u32)\n {\n com_rslt = BHY_SUCCESS;\n }\n else\n {\n com_rslt = BHY_ERROR;\n }\n /* disable upload mode*/\n v_chip_control_u8 = BHY_CHIP_CTRL_ENABLE_2;\n /* write the chip control register as 0x02*/\n com_rslt += bhy_write_reg(BHY_I2C_REG_CHIP_CONTROL_ADDR, &v_chip_control_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\n return com_rslt;\n}\n\nBHY_RETURN_FUNCTION_TYPE bhy_initialize_from_rom( const u8 *memory, const u32 v_file_length_u32)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_upload_addr = BHY_UPLOAD_DATA;\n u8 v_chip_control_u8 = BHY_CHIP_CTRL_ENABLE_1;\n u32 v_crc_from_memory_u32 = BHY_INIT_VALUE;\n u32 v_crc_host_u32 = BHY_INIT_VALUE;\n u32 write_data = BHY_INIT_VALUE;\n u8 data_from_mem[BHY_SIGNATURE_MEM_LEN];\n u8 data_byte[BHY_RAM_WRITE_LENGTH_API];\n u32 read_index_u8 = BHY_INIT_VALUE;\n u32 reverse_index_u32 = BHY_INIT_VALUE;\n u32 reverse_block_index_u32 = BHY_INIT_VALUE;\n u32 write_length = BHY_INIT_VALUE;\n u32 data_to_process = BHY_INIT_VALUE;\n u32 packet_length = BHY_INIT_VALUE;;\n u16 signature_flag = 0;\n u16 rom_version = 0;\n u8 rom_ver_exp = 0;\n u8 i = BHY_INIT_VALUE;\n /* initialize the array*/\n for (i=0; i < BHY_SIGNATURE_MEM_LEN; i++)\n {\n data_from_mem[i] = BHY_INIT_VALUE;\n }\n for (i = BHY_INIT_VALUE; i < BHY_RAM_WRITE_LENGTH; i++)\n {\n data_byte[i] = BHY_INIT_VALUE;\n }\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy)\n {\n com_rslt = BHY_NULL;\n }\n else\n {\n /* Assign the memory data into the local array*/\n for (read_index_u8 = BHY_INIT_VALUE;read_index_u8 <= BHY_SIGNATURE_LENGTH; read_index_u8++)\n {\n data_from_mem[read_index_u8] = *(memory+read_index_u8);\n }\n /* Verify the signature of the data*/\n if ((data_from_mem[BHY_SIGNATURE_1] == BHY_IMAGE_SIGNATURE1)\n && (data_from_mem[BHY_SIGNATURE_2] == BHY_IMAGE_SIGNATURE2))\n {\n com_rslt = BHY_SUCCESS;\n }\n else\n {\n com_rslt = BHY_ERROR;\n goto bhy_init_from_rom_return;\n }\n /* Verify the signature of the data*/\n signature_flag = data_from_mem[BHY_SIG_FLAG_1_POS] + ((u16)data_from_mem[BHY_SIG_FLAG_2_POS]<<8);\n rom_ver_exp = BHY_GET_ROMVEREXP (signature_flag);\n bhy_get_rom_version(&rom_version);\n if(BHY_ROM_VER_DI01 == rom_ver_exp)\n {\n if(BHY_ROM_VERSION_DI01 == rom_version)\n {\n com_rslt = BHY_SUCCESS;\n }\n else\n {\n com_rslt = BHY_RAMPATCH_NOT_MATCH;\n goto bhy_init_from_rom_return;\n }\n }\n else if(BHY_ROM_VER_DI03 == rom_ver_exp)\n {\n if(BHY_ROM_VERSION_DI03 == rom_version)\n {\n com_rslt = BHY_SUCCESS;\n }\n else\n {\n com_rslt = BHY_RAMPATCH_NOT_MATCH;\n goto bhy_init_from_rom_return;\n }\n }\n else\n {\n com_rslt = BHY_RAMPATCH_NOT_SUPPORT;\n goto bhy_init_from_rom_return;\n }\n /* read the CRC data from memory */\n v_crc_from_memory_u32 = (u32)\n (((u32)data_from_mem[BHY_CRC_HOST_FILE_MSB]\n << BHY_SHIFT_BIT_POSITION_BY_24_BITS) |\n ((u32)data_from_mem[BHY_CRC_HOST_FILE_XXLSB]\n << BHY_SHIFT_BIT_POSITION_BY_16_BITS)\n |(data_from_mem[BHY_CRC_HOST_FILE_XLSB]\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (data_from_mem[BHY_CRC_HOST_FILE_LSB]));\n /* Remove the first 16 bytes*/\n data_to_process = v_file_length_u32 - BHY_SIGNATURE_LENGTH;\n\n /* set the reset as 0x01*/\n com_rslt = bhy_set_reset_request(BHY_RESET_ENABLE);\n com_rslt += bhy_write_reg(BHY_I2C_REG_CHIP_CONTROL_ADDR, &v_chip_control_u8, BHY_GEN_READ_WRITE_LENGTH);\n /* set the upload data*/\n com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_0_ADDR, &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);\n com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_1_ADDR, &v_upload_addr, BHY_GEN_READ_WRITE_LENGTH);\n /* write the chip control register as 0x02*/\n write_length = data_to_process / BHY_RAM_WRITE_LENGTH_API;\n read_index_u8 = BHY_INIT_VALUE;\n\n /* write the memory of data */\n /*skips first 16 bytes*/\n write_data += 16;\n if (com_rslt == BHY_SUCCESS)\n {\n for (read_index_u8 = BHY_INIT_VALUE; read_index_u8 <= write_length; read_index_u8++)\n {\n packet_length = (read_index_u8 == write_length) ?\n (data_to_process % BHY_RAM_WRITE_LENGTH_API) / BHY_RAM_WRITE_LENGTH :\n BHY_RAM_WRITE_LENGTH_API / BHY_RAM_WRITE_LENGTH;\n\n /*reverse the data*/\n for (reverse_block_index_u32 = 1; reverse_block_index_u32 <=packet_length ;reverse_block_index_u32++)\n {\n for (reverse_index_u32 = 0; reverse_index_u32 <BHY_RAM_WRITE_LENGTH; reverse_index_u32++)\n {\n data_byte[reverse_index_u32+((reverse_block_index_u32-1)*BHY_RAM_WRITE_LENGTH)] =\n *(memory + write_data + BHY_RAM_WRITE_LENGTH * reverse_block_index_u32 - (reverse_index_u32+1));\n }\n }\n\n\t\t\t\tif(packet_length != 0)\n com_rslt += bhy_write_reg(BHY_I2C_REG_UPLOAD_DATA_ADDR,data_byte,packet_length * BHY_RAM_WRITE_LENGTH);\n\n write_data = write_data + (packet_length * BHY_RAM_WRITE_LENGTH);\n }\n }\n\n /* Check the CRC success*/\n com_rslt = bhy_get_crc_host(&v_crc_host_u32);\n if (v_crc_from_memory_u32 == v_crc_host_u32)\n {\n com_rslt = BHY_SUCCESS;\n }\n else\n {\n com_rslt = BHY_CRC_ERROR;\n goto bhy_init_from_rom_return;\n }\n /* disable upload mode*/\n v_chip_control_u8 = BHY_CHIP_CTRL_ENABLE_2;\n /* write the chip control register as 0x02*/\n com_rslt += bhy_write_reg(BHY_I2C_REG_CHIP_CONTROL_ADDR,&v_chip_control_u8, BHY_GEN_READ_WRITE_LENGTH);\n }\nbhy_init_from_rom_return:\n return com_rslt;\n}\n/*!\n* @brief API used assign the data of meta event byte 0 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte0\n*\n*/\nstatic void bhy_assign_meta_event_byte0(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = v_meta_event_data_u8;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte3 = read_buffer.parameter_3;\n write_buffer.write_parameter_byte4 = read_buffer.parameter_4;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_5;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte7 = read_buffer.parameter_7;\n write_buffer.write_parameter_byte8 = read_buffer.parameter_8;\n}\n/*!\n* @brief API used assign the data of meta event byte 1 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte1\n*\n*/\nstatic void bhy_assign_meta_event_byte1(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = v_meta_event_data_u8;\n write_buffer.write_parameter_byte3 = read_buffer.parameter_3;\n write_buffer.write_parameter_byte4 = read_buffer.parameter_4;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_5;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte7 = read_buffer.parameter_7;\n write_buffer.write_parameter_byte8 = read_buffer.parameter_8;\n}\n/*!\n* @brief API used assign the data of meta event byte 2 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte2\n*\n*/\nstatic void bhy_assign_meta_event_byte2(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte3 = v_meta_event_data_u8;\n write_buffer.write_parameter_byte4 = read_buffer.parameter_4;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_5;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte7 = read_buffer.parameter_7;\n write_buffer.write_parameter_byte8 = read_buffer.parameter_8;\n}\n/*!\n* @brief API used assign the data of meta event byte 3 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte3\n*\n*/\nstatic void bhy_assign_meta_event_byte3(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte3 = read_buffer.parameter_3;\n write_buffer.write_parameter_byte4 = v_meta_event_data_u8;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_5;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte7 = read_buffer.parameter_7;\n write_buffer.write_parameter_byte8 = read_buffer.parameter_8;\n}\n/*!\n* @brief API used assign the data of meta event byte 4 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte4\n*\n*/\nstatic void bhy_assign_meta_event_byte4(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte3 = read_buffer.parameter_3;\n write_buffer.write_parameter_byte4 = read_buffer.parameter_4;\n write_buffer.write_parameter_byte5 = v_meta_event_data_u8;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte7 = read_buffer.parameter_7;\n write_buffer.write_parameter_byte8 = read_buffer.parameter_8;\n}\n/*!\n* @brief API used assign the data of meta event byte 5 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte5\n*\n*/\nstatic void bhy_assign_meta_event_byte5(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte3 = read_buffer.parameter_3;\n write_buffer.write_parameter_byte4 = read_buffer.parameter_4;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte6 = v_meta_event_data_u8;\n write_buffer.write_parameter_byte7 = read_buffer.parameter_7;\n write_buffer.write_parameter_byte8 = read_buffer.parameter_8;\n}\n/*!\n* @brief API used assign the data of meta event byte 6 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte6\n*\n*/\nstatic void bhy_assign_meta_event_byte6(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte3 = read_buffer.parameter_3;\n write_buffer.write_parameter_byte4 = read_buffer.parameter_4;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte7 = v_meta_event_data_u8;\n write_buffer.write_parameter_byte8 = read_buffer.parameter_8;\n}\n/*!\n* @brief API used assign the data of meta event byte 7 data\n*\n* @param v_meta_event_data_u8: The value of meta event byte7\n*\n*/\nstatic void bhy_assign_meta_event_byte7(u8 v_meta_event_data_u8)\n{\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte3 = read_buffer.parameter_3;\n write_buffer.write_parameter_byte4 = read_buffer.parameter_4;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n write_buffer.write_parameter_byte7 = read_buffer.parameter_7;\n write_buffer.write_parameter_byte8 = v_meta_event_data_u8;\n}\n/*!\n * @brief API used to set the meta event for\n * non wakeup FIFO control from\n * system page-1 parameter 1\n *\n *\n * @param v_meta_event_u8 : The value of meta event selection\n * meta event | value\n * --------------------------|---------------\n * BHY_META_EVENT_1 | 1\n * BHY_META_EVENT_2 | 2\n * BHY_META_EVENT_3 | 3\n * BHY_META_EVENT_4 | 4\n * BHY_META_EVENT_5 | 5\n * BHY_META_EVENT_6 | 6\n * BHY_META_EVENT_7 | 7\n * BHY_META_EVENT_8 | 8\n * BHY_META_EVENT_9 | 9\n * BHY_META_EVENT_10 | 10\n * BHY_META_EVENT_11 | 11\n * BHY_META_EVENT_12 | 12\n * BHY_META_EVENT_13 | 13\n * BHY_META_EVENT_14 | 14\n * BHY_META_EVENT_15 | 15\n * BHY_META_EVENT_16 | 16\n * BHY_META_EVENT_17 | 17\n * BHY_META_EVENT_18 | 18\n * BHY_META_EVENT_19 | 19\n * BHY_META_EVENT_20 | 20\n * BHY_META_EVENT_21 | 21\n * BHY_META_EVENT_22 | 22\n * BHY_META_EVENT_23 | 23\n * BHY_META_EVENT_24 | 24\n * BHY_META_EVENT_25 | 25\n * BHY_META_EVENT_26 | 26\n * BHY_META_EVENT_27 | 27\n * BHY_META_EVENT_28 | 28\n * BHY_META_EVENT_29 | 29\n * BHY_META_EVENT_30 | 30\n * BHY_META_EVENT_31 | 31\n * BHY_META_EVENT_32 | 32\n\n *\n * @param v_event_type_u8 : The value of\n * interrupt or event selection\n * value | Event\n * -------------------------|----------------\n * BHY_META_EVENT_INTR_ENABLE | 0\n * BHY_META_EVENT_ENABLE | 1\n *\n * @param v_input_data_u8 : The value of meta event\n * @note Value for write each event in a bit\n * value | Event or Interrupt\n * ---------------|----------------------\n * 0 | DISABLE EVENT\n * 1 | ENABLE EVENT\n *\n * @param v_meta_parameter_request_u8: The value of parameter\n * for wakeup or non wakeup fifo\n *\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_meta_event(\nu8 v_meta_event_u8,\nu8 v_input_data_u8, u8 v_event_type_u8,\nu8 v_meta_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_meta_bytes_u8 = BHY_INIT_VALUE;\n /* read the stored meta events using saved parameter bytes*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_1, v_meta_parameter_request_u8);\n if (BHY_SUCCESS == com_rslt) {\n /* switch for selecting the different meta events*/\n switch (v_meta_event_u8) {\n /* case for meta event one*/\n case BHY_META_EVENT_1:\n /* switch for selecting interrupt or event*/\n switch (v_event_type_u8) {\n /* case for event enable*/\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 1, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n /* case for interrupt enable*/\n case BHY_META_INTR_ENABLE:\n /* set the meta event 1, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 0))) | v_input_data_u8);\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n /* case for meta event 2*/\n case BHY_META_EVENT_2:\n /* case for interrupt or event enable*/\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 2, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 2, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n /* case for meta event 3*/\n case BHY_META_EVENT_3:\n switch (v_event_type_u8) {\n /* case for event or interrupt enable*/\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 3, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 3, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n /* case for meta event four*/\n case BHY_META_EVENT_4:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 4, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 4, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_1 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte0(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_5:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 5, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 5, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 0)))|(v_input_data_u8 << 0));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_6:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 6, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 6, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_7:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 7, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 7, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_8:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 8, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 8, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_2 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte1(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_9:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 9, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 9, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 0)))|(v_input_data_u8 << 0));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_10:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 10, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 10, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_11:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 11, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 11, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_12:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 12, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 12, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_3 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte2(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_13:\n /* set the meta event 13, event enable*/\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 13, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 0)))|(v_input_data_u8 << 0));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_14:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 14, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 14, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_15:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 15, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 15, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_16:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 16, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 16, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_4 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte3(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_17:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 17, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 17, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 0)))|(v_input_data_u8 << 0));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_18:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 18, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 18, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_19:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 19, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 19, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_20:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 20, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 20, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_5 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte4(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_21:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 21, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 21, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 0)))|(v_input_data_u8 << 0));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_22:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 22, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 22, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_23:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 23, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 23, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_24:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 24, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 24, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_6 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte5(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_25:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 25, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 25, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 0)))|(v_input_data_u8 << 0));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_26:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 26, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 26, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_27:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 27, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 27, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_28:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 28, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 28, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_7 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte6(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_29:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 29, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 1)))|(v_input_data_u8 << 1));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 29, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 0)))|(v_input_data_u8 << 0));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_30:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 30, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 3)))|(v_input_data_u8 << 3));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 30, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 2)))|(v_input_data_u8 << 2));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_31:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 31, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 5)))|(v_input_data_u8 << 5));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 31, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 4)))|(v_input_data_u8 << 4));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_32:\n switch (v_event_type_u8) {\n case BHY_META_EVENT_ENABLE:\n /* set the meta event 32, event enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 7)))|(v_input_data_u8 << 7));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n case BHY_META_INTR_ENABLE:\n /* set the meta event 32, interrupt enable*/\n v_meta_bytes_u8 = ((read_buffer.parameter_8 & (~(1 << 6)))|(v_input_data_u8 << 6));\n bhy_assign_meta_event_byte7(v_meta_bytes_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n }\n /* write the meta event values to the meta event bytes*/\n com_rslt += bhy_write_parameter_bytes(\n BHY_PAGE_1, (v_meta_parameter_request_u8+0x80));\n return com_rslt;\n}\n/*!\n * @brief API used to get the meta event control from\n * system page-1 parameter 1\n *\n * @param v_meta_event_u8 : The value of meta event selection\n * meta event | value\n * --------------------------|---------------\n * BHY_META_EVENT_1 | 1\n * BHY_META_EVENT_2 | 2\n * BHY_META_EVENT_3 | 3\n * BHY_META_EVENT_4 | 4\n * BHY_META_EVENT_5 | 5\n * BHY_META_EVENT_6 | 6\n * BHY_META_EVENT_7 | 7\n * BHY_META_EVENT_8 | 8\n * BHY_META_EVENT_9 | 9\n * BHY_META_EVENT_10 | 10\n * BHY_META_EVENT_11 | 11\n * BHY_META_EVENT_12 | 12\n * BHY_META_EVENT_13 | 13\n * BHY_META_EVENT_14 | 14\n * BHY_META_EVENT_15 | 15\n * BHY_META_EVENT_16 | 16\n * BHY_META_EVENT_17 | 17\n * BHY_META_EVENT_18 | 18\n * BHY_META_EVENT_19 | 19\n * BHY_META_EVENT_20 | 20\n * BHY_META_EVENT_21 | 21\n * BHY_META_EVENT_22 | 22\n * BHY_META_EVENT_23 | 23\n * BHY_META_EVENT_24 | 24\n * BHY_META_EVENT_25 | 25\n * BHY_META_EVENT_26 | 26\n * BHY_META_EVENT_27 | 27\n * BHY_META_EVENT_28 | 28\n * BHY_META_EVENT_29 | 29\n * BHY_META_EVENT_30 | 30\n * BHY_META_EVENT_31 | 31\n * BHY_META_EVENT_32 | 32\n *\n * @param meta_intr :\n * The value of meta event interrupt selection\n *\n * @param meta_event :\n * The value of meta event event selection\n *\n * @param v_event_type_u8 : The value of\n * interrupt or event selection\n * value | Event\n * -------------------------|----------------\n * BHY_META_EVENT_INTR_ENABLE | 0\n * BHY_META_EVENT_ENABLE | 1\n *\n * @param v_meta_parameter_request_u8: The value of parameter request\n * for wakeup or non wakeup fifo\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_meta_event(\nu8 v_meta_event_u8, u8 v_event_type_u8,\nu8* meta_event_intr,\nu8* meta_event_event,\nu8 v_meta_parameter_request_u8)\n{\n/* variable used for return the status of communication result*/\nBHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\nu8 v_meta_event_byte_0_u8 = BHY_INIT_VALUE;\nu8 v_meta_event_byte_1_u8 = BHY_INIT_VALUE;\nu8 v_meta_event_byte_2_u8 = BHY_INIT_VALUE;\nu8 v_meta_event_byte_3_u8 = BHY_INIT_VALUE;\nu8 v_meta_event_byte_4_u8 = BHY_INIT_VALUE;\nu8 v_meta_event_byte_5_u8 = BHY_INIT_VALUE;\nu8 v_meta_event_byte_6_u8 = BHY_INIT_VALUE;\nu8 v_meta_event_byte_7_u8 = BHY_INIT_VALUE;\n/* check the p_bhy pointer as NULL*/\nif (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n} else {\n /* input as page 1 and parameter 1 for system page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_1, v_meta_parameter_request_u8);\n v_meta_event_byte_0_u8 = read_buffer.parameter_1;\n v_meta_event_byte_1_u8 = read_buffer.parameter_2;\n v_meta_event_byte_2_u8 = read_buffer.parameter_3;\n v_meta_event_byte_3_u8 = read_buffer.parameter_4;\n v_meta_event_byte_4_u8 = read_buffer.parameter_5;\n v_meta_event_byte_5_u8 = read_buffer.parameter_6;\n v_meta_event_byte_6_u8 = read_buffer.parameter_7;\n v_meta_event_byte_7_u8 = read_buffer.parameter_8;\n switch (v_meta_event_u8) {\n case BHY_META_EVENT_1:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_0_u8 &\n BHY_META_EVENT1_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_0_u8 &\n BHY_META_EVENT1_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_2:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_0_u8 &\n BHY_META_EVENT2_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_0_u8 &\n BHY_META_EVENT2_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_3:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_0_u8 &\n BHY_META_EVENT3_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_0_u8 &\n BHY_META_EVENT3_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_4:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_0_u8 &\n BHY_META_EVENT4_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_0_u8 &\n BHY_META_EVENT4_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_5:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_1_u8 &\n BHY_META_EVENT5_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_1_u8 &\n BHY_META_EVENT5_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_6:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_1_u8 &\n BHY_META_EVENT6_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_1_u8 &\n BHY_META_EVENT6_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_7:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_1_u8 &\n BHY_META_EVENT7_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_1_u8 &\n BHY_META_EVENT7_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_8:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_1_u8 &\n BHY_META_EVENT8_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_1_u8 &\n BHY_META_EVENT8_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_9:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_2_u8 &\n BHY_META_EVENT9_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_2_u8 &\n BHY_META_EVENT9_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_10:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_2_u8 &\n BHY_META_EVENT10_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_2_u8 &\n BHY_META_EVENT10_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_11:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_2_u8 &\n BHY_META_EVENT11_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_2_u8 &\n BHY_META_EVENT11_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_12:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_2_u8 &\n BHY_META_EVENT12_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_2_u8 &\n BHY_META_EVENT12_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_13:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_3_u8 &\n BHY_META_EVENT13_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_3_u8 &\n BHY_META_EVENT13_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_14:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_3_u8 &\n BHY_META_EVENT14_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_3_u8 &\n BHY_META_EVENT14_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_15:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_3_u8 &\n BHY_META_EVENT15_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_3_u8 &\n BHY_META_EVENT15_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_16:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_3_u8 &\n BHY_META_EVENT16_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_3_u8 &\n BHY_META_EVENT16_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_17:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_4_u8 &\n BHY_META_EVENT17_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_4_u8 &\n BHY_META_EVENT17_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_18:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_4_u8 &\n BHY_META_EVENT18_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_4_u8 &\n BHY_META_EVENT18_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_19:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_4_u8 &\n BHY_META_EVENT19_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_4_u8 &\n BHY_META_EVENT19_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_20:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_4_u8 &\n BHY_META_EVENT20_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_4_u8 &\n BHY_META_EVENT20_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_21:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_5_u8 &\n BHY_META_EVENT21_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_5_u8 &\n BHY_META_EVENT21_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_22:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_5_u8 &\n BHY_META_EVENT22_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_5_u8 &\n BHY_META_EVENT22_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_23:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_5_u8 &\n BHY_META_EVENT23_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_5_u8 &\n BHY_META_EVENT23_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_24:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_5_u8 &\n BHY_META_EVENT24_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_5_u8 &\n BHY_META_EVENT24_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_25:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_6_u8 &\n BHY_META_EVENT25_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_6_u8 &\n BHY_META_EVENT25_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_26:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_6_u8 &\n BHY_META_EVENT26_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_6_u8 &\n BHY_META_EVENT26_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_27:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_6_u8 &\n BHY_META_EVENT27_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_6_u8 &\n BHY_META_EVENT27_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_28:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_6_u8 &\n BHY_META_EVENT28_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_6_u8 &\n BHY_META_EVENT28_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_29:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n (v_meta_event_byte_7_u8 &\n BHY_META_EVENT29_INTR_ENABLE);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_7_u8 &\n BHY_META_EVENT29_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_30:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_7_u8 &\n BHY_META_EVENT30_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_7_u8 &\n BHY_META_EVENT30_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_31:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_7_u8 &\n BHY_META_EVENT31_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_7_u8 &\n BHY_META_EVENT31_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n case BHY_META_EVENT_32:\n switch (v_event_type_u8) {\n case BHY_META_INTR_ENABLE:\n *meta_event_intr = (u8)\n ((v_meta_event_byte_7_u8 &\n BHY_META_EVENT32_INTR_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_06_BITS);\n break;\n case BHY_META_EVENT_ENABLE:\n *meta_event_event = (u8)\n ((v_meta_event_byte_7_u8 &\n BHY_META_EVENT32_EVENT_ENABLE)\n >> BHY_SHIFT_BIT_POSITION_BY_07_BITS);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n}\nreturn com_rslt;\n}\n/*!\n * @brief API used to get the fifo water mark from\n * system page-1 parameter 2\n *\n *\n * @param v_parameter_u8 :\n * The value of fifo water mark wakeup or non-wakeup selection\n * water mark | value\n * --------------------------|---------------\n * FIFO_WM_WAKEUP | 0\n * FIFO_WM_NON_WAKEUP | 1\n *\n * @param v_fifo_water_mark_u16: The value of fifo water mark\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_fifo_water_mark(u8 v_parameter_u8, u16 *v_fifo_water_mark_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_fifo_wm_wakeup_lsb_u8 = BHY_INIT_VALUE;\n u8 v_fifo_wm_wakeup_msb_u8 = BHY_INIT_VALUE;\n u8 v_fifo_wm_non_wakeup_lsb_u8 = BHY_INIT_VALUE;\n u8 v_fifo_wm_non_wakeup_msb_u8 = BHY_INIT_VALUE;\n /* input as page 1 and parameter 2 for system page*/\n com_rslt = bhy_read_parameter_bytes( BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_2);\n if (BHY_SUCCESS == com_rslt)\n {\n switch (v_parameter_u8)\n {\n case BHY_FIFO_WATER_MARK_WAKEUP:\n /* fifo wakeup water mark*/\n v_fifo_wm_wakeup_lsb_u8 = read_buffer.parameter_1;\n v_fifo_wm_wakeup_msb_u8 = read_buffer.parameter_2;\n *v_fifo_water_mark_u16 = (u16)((v_fifo_wm_wakeup_msb_u8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\\\n |(v_fifo_wm_wakeup_lsb_u8));\n break;\n case BHY_FIFO_WATER_MARK_NON_WAKEUP:\n /* fifo non wakeup water mark*/\n v_fifo_wm_non_wakeup_lsb_u8 = read_buffer.parameter_5;\n v_fifo_wm_non_wakeup_msb_u8 = read_buffer.parameter_6;\n *v_fifo_water_mark_u16 = (u16)((v_fifo_wm_non_wakeup_msb_u8<< BHY_SHIFT_BIT_POSITION_BY_08_BITS)\\\n |(v_fifo_wm_non_wakeup_lsb_u8));\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n }\n return com_rslt;\n}\n/*!\n * @brief API used to set the fifo water mark from\n * system page-1 parameter 2\n *\n *\n * @param v_parameter_u8 :\n * The value of fifo water mark wakeup or non-wakeup selection\n * water mark | value\n * --------------------------|---------------\n * FIFO_WM_WAKEUP | 0\n * FIFO_WM_NON_WAKEUP | 1\n *\n * @param v_fifo_water_mark_u16: The value of fifo water mark\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_fifo_water_mark(u8 v_parameter_u8, u16 v_fifo_water_mark_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_fifo_wm_lsb_u8 = BHY_INIT_VALUE;\n u8 v_fifo_wm_msb_u8 = BHY_INIT_VALUE;\n /* read the fifo water mark using saved parameter bytes*/\n com_rslt = bhy_read_parameter_bytes( BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_2);\n if (BHY_SUCCESS == com_rslt)\n {\n v_fifo_wm_lsb_u8 = (u8)(v_fifo_water_mark_u16 & BHY_MASK_LSB_DATA);\n v_fifo_wm_msb_u8 = (u8)((v_fifo_water_mark_u16 & BHY_MASK_MSB_DATA)>> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n switch (v_parameter_u8)\n {\n /* fifo wakeup water mark*/\n case BHY_FIFO_WATER_MARK_WAKEUP:\n write_buffer.write_parameter_byte1 = v_fifo_wm_lsb_u8;\n write_buffer.write_parameter_byte2 = v_fifo_wm_msb_u8;\n write_buffer.write_parameter_byte5 = read_buffer.parameter_5;\n write_buffer.write_parameter_byte6 = read_buffer.parameter_6;\n break;\n /* fifo non wakeup water mark*/\n case BHY_FIFO_WATER_MARK_NON_WAKEUP:\n write_buffer.write_parameter_byte1 = read_buffer.parameter_1;\n write_buffer.write_parameter_byte2 = read_buffer.parameter_2;\n write_buffer.write_parameter_byte5 = v_fifo_wm_lsb_u8;\n write_buffer.write_parameter_byte6 = v_fifo_wm_msb_u8;\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n }\n com_rslt += bhy_write_parameter_bytes(\n BHY_PAGE_1, BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2);\n return com_rslt;\n}\n/*!\n * @brief API used to get the fifo size from\n * system page-1 parameter 2\n * @note wakeup - bytes from 2 and 3\n * @note non wakeup - bytes from 6 and 7\n *\n *\n * @param v_fifo_size_select_u8 :\n * The value of fifo size mark wakeup or non-wakeup selection\n * water mark | value\n * --------------------------|---------------\n * BHY_FIFO_SIZE_WAKEUP | 0\n * BHY_FIFO_SIZE_NON_WAKEUP | 1\n *\n * @param v_fifo_size_u16 : The value of fifo size\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_fifo_size(\nu8 v_fifo_size_select_u8, u16 *v_fifo_size_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_fifo_size_wakeup_lsb_u8 = BHY_INIT_VALUE;\n u8 v_fifo_size_wakeup_msb_u8 = BHY_INIT_VALUE;\n u8 v_fifo_size_non_wakeup_lsb_u8 = BHY_INIT_VALUE;\n u8 v_fifo_size_non_wakeup_msb_u8 = BHY_INIT_VALUE;\n /* check the p_bhy pointer as NULL*/\n if (BHY_NULL_PTR == p_bhy) {\n com_rslt = BHY_NULL;\n } else {\n /* input as page 1 and parameter 2 for system page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_2);\n if (BHY_SUCCESS == com_rslt) {\n switch (v_fifo_size_select_u8) {\n case BHY_FIFO_SIZE_WAKEUP:\n /* fifo size in wakeup*/\n v_fifo_size_wakeup_lsb_u8 =\n read_buffer.parameter_3;\n v_fifo_size_wakeup_msb_u8 =\n read_buffer.parameter_4;\n *v_fifo_size_u16 =\n (u16)((v_fifo_size_wakeup_msb_u8\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n |(v_fifo_size_wakeup_lsb_u8));\n break;\n case BHY_FIFO_SIZE_NON_WAKEUP:\n /* fifo size in non wakeup*/\n v_fifo_size_non_wakeup_lsb_u8 =\n read_buffer.parameter_7;\n v_fifo_size_non_wakeup_msb_u8 =\n read_buffer.parameter_8;\n *v_fifo_size_u16 =\n (u16)((v_fifo_size_non_wakeup_msb_u8\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n |(v_fifo_size_non_wakeup_lsb_u8));\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n }\n }\n return com_rslt;\n}\n/*!\n * @brief API used to assign the sensor status bank data\n *\n *\n * @param v_sensor_status_u8 :\n * The value for saved parameter data\n *\n *\n * @return Nothing\n *\n *\n*/\nstatic void bhy_assign_sensor_status_bank(u8 v_sensor_status_u8)\n{\n /* Assign the sensor status bank*/\n /* data available*/\n sensor_status_bank.data_available = (u8)\n (v_sensor_status_u8\n & BHY_SENSOR_BANK_STATUS_DATA_AVAILABLE);\n /* i2c nack*/\n sensor_status_bank.i2c_nack = (u8)\n ((v_sensor_status_u8\n & BHY_SENSOR_BANK_STATUS_I2C_NACK)\n >> BHY_SHIFT_BIT_POSITION_BY_01_BIT);\n /* device id error*/\n sensor_status_bank.device_id_error = (u8)\n ((v_sensor_status_u8\n & BHY_SENSOR_BANK_STATUS_DEVICE_ID_ERROR)\n >> BHY_SHIFT_BIT_POSITION_BY_02_BITS);\n /* transient error*/\n sensor_status_bank.transient_error = (u8)\n ((v_sensor_status_u8\n & BHY_SENSOR_BANK_STATUS_TRANSIENT_ERROR)\n >> BHY_SHIFT_BIT_POSITION_BY_03_BITS);\n /* data lost*/\n sensor_status_bank.data_lost = (u8)\n ((v_sensor_status_u8\n & BHY_SENSOR_BANK_STATUS_DATA_LOST)\n >> BHY_SHIFT_BIT_POSITION_BY_04_BITS);\n /* sensor power mode*/\n sensor_status_bank.sensor_power_mode = (u8)\n ((v_sensor_status_u8\n & BHY_SENSOR_BANK_STATUS_POWER_MODE)\n >> BHY_SHIFT_BIT_POSITION_BY_05_BITS);\n\n}\n/*!\n * @brief API used to get the sensor status bank from\n * system page-1 parameter 3 to 6\n * @note Sensor status bank 0 : parameter 3 contains 1 to 16 sensor type\n * @note Sensor status bank 1 : parameter 4 contains 17 to 32 sensor type\n * @note Sensor status bank 2 : parameter 5 contains 33 to 48 sensor type\n * @note Sensor status bank 3 : parameter 6 contains 49 to 64 sensor type\n *\n *\n * @param v_sensor_type_u8 :\n * The value of sensor status bank sensor type selection\n * v_sensor_type_u8 | value\n * -----------------------------------|---------------\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_1 | 0\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_2 | 1\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_3 | 3\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_4 | 4\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_5 | 5\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_6 | 6\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_7 | 7\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_8 | 8\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_9 | 9\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_10 | 10\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_11 | 11\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_12 | 12\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_13 | 13\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_14 | 14\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_15 | 15\n * BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_16 | 16\n *\n *\n * @param v_sensor_status_parameter_u8 :\n * The value of sensor status bank parameter selection\n * parameter | value\n * -------------------------------|-----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_sensor_status_bank(\nu8 v_sensor_status_parameter_u8, u8 v_sensor_type_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_data_u8 = BHY_INIT_VALUE;\n /* input as page 1 and parameter\n 3(4 or 5 or 6)for system page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_1, v_sensor_status_parameter_u8);\n if (BHY_SUCCESS == com_rslt) {\n switch (v_sensor_type_u8) {\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_1:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_1;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_2:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_2;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_3:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_3;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_4:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_4;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_5:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_5;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_6:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_6;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_7:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_7;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_8:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_8;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_9:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_9;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_10:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_10;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_11:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_11;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_12:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_12;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_13:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_13;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_14:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_14;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_15:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_15;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n case BHY_SENSOR_STATUS_BANK_SENSOR_TYPE_16:\n /* sensor status of data available*/\n v_data_u8 = read_buffer.parameter_16;\n bhy_assign_sensor_status_bank(v_data_u8);\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the host IRQ time\n * stamp and current time stamp from\n * system page-1 parameter 30\n * Host IRQ time stamp bytes 0 to 3\n * Current time stamp bytes 4 to 7\n *\n *\n * @param v_time_stamp_selection_u8 :\n * The value of Host IRQ or current time stamp selection\n * time stamp | value\n * --------------------------|---------------\n * BHY_HOST_IRQ_TIMESTAMP | 0\n * BHY_CURRENT_TIME_STAMP | 1\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n * @param v_time_stamp_u32 :\n * The value of Host IRQ or current time stamp\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_time_stamp(\nu8 v_time_stamp_selection_u8, u32 *v_time_stamp_u32)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u16 v_lsb_time_u16 = BHY_INIT_VALUE;\n u16 v_msb_time_u16 = BHY_INIT_VALUE;\n /* input as page 1 and parameter 30 for system page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_30);\n if (BHY_SUCCESS == com_rslt) {\n switch (v_time_stamp_selection_u8) {\n case BHY_HOST_IRQ_TIMESTAMP:\n /* host IRQ time stamp*/\n /* IRQ time stamp lsb data*/\n v_lsb_time_u16 = (u16)((read_buffer.parameter_2\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_1));\n /* IRQ time stamp msb data*/\n v_msb_time_u16 = (u16)((read_buffer.parameter_4\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_3));\n /* return IRQ time stamp*/\n *v_time_stamp_u32 = (u32)(((u32)v_msb_time_u16\n << BHY_SHIFT_BIT_POSITION_BY_16_BITS)\n | (v_lsb_time_u16));\n break;\n case BHY_CURRENT_TIME_STAMP:\n /* current time stamp*/\n /* current time stamp lsb data*/\n v_lsb_time_u16 = (u16)((read_buffer.parameter_6\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_5));\n /* current time stamp msb data*/\n v_msb_time_u16 = (u16)((read_buffer.parameter_8\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_7));\n /* return current time stamp*/\n *v_time_stamp_u32 = (u32)(((u32)v_msb_time_u16\n << BHY_SHIFT_BIT_POSITION_BY_16_BITS)\n | (v_lsb_time_u16));\n break;\n default:\n com_rslt = BHY_OUT_OF_RANGE;\n break;\n }\n }\n return com_rslt;\n}\n/*!\n * @brief API used to get the physical sensor status\n * system page-1 parameter 31\n * @note Accel sample rate byte 0 and 1\n * @note Accel dynamic range byte 2 and 3\n * @note Accel flags byte 4\n * @note Gyro sample rate byte 5 and 6\n * @note Gyro dynamic range byte 7 and 8\n * @note Gyro flags byte 9\n * @note Mag sample rate byte 10 and 11\n * @note Mag dynamic range byte 12 and 13\n * @note Mag flags byte 14\n *\n * @param accel_status : contains the accel physical status\n * @param gyro_status : contains the gyro physical status\n * @param mag_status : contains the mag physical status\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_physical_sensor_status(\nstruct accel_physical_status_t *accel_status,\nstruct gyro_physical_status_t *gyro_status,\nstruct mag_physical_status_t *mag_status)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* input as page 1 and parameter 31 for system page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_1, BHY_PARAMETER_REQUEST_READ_PARAMETER_31);\n /* accel physical status*/\n /* accl sample rate*/\n accel_status->accel_sample_rate = (u16)((read_buffer.parameter_2\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_1));\n /* accel dynamic range*/\n accel_status->accel_dynamic_range = (u16)((read_buffer.parameter_4\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_3));\n /* accel flag*/\n accel_status->accel_flag = read_buffer.parameter_5;\n /* gyro physical status*/\n /* gyro sample rate*/\n gyro_status->gyro_sample_rate = (u16)((read_buffer.parameter_7\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_6));\n /* accel dynamic range*/\n gyro_status->gyro_dynamic_range = (u16)((read_buffer.parameter_9\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_8));\n /* accel flag*/\n gyro_status->gyro_flag = (u8)(read_buffer.parameter_10);\n /* mag physical status*/\n /* mag sample rate*/\n mag_status->mag_sample_rate = (u16)((read_buffer.parameter_12\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_11));\n /* mag dynamic range*/\n mag_status->mag_dynamic_range = (u16)((read_buffer.parameter_14\n << BHY_SHIFT_BIT_POSITION_BY_08_BITS) | (read_buffer.parameter_13));\n /* accel flag*/\n mag_status->mag_flag = (u8)(read_buffer.parameter_15);\n\n return com_rslt;\n}\n/*!\n * @brief API used to get the non wakeup sensor information,\n * Sensor page-3 parameter 1 to 31\n *\n * @param v_parameter_request_u8 :\n * Value desired parameter to read non wakeup sensor information\n * param_request | value | Virtual sensor\n * ----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_1 | 0x01 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_2 | 0x02 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_3 | 0x03 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_4 | 0x04 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_5 | 0x05 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_6 | 0x06 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_7 | 0x87 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_8 | 0x88 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_9 | 0x89 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_10 | 0x8A | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_11 | 0x8B | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_12 | 0x8C | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_13 | 0x8D | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_14 | 0x8E | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_15 | 0x8F | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_16 | 0x90 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_17 | 0x91 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_18 | 0x92 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_19 | 0x93 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_20 | 0x94 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_21 | 0x95 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_22 | 0x96 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_23 | 0x97 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_24 | 0x98 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_25 | 0x99 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_31 | 0x9F | Activity\n *\n * @param sensor_information :\n * holds the value of non wakeup sensor information\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_information(\nu8 v_parameter_request_u8,\nstruct sensor_information_non_wakeup_t *sensor_information)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* input as page 3 and parameter request for sensor page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_3, v_parameter_request_u8);\n /* sensor type information */\n sensor_information->non_wakeup_sensor_type\n = (u8)(read_buffer.parameter_1);\n /* driver id information */\n sensor_information->non_wakeup_driver_id =\n (u8)(read_buffer.parameter_2);\n /* driver version information */\n sensor_information->non_wakeup_driver_version =\n (u8)(read_buffer.parameter_3);\n /* power information */\n sensor_information->non_wakeup_power =\n (u8)(read_buffer.parameter_4);\n /* maximum range information */\n sensor_information->non_wakeup_max_range = (u16)\n ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_5));\n /* resolution information */\n sensor_information->non_wakeup_resolution = (u16)\n ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_7));\n /* maximum rate information */\n sensor_information->non_wakeup_max_rate = (u16)\n ((read_buffer.parameter_10 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_9));\n /* fifo reserved information */\n sensor_information->non_wakeup_fifo_reserved = (u16)\n ((read_buffer.parameter_12 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_11));\n /* fifo max information */\n sensor_information->non_wakeup_fifo_max = (u16)\n ((read_buffer.parameter_14 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_13));\n /* event size information */\n sensor_information->non_wakeup_event_size = read_buffer.parameter_15;\n /* minimum rate information */\n sensor_information->non_wakeup_min_rate = read_buffer.parameter_16;\n\n return com_rslt;\n}\n/*!\n * @brief API used to get the wakeup sensor information,\n * Sensor page-3 parameter 32 to 63\n *\n * @param v_parameter_request_u8 :\n * Value desired parameter to read non wakeup sensor information\n * param_request | value | Virtual sensor\n * ----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_33 | 0xA1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_34 | 0xA2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_35 | 0xA3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_36 | 0xA4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_37 | 0xA5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_38 | 0xA6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_39 | 0xA7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_40 | 0xA8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_41 | 0xA9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_42 | 0xAA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_43 | 0xAB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_44 | 0xAC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_45 | 0xAD | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_46 | 0xAE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_47 | 0xAF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_48 | 0xB0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_49 | 0xB1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_50 | 0xB2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_51 | 0xB3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_52 | 0xB4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_53 | 0xB5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_54 | 0xB6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_55 | 0xB7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_56 | 0xB8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_57 | 0xB9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_63 | 0xBF | Activity\n *\n * @param sensor_information :\n * holds the value of non wakeup sensor information\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_information(\nu8 v_parameter_request_u8,\nstruct sensor_information_wakeup_t *sensor_information)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* input as page 3 and parameter request for sensor page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_3, v_parameter_request_u8);\n /* sensor type information */\n sensor_information->wakeup_sensor_type =\n (u8)(read_buffer.parameter_1);\n /* driver id information */\n sensor_information->wakeup_driver_id =\n (u8)(read_buffer.parameter_2);\n /* driver version information */\n sensor_information->wakeup_driver_version =\n (u8)(read_buffer.parameter_3);\n /* power information */\n sensor_information->wakeup_power =\n (u8)(read_buffer.parameter_4);\n /* maximum range information */\n sensor_information->wakeup_max_range = (u16)\n ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_5));\n /* resolution information */\n sensor_information->wakeup_resolution = (u16)\n ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_7));\n /* maximum rate information */\n sensor_information->wakeup_max_rate = (u16)\n ((read_buffer.parameter_10 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_9));\n /* fifo reserved information */\n sensor_information->wakeup_fifo_reserved = (u16)\n ((read_buffer.parameter_12 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_11));\n /* fifo max information */\n sensor_information->wakeup_fifo_max = (u16)\n ((read_buffer.parameter_14 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_13));\n /* event size information */\n sensor_information->wakeup_event_size = read_buffer.parameter_15;\n /* minimum rate information */\n sensor_information->wakeup_min_rate = read_buffer.parameter_16;\n\n return com_rslt;\n}\n/*!\n * @brief API used to set the sensor non wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param sensor_configuration : contains the non wakeup sensor configuration\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * ----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_non_wakeup_sensor_configuration(\nstruct sensor_configuration_non_wakeup_t *sensor_configuration,\nu8 v_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* write sample rate*/\n write_buffer.write_parameter_byte1 = (u8)(\n sensor_configuration->non_wakeup_sample_rate & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte2 = (u8)(\n (sensor_configuration->non_wakeup_sample_rate\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* write maximum report latency*/\n write_buffer.write_parameter_byte3 = (u8)(\n sensor_configuration->non_wakeup_max_report_latency\n & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte4 = (u8)(\n (sensor_configuration->non_wakeup_max_report_latency\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* write sensitivity*/\n write_buffer.write_parameter_byte5 = (u8)(\n sensor_configuration->non_wakeup_change_sensitivity\n & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte6 = (u8)(\n (sensor_configuration->non_wakeup_change_sensitivity\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* write dynamic range*/\n write_buffer.write_parameter_byte7 = (u8)(\n sensor_configuration->non_wakeup_dynamic_range & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte8 = (u8)(\n (sensor_configuration->non_wakeup_dynamic_range\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* load the parameter of non wakeup sensor configuration*/\n com_rslt = bhy_write_parameter_bytes(\n BHY_PAGE_3, v_parameter_request_u8);\n\n return com_rslt;\n}\n/*!\n * @brief API used to get the sensor non wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param v_sample_rate_u16 :\n * contains the non wakeup sample rate data\n * @param v_max_report_latency_u16:\n * contains the non wakeup max report latency\n * @param v_change_sensitivity_u16:\n * contains the non wakeup sensitivity\n * @param v_dynamic_range_u16:\n * contains the non wakeup dynamic range\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * ----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_65 | 0xC1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_66 | 0xC2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_67 | 0xC3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_68 | 0xC4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_69 | 0xC5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_70 | 0xC6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_71 | 0xC7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_72 | 0xC8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_73 | 0xC9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_74 | 0xCA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_75 | 0xCB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_76 | 0xCC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_77 | 0xCD | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_78 | 0xCE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_79 | 0xCF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_80 | 0xD0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_81 | 0xD1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_82 | 0xD2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_83 | 0xD3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_84 | 0xD4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_85 | 0xD5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_86 | 0xD6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_87 | 0xD7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_88 | 0xD8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_89 | 0xD9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_95 | 0xDF | Activity\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_non_wakeup_sensor_configuration(\nu8 v_parameter_request_u8,\nu16 *v_sample_rate_u16, u16 *v_max_report_latency_u16,\nu16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* input as page 3 and parameter request for sensor page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_3, v_parameter_request_u8);\n /* sample rate information */\n *v_sample_rate_u16 = (u16)\n ((read_buffer.parameter_2 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_1));\n /* max report latency information */\n *v_max_report_latency_u16 = (u16)\n ((read_buffer.parameter_4 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_3));\n /* sensitivity information */\n *v_change_sensitivity_u16 = (u16)\n ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_5));\n /* dynamic range information */\n *v_dynamic_range_u16 = (u16)\n ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_7));\n\n return com_rslt;\n}\n/*!\n * @brief API used to set the sensor wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param sensor_configuration : contains the wakeup sensor configuration\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * -----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_wakeup_sensor_configuration(\nstruct sensor_configuration_wakeup_t *sensor_configuration,\nu8 v_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* write sample rate*/\n write_buffer.write_parameter_byte1 = (u8)(\n sensor_configuration->wakeup_sample_rate & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte2 = (u8)(\n (sensor_configuration->wakeup_sample_rate\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* write maximum report latency*/\n write_buffer.write_parameter_byte3 = (u8)(\n sensor_configuration->wakeup_max_report_latency & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte4 = (u8)(\n (sensor_configuration->wakeup_max_report_latency\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* write change sensitivity*/\n write_buffer.write_parameter_byte5 = (u8)(\n sensor_configuration->wakeup_change_sensitivity & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte6 = (u8)(\n (sensor_configuration->wakeup_change_sensitivity\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* write dynamic range*/\n write_buffer.write_parameter_byte7 = (u8)(\n sensor_configuration->wakeup_dynamic_range & BHY_MASK_LSB_DATA);\n write_buffer.write_parameter_byte8 = (u8)(\n (sensor_configuration->wakeup_dynamic_range\n & BHY_MASK_MSB_DATA) >> BHY_SHIFT_BIT_POSITION_BY_08_BITS);\n /* load the parameter of non wakeup sensor configuration*/\n com_rslt = bhy_write_parameter_bytes(\n BHY_PAGE_3, v_parameter_request_u8);\n\n return com_rslt;\n}\n/*!\n * @brief API used to get the sensor wakeup configuration\n * Sensor page-3 parameter 65 to 89\n *\n * @param v_sample_rate_u16 : contains the wakeup sample rate data\n * @param v_max_report_latency_u16: contains the wakeup max report latency\n * @param v_change_sensitivity_u16: contains the wakeup sensitivity\n * @param v_dynamic_range_u16: contains the wakeup dynamic range\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * param_request | value | Virtual sensor\n * -----------------------------------|-------|----------------\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_97 | 0xE1 | Accelerometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_98 | 0xE2 | Magnetometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_99 | 0xE3 | Orientation\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_100 | 0xE4 | Gyroscope\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_101 | 0xE5 | Light\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_102 | 0xE6 | Barometer\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_103 | 0xE7 | Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_104 | 0xE8 | Proximity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_105 | 0xE9 | Gravity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_106 | 0xEA | Liner accel\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_107 | 0xEB | Rotation vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_108 | 0xEC | Humidity\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_109 | 0xED | Ambient Temperature\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_110 | 0xEE | Uncalibrated Mag\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_111 | 0xEF | Game rotation Vector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_112 | 0xF0 | Uncalibrated Gyro\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_113 | 0xF1 | Signification Motion\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_114 | 0xF2 | Step detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_115 | 0xF3 | Step Counter\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_116 | 0xF4 | Geomagnetic\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_117 | 0xF5 | Heart Rate\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_118 | 0xF6 | Tilt Detector\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_119 | 0xF7 | Wakeup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_120 | 0xF8 | Glance Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_121 | 0xF9 | Pickup Gesture\n * BHY_PARAMETER_REQUEST_READ_PARAMETER_127 | 0xFF | Activity\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_wakeup_sensor_configuration(\nu8 v_parameter_request_u8,\nu16 *v_sample_rate_u16, u16 *v_max_report_latency_u16,\nu16 *v_change_sensitivity_u16, u16 *v_dynamic_range_u16)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* input as page 3 and parameter request for sensor page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_3, v_parameter_request_u8);\n /* sample rate information */\n *v_sample_rate_u16 = (u16)\n ((read_buffer.parameter_2 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_1));\n /* max report latency information */\n *v_max_report_latency_u16 = (u16)\n ((read_buffer.parameter_4 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_3));\n /* sensitivity information */\n *v_change_sensitivity_u16 = (u16)\n ((read_buffer.parameter_6 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_5));\n /* dynamic range information */\n *v_dynamic_range_u16 = (u16)\n ((read_buffer.parameter_8 << BHY_SHIFT_BIT_POSITION_BY_08_BITS)\n | (read_buffer.parameter_7));\n\n return com_rslt;\n}\n/*!\n * @brief API used to get the soft pass through\n * Sensor page-15 parameter 0 to 7\n *\n * @param soft_pass_through :\n * contains the value of soft pass through\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * parameter | value\n * ------------------------------------|--------------------\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03\n *\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_get_soft_pass_through(\nstruct soft_pass_through_read_t *soft_pass_through,\nu8 v_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* input as page 3 and parameter request for sensor page*/\n com_rslt = bhy_read_parameter_bytes(\n BHY_PAGE_15, v_parameter_request_u8);\n /* i2c slave address information */\n soft_pass_through->i2c_slave_address =\n (u8)(read_buffer.parameter_1);\n /* start register information */\n soft_pass_through->start_register =\n (u8)(read_buffer.parameter_2);\n /* read length information */\n soft_pass_through->read_length =\n (u8)(read_buffer.parameter_3);\n /* completion status information */\n soft_pass_through->completion_status =\n (u8)(read_buffer.parameter_4);\n /* return register value 1 information */\n soft_pass_through->reg_value_byte1 =\n (u8)(read_buffer.parameter_5);\n /* return register value 2 information */\n soft_pass_through->reg_value_byte2 =\n (u8)(read_buffer.parameter_6);\n /* return register value 3 information */\n soft_pass_through->reg_value_byte3 =\n (u8)(read_buffer.parameter_7);\n /* return register value 4 information */\n soft_pass_through->reg_value_byte4 =\n (u8)(read_buffer.parameter_8);\n\n return com_rslt;\n}\n/*!\n * @brief API used to set the soft pass through\n * Sensor page-15 parameter 0 to 7\n *\n * @param soft_pass_through :\n * contains the value of soft pass through\n *\n * @param v_parameter_request_u8: value of selected parameter request\n * parameter | value\n * ------------------------------------|--------------------\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_1 | 0x01\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_2 | 0x02\n * BHY_PARAMETER_REQUEST_WRITE_PARAMETER_3 | 0x03\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_set_soft_pass_through(\nstruct soft_pass_through_write_t *soft_pass_through,\nu8 v_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n /* i2c slave address information */\n write_buffer.write_parameter_byte1 =\n soft_pass_through->i2c_slave_address;\n /* start register information */\n write_buffer.write_parameter_byte2 =\n soft_pass_through->start_register;\n /* write length information */\n write_buffer.write_parameter_byte3 =\n soft_pass_through->write_length;\n /* completion status information */\n write_buffer.write_parameter_byte4 =\n soft_pass_through->completion_status;\n /* return register value 1 information */\n write_buffer.write_parameter_byte5 =\n soft_pass_through->reg_value_byte1;\n /* return register value 2 information */\n write_buffer.write_parameter_byte6 =\n soft_pass_through->reg_value_byte2;\n /* return register value 3 information */\n write_buffer.write_parameter_byte7 =\n soft_pass_through->reg_value_byte3;\n /* return register value 4 information */\n write_buffer.write_parameter_byte8 =\n soft_pass_through->reg_value_byte4;\n /* load the parameter of soft\n pass through sensor configuration*/\n com_rslt = bhy_write_parameter_bytes(\n BHY_PAGE_15, v_parameter_request_u8);\n return com_rslt;\n}\n\n/*!\n * @brief API used to get the data from the parameter\n * I2C page register from 0x3B to 0x4A\n *\n *\n * @param v_page_select_u8 : This input value for set the desired page\n * @param v_parameter_request_u8 :\n * This input value for set the desired parameter\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_read_parameter_bytes(\nu8 v_page_select_u8, u8 v_parameter_request_u8)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_parameter_ack_u8 = BHY_INIT_VALUE;\n u8 init_array_data = BHY_INIT_VALUE;\n u8 a_read_data_u8[BHY_READ_BUFFER_SIZE];\n u8 v_parameter_ack_check_u8 = BHY_INIT_VALUE;\n\n for (; init_array_data < BHY_READ_BUFFER_SIZE; init_array_data++)\n a_read_data_u8[init_array_data] = BHY_INIT_VALUE;\n /* select the page*/\n com_rslt = bhy_set_parameter_page_select(v_page_select_u8);\n /* select the parameter*/\n com_rslt += bhy_set_parameter_request(v_parameter_request_u8);\n /* read the values*/\n for (v_parameter_ack_check_u8 = BHY_INIT_VALUE;\n v_parameter_ack_check_u8 < BHY_PARAMETER_ACK_LENGTH;\n v_parameter_ack_check_u8++) {\n /* read acknowledgement*/\n com_rslt = bhy_get_parameter_acknowledge(&v_parameter_ack_u8);\n if (v_parameter_ack_u8 == v_parameter_request_u8) {\n break;\n } else if (v_parameter_ack_u8 == BHY_PARAMETER_ACK_CHECK) {\n p_bhy->delay_msec(BHY_PARAMETER_ACK_DELAY);\n com_rslt = BHY_ERROR;\n } else {\n /* device not ready yet */\n p_bhy->delay_msec(1);\n }\n }\n com_rslt =\n p_bhy->BHY_BUS_READ_FUNC(p_bhy->device_addr,\n BHY_I2C_REG_PARAMETER_READ_BUFFER_ZERO,\n a_read_data_u8, BHY_READ_BUFFER_LENGTH);\n read_buffer.parameter_1 =\n a_read_data_u8[BHY_READ_BUFFER_1_REG];\n read_buffer.parameter_2 =\n a_read_data_u8[BHY_READ_BUFFER_2_REG];\n read_buffer.parameter_3 =\n a_read_data_u8[BHY_READ_BUFFER_3_REG];\n read_buffer.parameter_4 =\n a_read_data_u8[BHY_READ_BUFFER_4_REG];\n read_buffer.parameter_5 =\n a_read_data_u8[BHY_READ_BUFFER_5_REG];\n read_buffer.parameter_6 =\n a_read_data_u8[BHY_READ_BUFFER_6_REG];\n read_buffer.parameter_7 =\n a_read_data_u8[BHY_READ_BUFFER_7_REG];\n read_buffer.parameter_8 =\n a_read_data_u8[BHY_READ_BUFFER_8_REG];\n read_buffer.parameter_9 =\n a_read_data_u8[BHY_READ_BUFFER_9_REG];\n read_buffer.parameter_10 =\n a_read_data_u8[BHY_READ_BUFFER_10_REG];\n read_buffer.parameter_11 =\n a_read_data_u8[BHY_READ_BUFFER_11_REG];\n read_buffer.parameter_12 =\n a_read_data_u8[BHY_READ_BUFFER_12_REG];\n read_buffer.parameter_13 =\n a_read_data_u8[BHY_READ_BUFFER_13_REG];\n read_buffer.parameter_14 =\n a_read_data_u8[BHY_READ_BUFFER_14_REG];\n read_buffer.parameter_15 =\n a_read_data_u8[BHY_READ_BUFFER_15_REG];\n read_buffer.parameter_16 =\n a_read_data_u8[BHY_READ_BUFFER_16_REG];\n\n return com_rslt;\n}\n/*!\n * @brief API used to set the data from the parameter\n * I2C page register from 0x5C to 0x63\n *\n *\n * @param v_page_select_u8 : This input value for set the desired page\n * @param v_parameter_request_u8 :\n * This input value for set the desired parameter\n *\n * @return results of bus communication function\n * @retval 0 -> Success\n * @retval -1 -> Error\n *\n *\n*/\nBHY_RETURN_FUNCTION_TYPE bhy_write_parameter_bytes(\nu8 v_page_select_u8, u8 v_parameter_request_u8)\n{\n/* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n u8 v_parameter_ack_u8 = BHY_INIT_VALUE;\n u8 v_parameter_ack_check_u8 = BHY_INIT_VALUE;\n u8 v_write_parameter_byte_u8[BHY_WRITE_BUFFER_SIZE];\n u8 init_array_data = BHY_INIT_VALUE;\n\n for (; init_array_data < BHY_WRITE_BUFFER_SIZE; init_array_data++)\n v_write_parameter_byte_u8[init_array_data] = BHY_INIT_VALUE;\n /* check the p_bhy structure as NULL*/\n if (p_bhy == BHY_NULL) {\n return BHY_NULL;\n } else {\n /* Assign the load parameters*/\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_1_REG]\n = write_buffer.write_parameter_byte1;\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_2_REG]\n = write_buffer.write_parameter_byte2;\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_3_REG]\n = write_buffer.write_parameter_byte3;\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_4_REG]\n = write_buffer.write_parameter_byte4;\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_5_REG]\n = write_buffer.write_parameter_byte5;\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_6_REG]\n = write_buffer.write_parameter_byte6;\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_7_REG]\n = write_buffer.write_parameter_byte7;\n v_write_parameter_byte_u8[BHY_WRITE_BUFFER_8_REG]\n = write_buffer.write_parameter_byte8;\n /* write values to the load address*/\n com_rslt = p_bhy->BHY_BUS_WRITE_FUNC\n (p_bhy->device_addr,\n BHY_I2C_REG_PARAMETER_WRITE_BUFFER_ZERO,\n &v_write_parameter_byte_u8[BHY_WRITE_BUFFER_1_REG],\n BHY_WRITE_BUFFER_SIZE);\n /* select the page*/\n com_rslt += bhy_set_parameter_page_select(v_page_select_u8);\n /* select the parameter*/\n com_rslt += bhy_set_parameter_request(v_parameter_request_u8);\n for (v_parameter_ack_check_u8 = BHY_INIT_VALUE;\n v_parameter_ack_check_u8 < BHY_PARAMETER_ACK_LENGTH;\n v_parameter_ack_check_u8++) {\n /* read the acknowledgement*/\n com_rslt += bhy_get_parameter_acknowledge(\n &v_parameter_ack_u8);\n if (v_parameter_ack_u8 == v_parameter_request_u8) {\n com_rslt += BHY_SUCCESS;\n break;\n } else if (v_parameter_ack_u8\n == BHY_PARAMETER_ACK_CHECK) {\n p_bhy->delay_msec(BHY_PARAMETER_ACK_DELAY);\n com_rslt += BHY_ERROR;\n } else {\n /* device not ready yet */\n p_bhy->delay_msec(1);\n }\n }\n\n }\n return com_rslt;\n}\n",
"bhy1_fw.c": "const unsigned char bhy1_fw[] = {\n 0x2a, 0x65, 0x00, 0x1a, 0x9a, 0x31, 0x1b, 0xe7, 0x00, 0x00, 0x00, 0x00,\n 0x74, 0x28, 0x00, 0x00, 0xe8, 0x99, 0x7f, 0x00, 0x44, 0x19, 0x00, 0x00,\n 0x68, 0x8d, 0x7f, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,\n 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,\n 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,\n 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,\n 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70, 0xe8, 0x47, 0x60, 0x00,\n 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00,\n 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00, 0xe8, 0x47, 0x60, 0x00,\n 0xe8, 0x47, 0x60, 0x00, 0x34, 0x50, 0x60, 0x00, 0xa4, 0x53, 0x60, 0x00,\n 0x04, 0x52, 0x60, 0x00, 0xb4, 0x94, 0x60, 0x00, 0x68, 0x8d, 0x7f, 0x00,\n 0x68, 0x8d, 0x7f, 0x00, 0x68, 0x8d, 0x7f, 0x00, 0x68, 0x8d, 0x7f, 0x00,\n 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00,\n 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00, 0x4c, 0x8d, 0x60, 0x00,\n 0x59, 0x06, 0x4f, 0x06, 0x91, 0x07, 0x4f, 0x06, 0xb1, 0x02, 0x4f, 0x08,\n 0xa1, 0x04, 0x4f, 0x08, 0xbd, 0x05, 0x4f, 0x08, 0x05, 0x01, 0x8f, 0x08,\n 0x09, 0x01, 0x8f, 0x08, 0xb9, 0x03, 0x8f, 0x08, 0xc1, 0x03, 0x8f, 0x08,\n 0xd1, 0x04, 0x8f, 0x08, 0x1d, 0x02, 0xcf, 0x08, 0x8d, 0x04, 0xcf, 0x08,\n 0x8d, 0x07, 0xcf, 0x08, 0xc5, 0x07, 0xcf, 0x08, 0x69, 0x01, 0x0f, 0x09,\n 0x99, 0x07, 0x4f, 0x09, 0xe9, 0x07, 0x4f, 0x09, 0x29, 0x00, 0x8f, 0x09,\n 0x31, 0x00, 0x8f, 0x09, 0xd1, 0x00, 0x8f, 0x09, 0xa5, 0x01, 0x8f, 0x09,\n 0xdd, 0x01, 0x8f, 0x09, 0x09, 0x03, 0x8f, 0x09, 0x85, 0x03, 0x8f, 0x09,\n 0x49, 0x05, 0x8f, 0x09, 0x0d, 0x06, 0x8f, 0x09, 0xed, 0x07, 0x8f, 0x09,\n 0xbd, 0x00, 0xcf, 0x09, 0x1d, 0x01, 0xcf, 0x09, 0x95, 0x01, 0xcf, 0x09,\n 0x1d, 0x02, 0xcf, 0x09, 0x6d, 0x02, 0xcf, 0x09, 0xa5, 0x02, 0xcf, 0x09,\n 0x41, 0x03, 0xcf, 0x09, 0x7d, 0x03, 0xcf, 0x09, 0xad, 0x05, 0xcf, 0x09,\n 0x0d, 0x06, 0xcf, 0x09, 0x6d, 0x06, 0xcf, 0x09, 0xc1, 0x06, 0xcf, 0x09,\n 0x85, 0x01, 0x0f, 0x0a, 0x11, 0x02, 0x0f, 0x0a, 0x31, 0x02, 0x0f, 0x0a,\n 0xb5, 0x02, 0x0f, 0x0a, 0xb9, 0x03, 0x0f, 0x0a, 0x69, 0x07, 0x0f, 0x0a,\n 0x05, 0x04, 0x4f, 0x0a, 0x2d, 0x07, 0x4f, 0x0a, 0x95, 0x00, 0x8f, 0x0a,\n 0xad, 0x04, 0x8f, 0x0a, 0xd9, 0x05, 0x8f, 0x0a, 0x95, 0x06, 0x8f, 0x0a,\n 0xed, 0x00, 0xcf, 0x0a, 0xf1, 0x00, 0xcf, 0x0a, 0xfd, 0x00, 0xcf, 0x0a,\n 0x69, 0x01, 0xcf, 0x0a, 0x75, 0x01, 0xcf, 0x0a, 0x35, 0x02, 0xcf, 0x0a,\n 0x05, 0x03, 0xcf, 0x0a, 0x09, 0x05, 0xcf, 0x0a, 0xfd, 0x05, 0xcf, 0x0a,\n 0xb1, 0x06, 0xcf, 0x0a, 0x01, 0x02, 0x0f, 0x0b, 0x51, 0x05, 0x40, 0x00,\n 0xd1, 0x02, 0x8f, 0x0b, 0x29, 0x03, 0x8f, 0x0b, 0x91, 0x03, 0x8f, 0x0b,\n 0xbd, 0x03, 0x8f, 0x0b, 0xe1, 0x04, 0x8f, 0x0b, 0x25, 0x05, 0x8f, 0x0b,\n 0xd5, 0x05, 0x8f, 0x0b, 0x39, 0x06, 0x8f, 0x0b, 0x91, 0x07, 0x8f, 0x0b,\n 0x2d, 0x00, 0xcf, 0x0b, 0x49, 0x00, 0xcf, 0x0b, 0x01, 0x01, 0xcf, 0x0b,\n 0xcd, 0x01, 0xcf, 0x0b, 0x79, 0x05, 0xcf, 0x0b, 0xc9, 0x05, 0xcf, 0x0b,\n 0xb5, 0x07, 0xcf, 0x0b, 0x69, 0x00, 0x0f, 0x0c, 0x39, 0x05, 0x40, 0x00,\n 0xcd, 0x00, 0x0f, 0x0c, 0xd5, 0x00, 0x0f, 0x0c, 0x45, 0x01, 0x0f, 0x0c,\n 0x5d, 0x01, 0x0f, 0x0c, 0x75, 0x01, 0x0f, 0x0c, 0x0d, 0x02, 0x0f, 0x0c,\n 0xbd, 0x04, 0x0f, 0x0c, 0xdd, 0x04, 0x0f, 0x0c, 0x01, 0x07, 0x0f, 0x0c,\n 0x41, 0x07, 0x0f, 0x0c, 0x49, 0x07, 0x0f, 0x0c, 0xc9, 0x07, 0x0f, 0x0c,\n 0x1d, 0x00, 0x4f, 0x0c, 0x65, 0x00, 0x4f, 0x0c, 0x49, 0x01, 0x4f, 0x0c,\n 0x65, 0x01, 0x4f, 0x0c, 0x99, 0x01, 0x4f, 0x0c, 0x3d, 0x02, 0x4f, 0x0c,\n 0x65, 0x02, 0x4f, 0x0c, 0xb1, 0x02, 0x4f, 0x0c, 0x61, 0x05, 0x4f, 0x0c,\n 0xb1, 0x05, 0x4f, 0x0c, 0x45, 0x06, 0x4f, 0x0c, 0x79, 0x06, 0x4f, 0x0c,\n 0x85, 0x06, 0x4f, 0x0c, 0x19, 0x07, 0x4f, 0x0c, 0x21, 0x00, 0x8f, 0x0c,\n 0x6d, 0x00, 0x8f, 0x0c, 0x7d, 0x00, 0x8f, 0x0c, 0x7d, 0x04, 0x8f, 0x0c,\n 0x85, 0x05, 0x8f, 0x0c, 0xc1, 0x03, 0xcf, 0x0c, 0xc9, 0x03, 0xcf, 0x0c,\n 0x0d, 0x07, 0xcf, 0x0c, 0x51, 0x07, 0xcf, 0x0c, 0x61, 0x07, 0xcf, 0x0c,\n 0xd9, 0x04, 0x40, 0x00, 0x25, 0x00, 0x0f, 0x0d, 0x4d, 0x00, 0x0f, 0x0d,\n 0x6d, 0x00, 0x0f, 0x0d, 0x71, 0x00, 0x0f, 0x0d, 0x71, 0x00, 0x0f, 0x0d,\n 0x89, 0x00, 0x0f, 0x0d, 0x91, 0x00, 0x0f, 0x0d, 0x99, 0x00, 0x0f, 0x0d,\n 0xa1, 0x00, 0x0f, 0x0d, 0xa5, 0x00, 0x0f, 0x0d, 0xad, 0x00, 0x0f, 0x0d,\n 0xbd, 0x00, 0x0f, 0x0d, 0xc9, 0x00, 0x0f, 0x0d, 0xd5, 0x00, 0x0f, 0x0d,\n 0x89, 0x01, 0x0f, 0x0d, 0xf9, 0x01, 0x0f, 0x0d, 0x21, 0x03, 0x0f, 0x0d,\n 0x65, 0x03, 0x0f, 0x0d, 0x1d, 0x04, 0x0f, 0x0d, 0x39, 0x04, 0x0f, 0x0d,\n 0x45, 0x04, 0x0f, 0x0d, 0x4d, 0x04, 0x0f, 0x0d, 0x6d, 0x04, 0x0f, 0x0d,\n 0x71, 0x04, 0x0f, 0x0d, 0xf5, 0x05, 0x0f, 0x0d, 0x3d, 0x06, 0x0f, 0x0d,\n 0x05, 0x00, 0x4f, 0x0d, 0x51, 0x00, 0x4f, 0x0d, 0x8d, 0x00, 0x4f, 0x0d,\n 0xed, 0x00, 0x4f, 0x0d, 0x21, 0x02, 0x4f, 0x0d, 0xbd, 0x02, 0x4f, 0x0d,\n 0xc1, 0x03, 0x4f, 0x0d, 0x25, 0x04, 0x4f, 0x0d, 0x31, 0x04, 0x4f, 0x0d,\n 0x8d, 0x04, 0x40, 0x00, 0x99, 0x04, 0x40, 0x00, 0xa5, 0x04, 0x40, 0x00,\n 0xb1, 0x04, 0x40, 0x00, 0xbd, 0x04, 0x40, 0x00, 0xc9, 0x04, 0x40, 0x00,\n 0xd5, 0x04, 0x40, 0x00, 0xf5, 0x04, 0x40, 0x00, 0x01, 0x05, 0x40, 0x00,\n 0x25, 0x05, 0x40, 0x00, 0x31, 0x05, 0x40, 0x00, 0x3d, 0x05, 0x40, 0x00,\n 0xc9, 0x04, 0x4f, 0x0d, 0xf1, 0x05, 0x4f, 0x0d, 0x31, 0x07, 0x4f, 0x0d,\n 0x59, 0x07, 0x4f, 0x0d, 0x65, 0x07, 0x4f, 0x0d, 0xa9, 0x01, 0x8f, 0x0d,\n 0xd1, 0x01, 0x8f, 0x0d, 0xdd, 0x01, 0x8f, 0x0d, 0xe5, 0x01, 0x8f, 0x0d,\n 0x09, 0x02, 0x8f, 0x0d, 0x2d, 0x02, 0x8f, 0x0d, 0x7d, 0x02, 0x8f, 0x0d,\n 0x3d, 0x03, 0x8f, 0x0d, 0x6d, 0x04, 0x8f, 0x0d, 0x49, 0x05, 0x8f, 0x0d,\n 0x59, 0x05, 0x8f, 0x0d, 0x91, 0x05, 0x8f, 0x0d, 0xd5, 0x05, 0x8f, 0x0d,\n 0xf1, 0x00, 0xcf, 0x0d, 0x21, 0x02, 0xcf, 0x0d, 0xfd, 0x02, 0xcf, 0x0d,\n 0xbd, 0x04, 0xcf, 0x0d, 0x89, 0x00, 0x0f, 0x0e, 0xc1, 0x04, 0x0f, 0x0e,\n 0xf1, 0x05, 0x0f, 0x0e, 0x5d, 0x07, 0x0f, 0x0e, 0xc9, 0x07, 0x0f, 0x0e,\n 0x89, 0x05, 0x8f, 0x0e, 0x79, 0x06, 0x8f, 0x0e, 0xa1, 0x06, 0x8f, 0x0e,\n 0x1d, 0x07, 0x8f, 0x0e, 0x6d, 0x07, 0x8f, 0x0e, 0x11, 0x00, 0xcf, 0x0e,\n 0x4d, 0x01, 0xcf, 0x0e, 0x71, 0x01, 0xcf, 0x0e, 0xbd, 0x01, 0xcf, 0x0e,\n 0xcd, 0x01, 0xcf, 0x0e, 0x25, 0x02, 0xcf, 0x0e, 0x75, 0x02, 0xcf, 0x0e,\n 0xbd, 0x02, 0xcf, 0x0e, 0xa1, 0x03, 0xcf, 0x0e, 0x2d, 0x04, 0xcf, 0x0e,\n 0x75, 0x04, 0xcf, 0x0e, 0x81, 0x04, 0xcf, 0x0e, 0xa5, 0x04, 0xcf, 0x0e,\n 0xe1, 0x04, 0xcf, 0x0e, 0x11, 0x05, 0xcf, 0x0e, 0x65, 0x05, 0xcf, 0x0e,\n 0xd5, 0x05, 0xcf, 0x0e, 0x2d, 0x06, 0xcf, 0x0e, 0xbd, 0x07, 0xcf, 0x0e,\n 0x01, 0x00, 0x0f, 0x0f, 0x25, 0x00, 0x0f, 0x0f, 0x5d, 0x04, 0x0f, 0x0f,\n 0x19, 0x05, 0x0f, 0x0f, 0x1d, 0x03, 0x4f, 0x0f, 0x99, 0x04, 0x4f, 0x0f,\n 0x21, 0x05, 0x4f, 0x0f, 0x8d, 0x05, 0x4f, 0x0f, 0xa9, 0x05, 0x4f, 0x0f,\n 0xe1, 0x05, 0x4f, 0x0f, 0x81, 0x06, 0x4f, 0x0f, 0x95, 0x06, 0x4f, 0x0f,\n 0xad, 0x06, 0x4f, 0x0f, 0x01, 0x07, 0x4f, 0x0f, 0x1d, 0x07, 0x4f, 0x0f,\n 0x31, 0x07, 0x4f, 0x0f, 0xc5, 0x07, 0x4f, 0x0f, 0xe1, 0x07, 0x4f, 0x0f,\n 0x21, 0x00, 0x8f, 0x0f, 0x85, 0x00, 0x8f, 0x0f, 0x9d, 0x00, 0x8f, 0x0f,\n 0xdd, 0x00, 0x8f, 0x0f, 0xe5, 0x00, 0x8f, 0x0f, 0x7d, 0x01, 0x8f, 0x0f,\n 0x9d, 0x01, 0x8f, 0x0f, 0xb1, 0x01, 0x8f, 0x0f, 0xd5, 0x01, 0x8f, 0x0f,\n 0x2d, 0x02, 0x8f, 0x0f, 0x71, 0x02, 0x8f, 0x0f, 0x09, 0x03, 0x8f, 0x0f,\n 0x35, 0x03, 0x8f, 0x0f, 0x71, 0x03, 0x8f, 0x0f, 0x69, 0x04, 0x8f, 0x0f,\n 0xc9, 0x04, 0x8f, 0x0f, 0x7d, 0x00, 0xcf, 0x0f, 0x91, 0x02, 0xcf, 0x0f,\n 0x15, 0x03, 0x4f, 0x09, 0xbd, 0x03, 0x8f, 0x0d, 0x41, 0x03, 0xcf, 0x0a,\n 0x65, 0x04, 0xcf, 0x0a, 0x99, 0x04, 0xcf, 0x0a, 0x09, 0x05, 0xcf, 0x0a,\n 0x49, 0x05, 0xcf, 0x0a, 0x61, 0x05, 0xcf, 0x0a, 0xb1, 0x06, 0xcf, 0x0a,\n 0xb9, 0x06, 0xcf, 0x0a, 0xf1, 0x06, 0xcf, 0x0a, 0x31, 0x07, 0xcf, 0x0a,\n 0x75, 0x07, 0xcf, 0x0a, 0xd9, 0x05, 0x8f, 0x0b, 0x71, 0x06, 0x8f, 0x0b,\n 0x6d, 0x06, 0x8f, 0x0a, 0x8d, 0x06, 0x8f, 0x0a, 0x31, 0x07, 0x8f, 0x0a,\n 0xe5, 0x07, 0x8f, 0x0a, 0x69, 0x00, 0xcf, 0x0a, 0xc1, 0x00, 0xcf, 0x0a,\n 0x55, 0x01, 0xcf, 0x0a, 0x89, 0x02, 0xcf, 0x0a, 0xc1, 0x05, 0xcf, 0x0a,\n 0xbd, 0x06, 0xcf, 0x0d, 0x11, 0x07, 0xcf, 0x0d, 0xd9, 0x01, 0x8f, 0x04,\n 0x09, 0x02, 0x8f, 0x04, 0x15, 0x02, 0x8f, 0x04, 0x21, 0x02, 0x8f, 0x04,\n 0x39, 0x02, 0x8f, 0x04, 0x5d, 0x02, 0x8f, 0x04, 0x69, 0x02, 0x8f, 0x04,\n 0x75, 0x02, 0x8f, 0x04, 0x49, 0x03, 0x8f, 0x04, 0x89, 0x03, 0x8f, 0x04,\n 0xf1, 0x04, 0x8f, 0x04, 0x51, 0x05, 0x8f, 0x04, 0x8d, 0x05, 0x8f, 0x04,\n 0xa1, 0x05, 0x8f, 0x04, 0xf1, 0x05, 0x8f, 0x04, 0x21, 0x06, 0x8f, 0x04,\n 0x59, 0x07, 0x8f, 0x04, 0x6d, 0x07, 0x8f, 0x04, 0xc5, 0x07, 0x8f, 0x04,\n 0xf1, 0x00, 0xcf, 0x04, 0xfd, 0x00, 0xcf, 0x04, 0x05, 0x01, 0xcf, 0x04,\n 0x95, 0x01, 0xcf, 0x04, 0xfd, 0x01, 0xcf, 0x04, 0x41, 0x02, 0xcf, 0x04,\n 0x55, 0x02, 0xcf, 0x04, 0xb9, 0x02, 0xcf, 0x04, 0xbd, 0x02, 0xcf, 0x04,\n 0xc1, 0x02, 0xcf, 0x04, 0x05, 0x03, 0xcf, 0x04, 0x0d, 0x03, 0xcf, 0x04,\n 0x11, 0x03, 0xcf, 0x04, 0x15, 0x03, 0xcf, 0x04, 0x19, 0x03, 0xcf, 0x04,\n 0x21, 0x03, 0xcf, 0x04, 0x45, 0x03, 0xcf, 0x04, 0x4d, 0x03, 0xcf, 0x04,\n 0x61, 0x03, 0xcf, 0x04, 0x71, 0x03, 0xcf, 0x04, 0xc9, 0x03, 0xcf, 0x04,\n 0xdd, 0x03, 0xcf, 0x04, 0x49, 0x05, 0xcf, 0x04, 0x55, 0x05, 0xcf, 0x04,\n 0x61, 0x05, 0xcf, 0x04, 0x65, 0x05, 0xcf, 0x04, 0x69, 0x05, 0xcf, 0x04,\n 0x6d, 0x05, 0xcf, 0x04, 0x99, 0x05, 0xcf, 0x04, 0x2d, 0x00, 0x0f, 0x05,\n 0xad, 0x00, 0x0f, 0x05, 0xf9, 0x00, 0x0f, 0x05, 0x41, 0x01, 0x0f, 0x05,\n 0xe1, 0x01, 0x0f, 0x05, 0x09, 0x02, 0x0f, 0x05, 0xf1, 0x02, 0x0f, 0x05,\n 0xfd, 0x02, 0x0f, 0x05, 0x21, 0x03, 0x0f, 0x05, 0x3d, 0x03, 0x0f, 0x05,\n 0x91, 0x03, 0x0f, 0x05, 0xad, 0x03, 0x0f, 0x05, 0xb9, 0x03, 0x0f, 0x05,\n 0xdd, 0x03, 0x0f, 0x05, 0xed, 0x03, 0x0f, 0x05, 0xf5, 0x03, 0x0f, 0x05,\n 0x65, 0x04, 0x0f, 0x05, 0x15, 0x06, 0x0f, 0x05, 0xa1, 0x06, 0x0f, 0x05,\n 0xb1, 0x06, 0x0f, 0x05, 0xb9, 0x06, 0x0f, 0x05, 0xc1, 0x06, 0x0f, 0x05,\n 0xd5, 0x06, 0x0f, 0x05, 0x25, 0x07, 0x0f, 0x05, 0x69, 0x07, 0x0f, 0x05,\n 0x71, 0x07, 0x0f, 0x05, 0x0d, 0x00, 0x4f, 0x05, 0x29, 0x00, 0x4f, 0x05,\n 0x39, 0x00, 0x4f, 0x05, 0x6d, 0x00, 0x4f, 0x05, 0x79, 0x00, 0x4f, 0x05,\n 0x9d, 0x00, 0x4f, 0x05, 0xe5, 0x01, 0x4f, 0x05, 0x1d, 0x02, 0x4f, 0x05,\n 0x2d, 0x02, 0x4f, 0x05, 0x31, 0x02, 0x4f, 0x05, 0x45, 0x02, 0x4f, 0x05,\n 0x29, 0x03, 0x4f, 0x05, 0x65, 0x03, 0x4f, 0x05, 0x01, 0x04, 0x4f, 0x05,\n 0x0d, 0x04, 0x4f, 0x05, 0x19, 0x04, 0x4f, 0x05, 0x4d, 0x04, 0x4f, 0x05,\n 0x59, 0x04, 0x4f, 0x05, 0xd9, 0x04, 0x4f, 0x05, 0x81, 0x05, 0x4f, 0x05,\n 0x85, 0x05, 0x4f, 0x05, 0xad, 0x05, 0x4f, 0x05, 0xfd, 0x05, 0x4f, 0x05,\n 0x05, 0x06, 0x4f, 0x05, 0x0d, 0x06, 0x4f, 0x05, 0x39, 0x06, 0x4f, 0x05,\n 0x71, 0x00, 0x8f, 0x05, 0xe9, 0x00, 0x8f, 0x05, 0xf9, 0x00, 0x8f, 0x05,\n 0x09, 0x01, 0x8f, 0x05, 0xb5, 0x01, 0x8f, 0x05, 0xc1, 0x01, 0x8f, 0x05,\n 0xe1, 0x01, 0x8f, 0x05, 0xed, 0x01, 0x8f, 0x05, 0x01, 0x02, 0x8f, 0x05,\n 0x0d, 0x02, 0x8f, 0x05, 0x19, 0x02, 0x8f, 0x05, 0x49, 0x02, 0x8f, 0x05,\n 0x55, 0x02, 0x8f, 0x05, 0x1d, 0x03, 0x8f, 0x05, 0x91, 0x03, 0x8f, 0x05,\n 0xe5, 0x03, 0x8f, 0x05, 0x25, 0x04, 0x8f, 0x05, 0x95, 0x04, 0x8f, 0x05,\n 0xb5, 0x04, 0x8f, 0x05, 0x29, 0x05, 0x8f, 0x05, 0xa5, 0x05, 0x8f, 0x05,\n 0x31, 0x06, 0x8f, 0x05, 0x39, 0x06, 0x8f, 0x05, 0x41, 0x06, 0x8f, 0x05,\n 0x49, 0x06, 0x8f, 0x05, 0x65, 0x07, 0x8f, 0x05, 0x89, 0x07, 0x8f, 0x05,\n 0x95, 0x07, 0x8f, 0x05, 0xb1, 0x07, 0x8f, 0x05, 0xd9, 0x07, 0x8f, 0x05,\n 0xe5, 0x07, 0x8f, 0x05, 0x15, 0x00, 0xcf, 0x05, 0xd1, 0x00, 0xcf, 0x05,\n 0x2d, 0x01, 0xcf, 0x05, 0x45, 0x01, 0xcf, 0x05, 0x75, 0x01, 0xcf, 0x05,\n 0xa5, 0x01, 0xcf, 0x05, 0xb5, 0x01, 0xcf, 0x05, 0xd1, 0x01, 0xcf, 0x05,\n 0xf5, 0x01, 0xcf, 0x05, 0xb9, 0x02, 0xcf, 0x05, 0xc5, 0x02, 0xcf, 0x05,\n 0xfd, 0x02, 0xcf, 0x05, 0x11, 0x03, 0xcf, 0x05, 0x25, 0x03, 0xcf, 0x05,\n 0x41, 0x03, 0xcf, 0x05, 0x55, 0x03, 0xcf, 0x05, 0x69, 0x03, 0xcf, 0x05,\n 0x8d, 0x04, 0xcf, 0x05, 0x9d, 0x04, 0xcf, 0x05, 0xad, 0x04, 0xcf, 0x05,\n 0xd1, 0x04, 0xcf, 0x05, 0xe1, 0x04, 0xcf, 0x05, 0x39, 0x05, 0xcf, 0x05,\n 0x75, 0x05, 0xcf, 0x05, 0xf9, 0x05, 0xcf, 0x05, 0x05, 0x06, 0xcf, 0x05,\n 0x11, 0x06, 0xcf, 0x05, 0x25, 0x06, 0xcf, 0x05, 0x35, 0x06, 0xcf, 0x05,\n 0x49, 0x06, 0xcf, 0x05, 0x5d, 0x06, 0xcf, 0x05, 0x7d, 0x06, 0xcf, 0x05,\n 0x91, 0x06, 0xcf, 0x05, 0xb5, 0x06, 0xcf, 0x05, 0xd1, 0x06, 0xcf, 0x05,\n 0xf9, 0x06, 0xcf, 0x05, 0x55, 0x07, 0xcf, 0x05, 0xf1, 0x07, 0xcf, 0x05,\n 0x09, 0x00, 0x0f, 0x06, 0xdd, 0x00, 0x0f, 0x06, 0xa5, 0x01, 0x0f, 0x06,\n 0x19, 0x02, 0x0f, 0x06, 0x25, 0x02, 0x0f, 0x06, 0x39, 0x02, 0x0f, 0x06,\n 0x45, 0x02, 0x0f, 0x06, 0x55, 0x02, 0x0f, 0x06, 0x81, 0x02, 0x0f, 0x06,\n 0xa1, 0x02, 0x0f, 0x06, 0xb5, 0x02, 0x0f, 0x06, 0xc1, 0x02, 0x0f, 0x06,\n 0xc9, 0x02, 0x0f, 0x06, 0xd5, 0x02, 0x0f, 0x06, 0x31, 0x03, 0x0f, 0x06,\n 0x41, 0x03, 0x0f, 0x06, 0x51, 0x03, 0x0f, 0x06, 0x5d, 0x03, 0x0f, 0x06,\n 0x65, 0x03, 0x0f, 0x06, 0x75, 0x03, 0x0f, 0x06, 0xcd, 0x03, 0x0f, 0x06,\n 0xf9, 0x03, 0x0f, 0x06, 0x05, 0x04, 0x0f, 0x06, 0x59, 0x06, 0x0f, 0x06,\n 0x61, 0x06, 0x0f, 0x06, 0xc1, 0x06, 0x0f, 0x06, 0xd5, 0x06, 0x0f, 0x06,\n 0xd9, 0x06, 0x0f, 0x06, 0xdd, 0x06, 0x0f, 0x06, 0x79, 0x04, 0x4f, 0x06,\n 0x91, 0x04, 0x4f, 0x06, 0xa9, 0x04, 0x4f, 0x06, 0x01, 0x05, 0x4f, 0x06,\n 0x35, 0x05, 0x4f, 0x06, 0x65, 0x05, 0x4f, 0x06, 0x2d, 0x06, 0x4f, 0x06,\n 0x45, 0x06, 0x4f, 0x06, 0x69, 0x06, 0x4f, 0x06, 0x6d, 0x06, 0x4f, 0x06,\n 0x71, 0x06, 0x4f, 0x06, 0x75, 0x06, 0x4f, 0x06, 0x79, 0x06, 0x4f, 0x06,\n 0x7d, 0x06, 0x4f, 0x06, 0x81, 0x06, 0x4f, 0x06, 0x85, 0x06, 0x4f, 0x06,\n 0x89, 0x06, 0x4f, 0x06, 0x8d, 0x06, 0x4f, 0x06, 0x91, 0x06, 0x4f, 0x06,\n 0x95, 0x06, 0x4f, 0x06, 0xa1, 0x06, 0x4f, 0x06, 0xa9, 0x06, 0x4f, 0x06,\n 0x69, 0x00, 0x8f, 0x06, 0x75, 0x00, 0x8f, 0x06, 0x8d, 0x00, 0x8f, 0x06,\n 0x99, 0x00, 0x8f, 0x06, 0xa5, 0x00, 0x8f, 0x06, 0xf1, 0x00, 0x8f, 0x06,\n 0xfd, 0x00, 0x8f, 0x06, 0x09, 0x01, 0x8f, 0x06, 0x15, 0x01, 0x8f, 0x06,\n 0x25, 0x01, 0x8f, 0x06, 0xfd, 0x01, 0x8f, 0x06, 0x2d, 0x02, 0x8f, 0x06,\n 0xf1, 0x02, 0x8f, 0x06, 0xb5, 0x03, 0x8f, 0x06, 0x4d, 0x04, 0x8f, 0x06,\n 0x65, 0x04, 0x8f, 0x06, 0xa9, 0x04, 0x8f, 0x06, 0xbd, 0x05, 0x8f, 0x06,\n 0x61, 0x06, 0x8f, 0x06, 0x69, 0x06, 0x8f, 0x06, 0x71, 0x06, 0x8f, 0x06,\n 0x91, 0x07, 0x8f, 0x06, 0xc5, 0x02, 0xcf, 0x06, 0xe1, 0x02, 0xcf, 0x06,\n 0xe9, 0x02, 0xcf, 0x06, 0xf9, 0x02, 0xcf, 0x06, 0x09, 0x03, 0xcf, 0x06,\n 0xfd, 0x04, 0xcf, 0x06, 0x55, 0x05, 0xcf, 0x06, 0x71, 0x05, 0xcf, 0x06,\n 0xd9, 0x05, 0xcf, 0x06, 0x9d, 0x07, 0xcf, 0x06, 0xb1, 0x07, 0xcf, 0x06,\n 0xd5, 0x07, 0xcf, 0x06, 0xd9, 0x07, 0xcf, 0x06, 0xdd, 0x07, 0xcf, 0x06,\n 0x19, 0x00, 0x0f, 0x07, 0x41, 0x01, 0x0f, 0x07, 0x89, 0x01, 0x0f, 0x07,\n 0x05, 0x02, 0x0f, 0x07, 0x1d, 0x02, 0x0f, 0x07, 0x2d, 0x02, 0x0f, 0x07,\n 0x31, 0x02, 0x0f, 0x07, 0x35, 0x02, 0x0f, 0x07, 0x3d, 0x02, 0x0f, 0x07,\n 0x9d, 0x02, 0x0f, 0x07, 0xc5, 0x02, 0x0f, 0x07, 0xed, 0x02, 0x0f, 0x07,\n 0x15, 0x03, 0x0f, 0x07, 0x51, 0x03, 0x0f, 0x07, 0xa9, 0x03, 0x0f, 0x07,\n 0xcd, 0x03, 0x0f, 0x07, 0xe5, 0x03, 0x0f, 0x07, 0xf5, 0x03, 0x0f, 0x07,\n 0x05, 0x04, 0x0f, 0x07, 0x2d, 0x04, 0x0f, 0x07, 0x55, 0x04, 0x0f, 0x07,\n 0x99, 0x04, 0x0f, 0x07, 0xcd, 0x04, 0x0f, 0x07, 0xf1, 0x04, 0x0f, 0x07,\n 0x09, 0x05, 0x0f, 0x07, 0x41, 0x05, 0x0f, 0x07, 0xc1, 0x05, 0x0f, 0x07,\n 0xe9, 0x05, 0x0f, 0x07, 0x19, 0x07, 0x0f, 0x07, 0x59, 0x07, 0x0f, 0x07,\n 0x71, 0x07, 0x0f, 0x07, 0x89, 0x07, 0x0f, 0x07, 0xa1, 0x07, 0x0f, 0x07,\n 0xe5, 0x07, 0x0f, 0x07, 0x55, 0x00, 0x4f, 0x07, 0x79, 0x00, 0x4f, 0x07,\n 0xb9, 0x00, 0x4f, 0x07, 0x6d, 0x01, 0x4f, 0x07, 0xb5, 0x01, 0x4f, 0x07,\n 0x4d, 0x03, 0x4f, 0x07, 0x21, 0x04, 0x4f, 0x07, 0x5d, 0x04, 0x4f, 0x07,\n 0x85, 0x04, 0x4f, 0x07, 0xf9, 0x04, 0x4f, 0x07, 0x65, 0x05, 0x4f, 0x07,\n 0x81, 0x05, 0x4f, 0x07, 0xd9, 0x00, 0x8f, 0x07, 0x35, 0x01, 0x8f, 0x07,\n 0x69, 0x01, 0x8f, 0x07, 0x75, 0x01, 0x8f, 0x07, 0xad, 0x01, 0x8f, 0x07,\n 0xed, 0x01, 0x8f, 0x07, 0x19, 0x02, 0x8f, 0x07, 0x41, 0x02, 0x8f, 0x07,\n 0x4d, 0x02, 0x8f, 0x07, 0x59, 0x02, 0x8f, 0x07, 0xa5, 0x03, 0x8f, 0x07,\n 0xb9, 0x03, 0x8f, 0x07, 0xc9, 0x03, 0x8f, 0x07, 0xd5, 0x03, 0x8f, 0x07,\n 0xed, 0x03, 0x8f, 0x07, 0x01, 0x04, 0x8f, 0x07, 0x11, 0x04, 0x8f, 0x07,\n 0x21, 0x04, 0x8f, 0x07, 0x31, 0x04, 0x8f, 0x07, 0x41, 0x04, 0x8f, 0x07,\n 0x51, 0x04, 0x8f, 0x07, 0x79, 0x04, 0x8f, 0x07, 0x95, 0x04, 0x8f, 0x07,\n 0x9d, 0x04, 0x8f, 0x07, 0xa5, 0x04, 0x8f, 0x07, 0xb5, 0x04, 0x8f, 0x07,\n 0xc5, 0x04, 0x8f, 0x07, 0xd5, 0x04, 0x8f, 0x07, 0xe5, 0x04, 0x8f, 0x07,\n 0xf5, 0x04, 0x8f, 0x07, 0x05, 0x05, 0x8f, 0x07, 0x1d, 0x05, 0x8f, 0x07,\n 0x2d, 0x05, 0x8f, 0x07, 0x3d, 0x05, 0x8f, 0x07, 0x51, 0x05, 0x8f, 0x07,\n 0xc5, 0x07, 0x8f, 0x07, 0xed, 0x07, 0x8f, 0x07, 0xf5, 0x07, 0x8f, 0x07,\n 0xfd, 0x07, 0x8f, 0x07, 0x0d, 0x00, 0xcf, 0x07, 0x15, 0x00, 0xcf, 0x07,\n 0x1d, 0x00, 0xcf, 0x07, 0x29, 0x00, 0xcf, 0x07, 0x31, 0x00, 0xcf, 0x07,\n 0x39, 0x00, 0xcf, 0x07, 0x51, 0x00, 0xcf, 0x07, 0xd1, 0x00, 0xcf, 0x07,\n 0xd9, 0x00, 0xcf, 0x07, 0xe1, 0x00, 0xcf, 0x07, 0x41, 0x03, 0xcf, 0x07,\n 0xad, 0x03, 0xcf, 0x07, 0xe9, 0x03, 0xcf, 0x07, 0x6d, 0x04, 0xcf, 0x07,\n 0xed, 0x04, 0xcf, 0x07, 0x1d, 0x05, 0xcf, 0x07, 0x31, 0x05, 0xcf, 0x07,\n 0xc1, 0x05, 0xcf, 0x07, 0xb1, 0x06, 0xcf, 0x07, 0xfd, 0x06, 0xcf, 0x07,\n 0xc1, 0x07, 0xcf, 0x07, 0xf9, 0x07, 0xcf, 0x07, 0x21, 0x00, 0x0f, 0x08,\n 0x4d, 0x03, 0x0f, 0x08, 0x5d, 0x03, 0x0f, 0x08, 0x65, 0x03, 0x0f, 0x08,\n 0xb1, 0x03, 0x0f, 0x08, 0x6d, 0x00, 0x8f, 0x08, 0x21, 0x02, 0x8f, 0x08,\n 0x89, 0x02, 0x4f, 0x0a, 0xd1, 0x02, 0x4f, 0x0a, 0xe5, 0x02, 0x4f, 0x0a,\n 0xcd, 0x07, 0x4f, 0x0a, 0xd9, 0x07, 0x4f, 0x0a, 0x15, 0x02, 0x8f, 0x0a,\n 0x5d, 0x02, 0x8f, 0x0a, 0x95, 0x02, 0x8f, 0x0a, 0xed, 0x02, 0x8f, 0x0a,\n 0x85, 0x03, 0x8f, 0x0a, 0x45, 0x05, 0x8f, 0x0a, 0x4d, 0x05, 0x8f, 0x0a,\n 0x39, 0x06, 0x8f, 0x0a, 0x4d, 0x00, 0xcf, 0x0a, 0x41, 0x04, 0xcf, 0x0a,\n 0x91, 0x04, 0xcf, 0x0a, 0xa9, 0x04, 0xcf, 0x0a, 0x31, 0x05, 0xcf, 0x0a,\n 0xa5, 0x05, 0xcf, 0x0a, 0x0d, 0x06, 0xcf, 0x0a, 0x4d, 0x06, 0xcf, 0x0a,\n 0x61, 0x06, 0xcf, 0x0a, 0x79, 0x06, 0xcf, 0x0a, 0x81, 0x06, 0xcf, 0x0a,\n 0xb5, 0x06, 0xcf, 0x0a, 0x59, 0x07, 0xcf, 0x0a, 0x8d, 0x07, 0xcf, 0x0a,\n 0xc1, 0x07, 0xcf, 0x0a, 0xd5, 0x07, 0xcf, 0x0a, 0xfd, 0x07, 0xcf, 0x0a,\n 0x49, 0x00, 0x0f, 0x0b, 0x71, 0x00, 0x0f, 0x0b, 0xf9, 0x00, 0x0f, 0x0b,\n 0x11, 0x01, 0x0f, 0x0b, 0x5d, 0x01, 0x0f, 0x0b, 0x65, 0x01, 0x0f, 0x0b,\n 0x99, 0x01, 0x0f, 0x0b, 0xa5, 0x03, 0x00, 0x00, 0xe5, 0x01, 0x0f, 0x0b,\n 0x55, 0x02, 0x0f, 0x0b, 0x6d, 0x02, 0x0f, 0x0b, 0x7d, 0x02, 0x0f, 0x0b,\n 0x9d, 0x03, 0x0f, 0x0b, 0xa9, 0x03, 0x0f, 0x0b, 0xcd, 0x04, 0x0f, 0x0b,\n 0x45, 0x06, 0x0f, 0x0b, 0x51, 0x06, 0x0f, 0x0b, 0xf5, 0x07, 0x0f, 0x0b,\n 0x0d, 0x00, 0x4f, 0x0b, 0xa1, 0x00, 0x4f, 0x0b, 0x81, 0x01, 0x4f, 0x0b,\n 0x15, 0x02, 0x4f, 0x0b, 0x4d, 0x02, 0x4f, 0x0b, 0x5d, 0x02, 0x4f, 0x0b,\n 0xbd, 0x02, 0x4f, 0x0b, 0xe5, 0x02, 0x4f, 0x0b, 0xc1, 0x03, 0x4f, 0x0b,\n 0x39, 0x04, 0x4f, 0x0b, 0x41, 0x04, 0x4f, 0x0b, 0x95, 0x05, 0x4f, 0x0b,\n 0xf9, 0x05, 0x4f, 0x0b, 0x49, 0x06, 0x4f, 0x0b, 0x6d, 0x06, 0x4f, 0x0b,\n 0x41, 0x03, 0x8f, 0x0b, 0x59, 0x03, 0x8f, 0x0b, 0x21, 0x07, 0x8f, 0x0b,\n 0x89, 0x03, 0x0f, 0x0c, 0x5d, 0x05, 0x4f, 0x0c, 0xd9, 0x05, 0x4f, 0x0c,\n 0x05, 0x06, 0x4f, 0x0c, 0x75, 0x06, 0x4f, 0x0c, 0x45, 0x07, 0x4f, 0x0c,\n 0x89, 0x07, 0x4f, 0x0c, 0xb5, 0x07, 0x4f, 0x0c, 0x21, 0x00, 0x8f, 0x0c,\n 0xc5, 0x00, 0x8f, 0x0c, 0x75, 0x02, 0x8f, 0x0c, 0x95, 0x02, 0x8f, 0x0c,\n 0x99, 0x02, 0x8f, 0x0c, 0x9d, 0x02, 0x8f, 0x0c, 0xa1, 0x02, 0x8f, 0x0c,\n 0xad, 0x02, 0x8f, 0x0c, 0xb5, 0x02, 0x8f, 0x0c, 0xb9, 0x02, 0x8f, 0x0c,\n 0xc1, 0x02, 0x8f, 0x0c, 0x5d, 0x03, 0x8f, 0x0c, 0xbd, 0x03, 0x8f, 0x0c,\n 0xc9, 0x03, 0x8f, 0x0c, 0xcd, 0x03, 0x8f, 0x0c, 0xd9, 0x03, 0x8f, 0x0c,\n 0xe1, 0x03, 0x8f, 0x0c, 0xe5, 0x03, 0x8f, 0x0c, 0xed, 0x03, 0x8f, 0x0c,\n 0x3d, 0x04, 0x8f, 0x0c, 0x6d, 0x04, 0x8f, 0x0c, 0x71, 0x04, 0x8f, 0x0c,\n 0x7d, 0x04, 0x8f, 0x0c, 0x81, 0x04, 0x8f, 0x0c, 0x85, 0x04, 0x8f, 0x0c,\n 0x99, 0x04, 0x8f, 0x0c, 0x31, 0x05, 0x4f, 0x0d, 0x85, 0x05, 0x4f, 0x0d,\n 0x61, 0x04, 0x8f, 0x0d, 0xc9, 0x04, 0x8f, 0x0d, 0x69, 0x05, 0x8f, 0x0d,\n 0xe9, 0x05, 0x8f, 0x0d, 0x19, 0x06, 0x8f, 0x0d, 0xd1, 0x06, 0x8f, 0x0d,\n 0xe9, 0x07, 0x8f, 0x0d, 0xf1, 0x07, 0x8f, 0x0d, 0x21, 0x00, 0xcf, 0x0d,\n 0x2d, 0x00, 0xcf, 0x0d, 0x39, 0x00, 0xcf, 0x0d, 0x45, 0x00, 0xcf, 0x0d,\n 0x51, 0x00, 0xcf, 0x0d, 0x5d, 0x00, 0xcf, 0x0d, 0x65, 0x00, 0xcf, 0x0d,\n 0x6d, 0x00, 0xcf, 0x0d, 0xf1, 0x00, 0xcf, 0x0d, 0xfd, 0x00, 0xcf, 0x0d,\n 0x05, 0x01, 0xcf, 0x0d, 0x0d, 0x01, 0xcf, 0x0d, 0x15, 0x01, 0xcf, 0x0d,\n 0x1d, 0x01, 0xcf, 0x0d, 0x25, 0x01, 0xcf, 0x0d, 0xd5, 0x02, 0xcf, 0x0d,\n 0x81, 0x07, 0xcf, 0x0d, 0xfd, 0x07, 0xcf, 0x0d, 0xd5, 0x00, 0x0f, 0x0e,\n 0x3d, 0x01, 0x0f, 0x0e, 0x85, 0x01, 0x0f, 0x0e, 0xa1, 0x01, 0x0f, 0x0e,\n 0xa5, 0x02, 0x0f, 0x0e, 0x51, 0x03, 0x0f, 0x0e, 0xfd, 0x03, 0x0f, 0x0e,\n 0x35, 0x07, 0x0f, 0x0e, 0x85, 0x07, 0x0f, 0x0e, 0x0d, 0x00, 0x4f, 0x0e,\n 0x9d, 0x00, 0x4f, 0x0e, 0x21, 0x01, 0x4f, 0x0e, 0x2d, 0x02, 0x4f, 0x0e,\n 0x3d, 0x02, 0x4f, 0x0e, 0x91, 0x07, 0x8f, 0x0e, 0x9d, 0x07, 0x8f, 0x0e,\n 0xa9, 0x07, 0x8f, 0x0e, 0xb5, 0x07, 0x8f, 0x0e, 0xd9, 0x07, 0x8f, 0x0e,\n 0xed, 0x07, 0x8f, 0x0e, 0xd1, 0x00, 0xcf, 0x0e, 0xd9, 0x00, 0xcf, 0x0e,\n 0xe1, 0x00, 0xcf, 0x0e, 0xf5, 0x00, 0xcf, 0x0e, 0xf9, 0x01, 0x00, 0x00,\n 0x25, 0x04, 0xcf, 0x0b, 0xed, 0x05, 0x8f, 0x0c, 0x0d, 0x06, 0x8f, 0x0c,\n 0x11, 0x06, 0x8f, 0x0c, 0x19, 0x06, 0x8f, 0x0c, 0xa1, 0x00, 0xcf, 0x0c,\n 0x01, 0x02, 0xcf, 0x0c, 0x2d, 0x05, 0x0f, 0x0d, 0xad, 0x07, 0x0f, 0x0d,\n 0xf1, 0x07, 0x0f, 0x0d, 0x79, 0x00, 0xc0, 0x00, 0x45, 0x04, 0x4f, 0x0e,\n 0x59, 0x04, 0x4f, 0x0e, 0x91, 0x04, 0x4f, 0x0e, 0xc1, 0x04, 0x4f, 0x0e,\n 0x65, 0x06, 0x4f, 0x0e, 0xed, 0x02, 0x8f, 0x0e, 0x51, 0x03, 0x8f, 0x0e,\n 0xe9, 0x05, 0x0f, 0x0f, 0xab, 0x26, 0xe0, 0x7c, 0x00, 0x00, 0x4f, 0x00,\n 0x6f, 0x24, 0x3f, 0x00, 0xec, 0xc3, 0xa1, 0xc1, 0xcb, 0x47, 0x80, 0x00,\n 0x50, 0x20, 0x40, 0x8f, 0x28, 0x46, 0x8b, 0x0a, 0x31, 0x00, 0x08, 0x45,\n 0x02, 0x6f, 0x0e, 0x70, 0x00, 0x18, 0x43, 0x00, 0x10, 0x41, 0x04, 0x8e,\n 0x8c, 0x70, 0x4b, 0xd9, 0x6c, 0x71, 0x80, 0x45, 0xc3, 0x46, 0x80, 0x3f,\n 0x00, 0x00, 0x22, 0x42, 0x2a, 0x5b, 0x04, 0x8e, 0x40, 0xd9, 0x40, 0x24,\n 0xc2, 0x30, 0x6c, 0x71, 0x28, 0x5b, 0x87, 0xe8, 0x03, 0x14, 0x80, 0x30,\n 0x0f, 0x08, 0xb0, 0x0c, 0x4c, 0xd9, 0x06, 0x71, 0xd3, 0x08, 0x92, 0xa2,\n 0x23, 0xf0, 0x02, 0x1c, 0x83, 0x31, 0x04, 0x8e, 0x40, 0x24, 0x82, 0x30,\n 0x6c, 0x71, 0x29, 0x5b, 0x00, 0x8f, 0x35, 0x08, 0xb5, 0x00, 0x2c, 0x71,\n 0x8a, 0x22, 0x4d, 0x00, 0x6c, 0x71, 0x11, 0xf0, 0x00, 0x1c, 0x84, 0x30,\n 0x00, 0x14, 0x00, 0x31, 0x64, 0x77, 0x0a, 0xf0, 0x0c, 0x71, 0xab, 0x20,\n 0x61, 0x0a, 0x8b, 0x44, 0x00, 0x94, 0x04, 0x77, 0x00, 0xb4, 0x00, 0x94,\n 0xf8, 0xe8, 0x2f, 0x26, 0xc8, 0xf0, 0xf0, 0xf5, 0x20, 0xaf, 0xd3, 0x41,\n 0x80, 0x00, 0x72, 0x3e, 0xd3, 0x40, 0x80, 0x00, 0x68, 0x3e, 0x85, 0x0d,\n 0xb4, 0x10, 0x4e, 0x70, 0xad, 0x0d, 0x30, 0x14, 0xc1, 0x40, 0x8c, 0x25,\n 0x02, 0x90, 0xcc, 0x25, 0x82, 0x9f, 0x00, 0x00, 0xff, 0x00, 0x33, 0xf4,\n 0x00, 0x11, 0x80, 0x20, 0x44, 0x6f, 0x40, 0x27, 0x52, 0x11, 0x46, 0x20,\n 0x00, 0x0e, 0x00, 0x1a, 0x03, 0x01, 0x00, 0x1a, 0x83, 0x23, 0x00, 0x19,\n 0x02, 0x20, 0x7f, 0xdd, 0x04, 0x8e, 0x8c, 0x70, 0x17, 0xbd, 0x51, 0xd9,\n 0x6c, 0x71, 0x80, 0x45, 0xa1, 0x46, 0x2a, 0x5b, 0x04, 0x8e, 0x8c, 0x70,\n 0x52, 0xd9, 0x6c, 0x71, 0x80, 0x45, 0x42, 0x42, 0xa1, 0x46, 0x2a, 0x5b,\n 0x00, 0x11, 0x80, 0x20, 0xff, 0xdc, 0x43, 0x6f, 0x00, 0x18, 0x00, 0x23,\n 0x00, 0xaa, 0x04, 0x8e, 0x8c, 0x70, 0x4e, 0xd9, 0x6c, 0x71, 0x80, 0x45,\n 0xa1, 0x46, 0x2a, 0x5b, 0x0c, 0x70, 0xc1, 0x41, 0x00, 0x1f, 0x83, 0x10,\n 0x31, 0x5b, 0x00, 0x10, 0x0d, 0x20, 0x24, 0xf0, 0x42, 0x6f, 0x00, 0x1a,\n 0x82, 0x04, 0x00, 0x19, 0x82, 0x24, 0x04, 0x8e, 0x4b, 0xd9, 0x6c, 0x71,\n 0x42, 0x44, 0x42, 0x45, 0xc3, 0x46, 0x80, 0x3f, 0x00, 0x00, 0x2a, 0x5b,\n 0x0c, 0x71, 0x00, 0x1f, 0x82, 0x14, 0x21, 0x5b, 0x0c, 0x70, 0xc1, 0x41,\n 0x00, 0x18, 0x40, 0x23, 0x31, 0x5b, 0x0c, 0xf0, 0x2a, 0x09, 0x8f, 0x09,\n 0x00, 0x41, 0xc1, 0x40, 0x30, 0x5b, 0x47, 0x86, 0x0c, 0x71, 0x60, 0x7a,\n 0xc1, 0x41, 0x10, 0xdd, 0xa1, 0x40, 0xcc, 0xc7, 0xe2, 0xc2, 0x96, 0x0d,\n 0xaf, 0x0a, 0x08, 0x45, 0x06, 0x1d, 0xc5, 0x11, 0xc2, 0xc6, 0xe0, 0x78,\n 0xf1, 0xc0, 0x00, 0x16, 0x83, 0x70, 0x80, 0x00, 0xc4, 0x23, 0x05, 0xeb,\n 0x0a, 0x0e, 0xcf, 0x0a, 0x04, 0xf0, 0xc3, 0x40, 0x00, 0x00, 0xfd, 0xff,\n 0xd1, 0xc0, 0xe0, 0x7f, 0x0e, 0x78, 0xe0, 0x78, 0xf1, 0xc0, 0xc3, 0x42,\n 0x80, 0x00, 0xd0, 0x22, 0x20, 0x82, 0x20, 0x81, 0x1b, 0x09, 0x80, 0x0f,\n 0xa5, 0x5a, 0x6b, 0xb6, 0x24, 0x8a, 0x89, 0xe9, 0x2c, 0x71, 0x14, 0x70,\n 0x27, 0xd8, 0x24, 0xaa, 0x05, 0xf2, 0x27, 0xd8, 0x2f, 0x5b, 0xd1, 0xc0,\n 0xe0, 0x7e, 0xab, 0x20, 0xe0, 0x0c, 0xab, 0x21, 0x61, 0x0a, 0xff, 0xf1,\n 0x05, 0xe8, 0x00, 0x18, 0x84, 0x0f, 0x00, 0x00, 0xe1, 0x07, 0x06, 0xe9,\n 0x00, 0x19, 0x82, 0x0f, 0x00, 0x00, 0x01, 0x00, 0x05, 0xea, 0x00, 0x1a,\n 0x82, 0x0f, 0x00, 0x00, 0x03, 0x00, 0x06, 0xeb, 0x00, 0x1b, 0x82, 0x0f,\n 0x00, 0x00, 0x04, 0x00, 0x0d, 0x0c, 0x10, 0x00, 0x00, 0x1c, 0x82, 0x0f,\n 0x00, 0x00, 0x26, 0x00, 0xb4, 0x70, 0xe0, 0x7c, 0x00, 0x1d, 0x82, 0x0f,\n 0x00, 0x00, 0x0b, 0x00, 0xe0, 0x7e, 0xe0, 0x78, 0xc3, 0x42, 0x7f, 0x00,\n 0xc0, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xc4, 0x90, 0xf1, 0x07, 0x4f, 0x0b,\n 0xc3, 0x42, 0x7f, 0x00, 0xa4, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xa8, 0x90,\n 0xe1, 0x07, 0x4f, 0x0b, 0xc3, 0x42, 0x7f, 0x00, 0x94, 0x90, 0xc3, 0x43,\n 0x7f, 0x00, 0x98, 0x90, 0xd1, 0x07, 0x4f, 0x0b, 0xc3, 0x42, 0x7f, 0x00,\n 0xa0, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xa4, 0x90, 0xc1, 0x07, 0x4f, 0x0b,\n 0xc3, 0x42, 0x7f, 0x00, 0x98, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xa0, 0x90,\n 0xb1, 0x07, 0x4f, 0x0b, 0xc3, 0x42, 0x7f, 0x00, 0xa8, 0x90, 0xc3, 0x43,\n 0x7f, 0x00, 0xc0, 0x90, 0x91, 0x07, 0x4f, 0x0b, 0xf1, 0xc0, 0xa1, 0xc1,\n 0x2c, 0x70, 0xc3, 0x42, 0x7f, 0x00, 0xc4, 0x90, 0xc3, 0x43, 0x7f, 0x00,\n 0xc8, 0x90, 0x8c, 0x76, 0x3e, 0x0f, 0xef, 0x0c, 0x40, 0x24, 0x05, 0x30,\n 0x00, 0xc0, 0x87, 0x74, 0xd1, 0xc0, 0xe0, 0x7e, 0xc3, 0x42, 0x7f, 0x00,\n 0xcc, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xcc, 0x90, 0x5d, 0x07, 0x4f, 0x0b,\n 0xf1, 0xc0, 0xa1, 0xc1, 0x0c, 0x70, 0x2c, 0x70, 0xc3, 0x42, 0x7f, 0x00,\n 0xc8, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xc8, 0x90, 0x8c, 0x74, 0x0a, 0x0f,\n 0xef, 0x0c, 0x40, 0x24, 0xc5, 0x30, 0x03, 0x14, 0x80, 0x30, 0x87, 0x74,\n 0xd1, 0xc0, 0xe0, 0x7e, 0xc3, 0x42, 0x7f, 0x00, 0xcc, 0x90, 0xc3, 0x43,\n 0x7f, 0x00, 0xcc, 0x90, 0x25, 0x07, 0x4f, 0x0b, 0xc3, 0x42, 0x7f, 0x00,\n 0xcc, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xcc, 0x90, 0x15, 0x07, 0x4f, 0x0b,\n 0xc3, 0x42, 0x7f, 0x00, 0xc4, 0x90, 0x15, 0x07, 0x6f, 0x0b, 0x40, 0x43,\n 0x00, 0x16, 0x80, 0x70, 0x7f, 0x00, 0xa5, 0x96, 0xdd, 0x02, 0xaf, 0x0e,\n 0x79, 0x20, 0x00, 0x00, 0x00, 0x16, 0x80, 0x70, 0x7f, 0x00, 0xa5, 0x96,\n 0x14, 0x70, 0xe0, 0x7d, 0xc9, 0x02, 0xaf, 0x0e, 0x0c, 0x70, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x10, 0x2f, 0x90, 0x01, 0x0b, 0x05, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x00, 0x00, 0xdc, 0xcd, 0x60, 0x00,\n 0x74, 0x8d, 0x7f, 0x00, 0x10, 0xcd, 0x60, 0x00, 0x18, 0xd0, 0x60, 0x00,\n 0x3c, 0xcd, 0x60, 0x00, 0xd0, 0xcc, 0x60, 0x00, 0xa4, 0xcc, 0x60, 0x00,\n 0x48, 0xcd, 0x60, 0x00, 0x1c, 0xcd, 0x60, 0x00, 0xf4, 0xce, 0x60, 0x00,\n 0x08, 0xcd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x80, 0x00,\n 0x1c, 0x9a, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x64, 0x00, 0xd0, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xff, 0x03, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x69, 0x08, 0xe8, 0x03,\n 0x30, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x01, 0x02, 0x00, 0x00, 0xd8, 0xbc, 0x60, 0x00, 0x64, 0xbd, 0x60, 0x00,\n 0x50, 0xbc, 0x60, 0x00, 0x40, 0xbe, 0x60, 0x00, 0x84, 0xbc, 0x60, 0x00,\n 0x08, 0xbc, 0x60, 0x00, 0xd4, 0xbb, 0x60, 0x00, 0x90, 0xbc, 0x60, 0x00,\n 0x40, 0xb3, 0x60, 0x00, 0x20, 0xbd, 0x60, 0x00, 0x44, 0xbc, 0x60, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x70, 0x3a, 0x80, 0x00, 0x44, 0x9a, 0x7f, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x1e, 0x05, 0x3e,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01,\n 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,\n 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x69, 0x2f, 0xe8, 0x03, 0x31, 0x01, 0x10, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,\n 0xb4, 0xb4, 0x60, 0x00, 0x40, 0xb5, 0x60, 0x00, 0x2c, 0xb4, 0x60, 0x00,\n 0xa8, 0xb5, 0x60, 0x00, 0x60, 0xb4, 0x60, 0x00, 0xbc, 0xb3, 0x60, 0x00,\n 0x88, 0xb3, 0x60, 0x00, 0x6c, 0xb4, 0x60, 0x00, 0x38, 0xb4, 0x60, 0x00,\n 0xfc, 0xb4, 0x60, 0x00, 0x20, 0xb4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x7c, 0x3a, 0x80, 0x00, 0xf0, 0xa0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0xcd, 0xcc, 0x4c, 0x3f, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0xe8, 0x03, 0x01, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0x7d, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x58, 0x20, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00, 0xe9, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x34, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x49, 0x61, 0x00,\n 0xe8, 0x48, 0x61, 0x00, 0xd8, 0x48, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0xe0, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x01, 0x00, 0x00,\n 0xea, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x18, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0xec, 0x27, 0x61, 0x00, 0x7c, 0x27, 0x61, 0x00, 0x6c, 0x27, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x80, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x16, 0x01, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x1f, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9c, 0x60, 0x00, 0xec, 0x9b, 0x60, 0x00,\n 0xd0, 0x9b, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x50, 0x21, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x8c, 0xe4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,\n 0xf1, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x94, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x01, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x7c, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf3, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,\n 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0xb8, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,\n 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x10, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x02, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0xcc, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x01, 0x00, 0x00, 0xf5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0d, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7c, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf6, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,\n 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0xe8, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,\n 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x09, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x9c, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x01, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x12, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x68, 0x61, 0x00,\n 0x1c, 0x68, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0xb8, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf9, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x30, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x68, 0x61, 0x00,\n 0xd0, 0x67, 0x61, 0x00, 0xb8, 0x67, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x80, 0x23, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,\n 0xfa, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x11, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x44, 0x64, 0x61, 0x00, 0x34, 0x64, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x01, 0x00, 0x00, 0xfb, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x7c, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0a,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0xb0, 0x7a, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,\n 0xfd, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x0c, 0x7b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x01, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x7c, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0xe0, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x41, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0xf4, 0xff, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00,\n 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x17, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x24, 0x7e, 0x61, 0x00, 0x1c, 0x7d, 0x61, 0x00, 0x98, 0x7d, 0x61, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x20, 0x80, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x32, 0x00, 0xec, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x16, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x64, 0x70, 0x61, 0x00, 0xf4, 0x6f, 0x61, 0x00,\n 0xe4, 0x6f, 0x61, 0x00, 0x7c, 0x70, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x1c, 0x23, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0xc8, 0x00, 0xf0, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0xe9, 0x60, 0x00,\n 0x98, 0xe4, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x8b, 0xc8, 0x00, 0x00, 0x03, 0x17, 0x00, 0x00,\n 0xb0, 0x2d, 0x03, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x94, 0x90, 0x7f, 0x00, 0x98, 0x90, 0x7f, 0x00,\n 0x98, 0x90, 0x7f, 0x00, 0xa0, 0x90, 0x7f, 0x00, 0xa0, 0x90, 0x7f, 0x00,\n 0xa4, 0x90, 0x7f, 0x00, 0xa4, 0x90, 0x7f, 0x00, 0xa8, 0x90, 0x7f, 0x00,\n 0xa8, 0x90, 0x7f, 0x00, 0xc0, 0x90, 0x7f, 0x00, 0xc0, 0x90, 0x7f, 0x00,\n 0xc4, 0x90, 0x7f, 0x00, 0xc4, 0x90, 0x7f, 0x00, 0xc4, 0x90, 0x7f, 0x00,\n 0xc4, 0x90, 0x7f, 0x00, 0xc8, 0x90, 0x7f, 0x00, 0xc8, 0x90, 0x7f, 0x00,\n 0xc8, 0x90, 0x7f, 0x00, 0xc8, 0x90, 0x7f, 0x00, 0xcc, 0x90, 0x7f, 0x00,\n 0xcc, 0x90, 0x7f, 0x00, 0xcc, 0x90, 0x7f, 0x00, 0xcc, 0x90, 0x7f, 0x00,\n 0xcc, 0x90, 0x7f, 0x00, 0xcc, 0x90, 0x7f, 0x00, 0xcc, 0x90, 0x7f, 0x00,\n 0xab, 0x26, 0x0a, 0x74, 0x7f, 0x00, 0x98, 0x80, 0xe0, 0x7e, 0xe0, 0x78,\n 0xc3, 0x40, 0x7f, 0x00, 0x00, 0x80, 0x6b, 0x20, 0x40, 0x09, 0xdb, 0x44,\n 0x80, 0x00, 0x50, 0x20, 0xdb, 0x42, 0x80, 0x00, 0x50, 0x21, 0x0a, 0x22,\n 0x80, 0x8f, 0x7f, 0x00, 0xdc, 0x99, 0xe2, 0x20, 0x82, 0x00, 0x6f, 0x70,\n 0x22, 0x20, 0x80, 0x0f, 0x7f, 0x00, 0x00, 0xa1, 0x9d, 0x03, 0x8f, 0x03,\n 0x48, 0xa5, 0x7f, 0x00, 0x27, 0x00, 0x02, 0x01, 0x14, 0x05, 0x14, 0x05,\n 0xc4, 0x09, 0x06, 0x09, 0x70, 0x17, 0x00, 0x00, 0x80, 0x3d, 0xcd, 0xcc,\n 0x4c, 0x3f, 0x00, 0x00, 0xe0, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\n 0x01, 0x01, 0x01, 0x01, 0x01, 0x86, 0x54, 0x00, 0x25, 0x00, 0x03, 0x01,\n 0x00, 0x09, 0x0c, 0x96, 0x00, 0x10, 0x3c, 0x00, 0x01, 0x00, 0x01, 0x00,\n 0xb0, 0x04, 0x52, 0x03, 0x00, 0x00, 0x40, 0x41, 0x01, 0x01, 0x01, 0x01,\n 0x02, 0x02, 0x02, 0x03, 0x03, 0x01, 0x01, 0xb4, 0x73, 0x00, 0x00, 0x00,\n 0x82, 0x06, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x33,\n 0xb3, 0x3e, 0xcd, 0xcc, 0x0c, 0x3f, 0xcd, 0xcc, 0x0c, 0x3f, 0x33, 0x33,\n 0x33, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0xcd, 0xcc, 0x4c, 0x3f, 0x01, 0x00,\n 0x09, 0x04, 0x02, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17,\n 0xb7, 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x37, 0x86, 0x35, 0xbd,\n 0x37, 0x86, 0x35, 0xbd, 0x37, 0x86, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x10, 0x42, 0xe8, 0x03, 0x05, 0x00, 0x2d, 0x00, 0x84, 0x03, 0xb0,\n 0x04, 0x96, 0x00, 0x08, 0x96, 0x00, 0x0e, 0x01, 0x03, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x33, 0x33, 0xb3, 0x3e, 0xcd, 0xcc, 0x0c, 0x3f, 0xcd,\n 0xcc, 0x0c, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0x33, 0x33, 0x33, 0x3f, 0xcd,\n 0xcc, 0x4c, 0x3e, 0x01, 0x06, 0x04, 0x02, 0x00, 0x05, 0x00, 0x41, 0x01,\n 0x40, 0x01, 0x24, 0x00, 0x78, 0x00, 0x04, 0x01, 0x14, 0x14, 0x02, 0x02,\n 0x00, 0x04, 0x00, 0x00, 0x80, 0x3f, 0xcd, 0xcc, 0xcc, 0x3d, 0x9a, 0x99,\n 0x99, 0x3f, 0xcd, 0xcc, 0xcc, 0x3e, 0xcd, 0xcc, 0xcc, 0x3d, 0x01, 0x00,\n 0x14, 0x00, 0x10, 0x04, 0x78, 0x00, 0x08, 0x00, 0x00, 0x05, 0x9a, 0x99,\n 0x19, 0x3f, 0x9a, 0x99, 0x19, 0x3f, 0x50, 0x00, 0x09, 0x00, 0x1e, 0x00,\n 0xe8, 0x03, 0x50, 0x00, 0x41, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x80,\n 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x80, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,\n 0x40, 0xb5, 0xfe, 0x16, 0x37, 0xb5, 0xfe, 0x16, 0x37, 0xb5, 0xfe, 0x16,\n 0x37, 0x8b, 0xde, 0xa9, 0x38, 0x00, 0x00, 0xe0, 0x40, 0x0e, 0x01, 0x01,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0xcd, 0xcc, 0xcc, 0x3d, 0x01, 0x09, 0x09, 0x03, 0x13, 0x32,\n 0xa3, 0x04, 0xcd, 0x0c, 0x19, 0x28, 0x04, 0x0e, 0x00, 0x03, 0x9a, 0x99,\n 0x99, 0x3e, 0x9a, 0x99, 0x99, 0x3e, 0xcd, 0xcc, 0xcc, 0x3e, 0x9a, 0x99,\n 0x19, 0x3f, 0x9a, 0x99, 0x99, 0x3e, 0x00, 0x00, 0x80, 0x3e, 0x9a, 0x99,\n 0x99, 0x3e, 0xec, 0x51, 0xb8, 0x3e, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc,\n 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc, 0x4c, 0x3f, 0xcd, 0xcc,\n 0x4c, 0x3e, 0xcd, 0xcc, 0x4c, 0x3e, 0xcd, 0xcc, 0x4c, 0x3e, 0xcd, 0xcc,\n 0x4c, 0x3e, 0x01, 0xc2, 0xb8, 0xb2, 0x3e, 0x35, 0xfa, 0x8e, 0x3c, 0x0a,\n 0x00, 0x0a, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x50, 0x77, 0x56, 0x3d,\n 0x0e, 0x00, 0x00, 0x80, 0x3e, 0x8f, 0xc2, 0xf5, 0x3c, 0x0a, 0xd7, 0xa3,\n 0x3c, 0x64, 0x80, 0x34, 0x2d, 0x46, 0x01, 0x0a, 0x00, 0x50, 0x00, 0x00,\n 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x40, 0x09, 0x02, 0x00, 0x00, 0xc8,\n 0x41, 0x00, 0x00, 0x80, 0x42, 0x00, 0x00, 0x80, 0x41, 0x00, 0x00, 0xc0,\n 0x3f, 0xcd, 0xcc, 0x4c, 0x3d, 0xc2, 0xb8, 0xb2, 0x3d, 0x32, 0x25, 0x3b,\n 0x18, 0x47, 0x00, 0x00, 0xa0, 0x40, 0x9a, 0x99, 0x19, 0x3f, 0x0a, 0xd7,\n 0x23, 0x3c, 0x0a, 0xd7, 0x23, 0x3c, 0x02, 0x50, 0x77, 0x56, 0x3d, 0x00,\n 0x01, 0xcd, 0xcc, 0x4c, 0x3f, 0x00, 0x00, 0x60, 0x40, 0x00, 0x00, 0x20,\n 0x40, 0xcd, 0xcc, 0xcc, 0x3d, 0x04, 0x8f, 0xc2, 0xf5, 0x3c, 0x02, 0x01,\n 0x02, 0x03, 0x04, 0x01, 0x0a, 0xb0, 0x04, 0x64, 0x00, 0x0a, 0xd7, 0x23,\n 0x3c, 0x0a, 0xd7, 0x23, 0x3c, 0x01, 0x0a, 0x00, 0x0a, 0x00, 0x00, 0x00,\n 0xfa, 0x43, 0x00, 0x00, 0x7a, 0x44, 0x00, 0x00, 0xa0, 0x3f, 0x00, 0x00,\n 0x48, 0x42, 0x00, 0x00, 0x80, 0x3f, 0x9a, 0x99, 0x19, 0x3e, 0x9a, 0x99,\n 0x99, 0x3d, 0x00, 0x00, 0x20, 0x42, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x96, 0x18, 0x4b, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x96,\n 0x18, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x80, 0x96, 0x18, 0x4b, 0x00, 0x00, 0xc0, 0x40, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7,\n 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0xb7,\n 0xd1, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x17, 0xb7, 0xd1, 0x38, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0xd7,\n 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x0a, 0xd7, 0x23, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc5, 0x27, 0x37, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xc5,\n 0x27, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0xac, 0xc5, 0x27, 0x37, 0x00, 0x24, 0x74, 0x49, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24,\n 0x74, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x24, 0x74, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x04,\n 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x03, 0x04, 0x19, 0x40,\n 0x12, 0x18, 0x00, 0x40, 0x72, 0x08, 0x00, 0x0e, 0xb3, 0x80, 0x00, 0x00,\n 0x0e, 0x00, 0x01, 0x01, 0x01, 0x09, 0x0c, 0x88, 0x13, 0x10, 0x01, 0x01,\n 0x71, 0x2a, 0x00, 0x00, 0xf1, 0xc0, 0xc3, 0x40, 0x80, 0x00, 0xe0, 0x22,\n 0xc3, 0x42, 0x80, 0x00, 0x8c, 0x23, 0x2c, 0x70, 0x22, 0x0d, 0xef, 0x0c,\n 0x02, 0x7a, 0x12, 0x08, 0x00, 0x00, 0x32, 0x0c, 0x00, 0x00, 0xd1, 0xc0,\n 0xe0, 0x7e, 0xe0, 0x78, 0xe8, 0xc3, 0xa1, 0xc1, 0xc3, 0x40, 0x7f, 0x00,\n 0x74, 0xa8, 0x32, 0xe8, 0xcb, 0x46, 0x7f, 0x00, 0xf0, 0xa6, 0x36, 0x08,\n 0xef, 0x0e, 0xc1, 0x40, 0xab, 0xe8, 0x03, 0x8e, 0x0f, 0x08, 0xf4, 0x00,\n 0xe4, 0x6e, 0xa0, 0x87, 0x40, 0x26, 0x0f, 0x12, 0x10, 0xf0, 0xcb, 0x45,\n 0x60, 0x00, 0xe8, 0x99, 0x19, 0x00, 0x00, 0x00, 0x80, 0xc3, 0x02, 0x40,\n 0xc1, 0x41, 0x60, 0x7d, 0x81, 0x42, 0x03, 0x6e, 0x6c, 0x20, 0x40, 0x00,\n 0x1f, 0x67, 0x08, 0xe7, 0xc1, 0x87, 0x80, 0x87, 0xd5, 0x70, 0x0c, 0xf2,\n 0x40, 0x27, 0x10, 0x12, 0x30, 0xf6, 0xd3, 0x7a, 0x2c, 0x70, 0xb6, 0x0c,\n 0xef, 0x0c, 0x81, 0x40, 0x0a, 0x47, 0xf4, 0xf1, 0x04, 0xec, 0x04, 0x6f,\n 0xe4, 0x68, 0xf0, 0xf1, 0x0c, 0x70, 0xc8, 0xc7, 0xe8, 0xc3, 0xa5, 0xc1,\n 0x24, 0x5b, 0x08, 0x47, 0x22, 0x5b, 0x08, 0x46, 0x0c, 0x71, 0xe1, 0x41,\n 0xc1, 0x42, 0x23, 0x5b, 0x10, 0x40, 0x0e, 0xd8, 0xe1, 0x41, 0xc1, 0x42,\n 0x23, 0x5b, 0x08, 0x45, 0x10, 0xd8, 0xe1, 0x41, 0xc1, 0x42, 0x23, 0x5b,\n 0x08, 0x44, 0xae, 0x09, 0x20, 0x00, 0x02, 0x40, 0x00, 0x42, 0xa6, 0x09,\n 0x20, 0x00, 0xa1, 0x40, 0x00, 0x43, 0x9e, 0x09, 0x20, 0x00, 0x81, 0x40,\n 0x08, 0x44, 0xcb, 0x46, 0x80, 0x00, 0xa0, 0x3b, 0x07, 0xed, 0x08, 0x8d,\n 0x0b, 0x08, 0x11, 0x02, 0x00, 0x1e, 0x03, 0x10, 0x0d, 0xf0, 0xc3, 0x41,\n 0x80, 0x00, 0xe8, 0x3a, 0x00, 0x16, 0x0d, 0x71, 0x80, 0x00, 0xea, 0x3a,\n 0x00, 0x91, 0x00, 0x1e, 0x43, 0x10, 0xa6, 0x78, 0x00, 0xb1, 0x30, 0xd9,\n 0x80, 0xc0, 0xab, 0x21, 0xa0, 0x0d, 0x0c, 0x1c, 0x80, 0x3f, 0x7f, 0x00,\n 0x6c, 0x9a, 0x40, 0xc2, 0x42, 0xc4, 0x26, 0x0c, 0x2f, 0x0a, 0x41, 0xc3,\n 0x2f, 0x21, 0x07, 0x80, 0xad, 0x71, 0x0f, 0xf2, 0x40, 0x29, 0x02, 0x06,\n 0x5a, 0xd8, 0xad, 0x70, 0xab, 0x22, 0x60, 0x0d, 0xab, 0x25, 0x60, 0x1d,\n 0xab, 0x25, 0x60, 0x1d, 0xab, 0x21, 0x60, 0x0d, 0x2f, 0x5b, 0x15, 0xed,\n 0x11, 0x14, 0x80, 0x30, 0x24, 0xc1, 0x12, 0x14, 0x82, 0x30, 0x13, 0x14,\n 0x83, 0x30, 0x79, 0x20, 0x0c, 0x00, 0x79, 0x21, 0x00, 0x00, 0x79, 0x22,\n 0x02, 0x00, 0x84, 0x78, 0x79, 0x23, 0x01, 0x00, 0x44, 0x78, 0x0b, 0x79,\n 0x03, 0xf4, 0x5b, 0xd8, 0x2f, 0x5b, 0x7e, 0x0f, 0xaf, 0x0a, 0x0c, 0x70,\n 0x0c, 0x72, 0xc3, 0x41, 0x60, 0x00, 0x08, 0x9f, 0x2e, 0x5b, 0x0c, 0x72,\n 0xc3, 0x41, 0x60, 0x00, 0x64, 0x9d, 0x2d, 0x5b, 0x0f, 0xd8, 0xc3, 0x41,\n 0x61, 0x00, 0x18, 0x0f, 0x2e, 0x5b, 0x0f, 0xd8, 0xc3, 0x41, 0x61, 0x00,\n 0x48, 0x0e, 0x2d, 0x5b, 0x3f, 0xd8, 0xab, 0x20, 0xa0, 0x0d, 0xc8, 0xc7,\n 0xf2, 0xc2, 0x30, 0x44, 0x10, 0x43, 0x1b, 0xd9, 0x0c, 0x70, 0x70, 0x42,\n 0x50, 0x45, 0xab, 0x21, 0xa0, 0x0d, 0x20, 0x5b, 0xc3, 0x40, 0x7f, 0x00,\n 0xcc, 0x90, 0xc3, 0x41, 0x7f, 0x00, 0x70, 0x92, 0x02, 0x79, 0xd3, 0x41,\n 0x7f, 0x00, 0x70, 0x92, 0xc3, 0x43, 0x7f, 0x00, 0x14, 0x98, 0xd3, 0x40,\n 0x7f, 0x00, 0x14, 0x98, 0xc3, 0x42, 0x7f, 0x00, 0x44, 0x99, 0x02, 0x23,\n 0x4e, 0x04, 0x02, 0x22, 0x0d, 0x04, 0x84, 0x29, 0x02, 0x03, 0xcb, 0x47,\n 0x80, 0x00, 0xd0, 0x22, 0x84, 0x2e, 0x01, 0x13, 0x25, 0xaf, 0x2f, 0x79,\n 0x84, 0x2d, 0x01, 0x13, 0xc6, 0xaf, 0xc6, 0x0e, 0xaf, 0x0d, 0xa7, 0xaf,\n 0xcf, 0x79, 0x06, 0x0f, 0xaf, 0x0d, 0x22, 0x40, 0xaf, 0x79, 0xf2, 0x0e,\n 0xaf, 0x0d, 0x02, 0x40, 0xcb, 0x45, 0x7f, 0x00, 0x44, 0x99, 0x02, 0x0e,\n 0xaf, 0x0d, 0xa1, 0x40, 0xaa, 0x20, 0xe1, 0x04, 0x82, 0x41, 0x05, 0x20,\n 0x82, 0x0f, 0xb0, 0x2d, 0x00, 0x00, 0x62, 0x40, 0xf6, 0x0e, 0x6f, 0x0c,\n 0xab, 0x22, 0xe1, 0x04, 0x2f, 0x21, 0x85, 0x04, 0xae, 0x0f, 0x6f, 0x0e,\n 0xa2, 0x40, 0x66, 0x8f, 0x27, 0x8f, 0xc3, 0x40, 0x80, 0x00, 0xd8, 0x22,\n 0x45, 0x8f, 0x00, 0x21, 0xc4, 0x00, 0x61, 0x80, 0x20, 0x80, 0x72, 0x08,\n 0x20, 0x00, 0xa1, 0x40, 0x1d, 0xd9, 0x0c, 0x70, 0xab, 0x21, 0xa0, 0x0d,\n 0x20, 0x5b, 0x16, 0x08, 0x00, 0x00, 0xd2, 0xc6, 0x00, 0x41, 0x14, 0x70,\n 0x0c, 0x70, 0xe0, 0x7c, 0xe0, 0x7f, 0x16, 0x81, 0xe4, 0xc2, 0xad, 0x70,\n 0xcb, 0x46, 0x7f, 0x00, 0x74, 0x99, 0x08, 0x16, 0x00, 0x14, 0xfc, 0x16,\n 0x01, 0x90, 0x02, 0x79, 0x22, 0xb9, 0x2f, 0x79, 0x09, 0x09, 0x92, 0x00,\n 0xfe, 0x0b, 0x4f, 0x0c, 0xa5, 0x71, 0xeb, 0x0d, 0x54, 0x93, 0xc3, 0x42,\n 0x7f, 0x00, 0xc8, 0x90, 0xc3, 0x43, 0x7f, 0x00, 0xcc, 0x90, 0xd2, 0x0b,\n 0xcf, 0x0a, 0xc4, 0xc6, 0xf1, 0xc0, 0x2b, 0x5b, 0x14, 0x70, 0x0c, 0x71,\n 0x04, 0xf4, 0x25, 0xd8, 0x2f, 0x5b, 0x0c, 0x70, 0xd1, 0xc0, 0xe0, 0x7e,\n 0xf0, 0xc2, 0x50, 0x40, 0x10, 0xda, 0xab, 0x22, 0xa0, 0x0d, 0x55, 0x88,\n 0x97, 0x88, 0xcc, 0x88, 0x70, 0x44, 0x76, 0x88, 0x14, 0x88, 0x08, 0xba,\n 0x08, 0xbc, 0x45, 0x78, 0x05, 0x24, 0xc2, 0x10, 0x10, 0xba, 0x30, 0x41,\n 0x0a, 0x23, 0x00, 0x21, 0xc3, 0x41, 0x00, 0x00, 0xaa, 0x0a, 0xad, 0x70,\n 0x6d, 0x72, 0x4a, 0x24, 0x00, 0x72, 0xc3, 0xbe, 0x05, 0x7a, 0xa8, 0x20,\n 0xc0, 0x05, 0x53, 0x22, 0x40, 0x00, 0x4f, 0x20, 0x43, 0x00, 0x15, 0x0b,\n 0xb1, 0x00, 0x00, 0x2b, 0x43, 0x13, 0x66, 0x79, 0x14, 0x72, 0xcf, 0x21,\n 0x41, 0x03, 0x07, 0xf2, 0x0b, 0x08, 0x71, 0x00, 0x00, 0x2b, 0x40, 0x13,\n 0x05, 0x79, 0x22, 0xba, 0xa5, 0x72, 0x52, 0x6e, 0x0c, 0x71, 0xdb, 0x7c,\n 0x6c, 0x73, 0x00, 0x28, 0x82, 0x00, 0x00, 0x2b, 0x00, 0x03, 0x06, 0x79,\n 0xc1, 0x40, 0xab, 0x22, 0xa1, 0x0d, 0xab, 0x21, 0xe2, 0x03, 0x2c, 0x5b,\n 0xd5, 0x08, 0x30, 0x00, 0x1c, 0xd8, 0x4c, 0x72, 0xab, 0x20, 0xd0, 0x02,\n 0x42, 0x20, 0xc1, 0x03, 0x04, 0x71, 0xf9, 0x09, 0x74, 0x84, 0xab, 0x22,\n 0x88, 0x01, 0x4a, 0x24, 0x40, 0x71, 0x11, 0xd8, 0xa8, 0x20, 0xc0, 0x02,\n 0x40, 0x20, 0x02, 0x04, 0x42, 0x20, 0x81, 0x03, 0x04, 0x71, 0xab, 0x22,\n 0xd0, 0x02, 0xab, 0x21, 0x88, 0x01, 0x8d, 0x70, 0x4a, 0x24, 0x00, 0x73,\n 0x0c, 0x70, 0xed, 0x71, 0xa8, 0x20, 0x00, 0x02, 0xa8, 0x48, 0x04, 0x71,\n 0xab, 0x21, 0xd0, 0x02, 0xab, 0x27, 0x88, 0x11, 0x4a, 0x23, 0x80, 0x16,\n 0x8a, 0x21, 0x10, 0x00, 0x19, 0xde, 0x8a, 0x20, 0x08, 0x00, 0x8a, 0x22,\n 0x04, 0x00, 0x11, 0xdb, 0xad, 0x70, 0xd3, 0x42, 0x00, 0x00, 0xff, 0xff,\n 0xab, 0x23, 0xd0, 0x12, 0xab, 0x24, 0x88, 0x11, 0xab, 0x21, 0xe1, 0x0c,\n 0xab, 0x21, 0x62, 0x07, 0xab, 0x21, 0xa2, 0x06, 0xab, 0x26, 0xd0, 0x12,\n 0xab, 0x27, 0x88, 0x11, 0xab, 0x20, 0xe2, 0x06, 0xab, 0x20, 0xe1, 0x0c,\n 0xab, 0x20, 0x62, 0x07, 0xab, 0x20, 0xa2, 0x06, 0xab, 0x22, 0x62, 0x07,\n 0xab, 0x22, 0xa2, 0x06, 0x3d, 0x08, 0x30, 0x20, 0xab, 0x23, 0xa0, 0x0d,\n 0x22, 0x42, 0x0c, 0x70, 0x23, 0x92, 0x65, 0x8a, 0x55, 0x22, 0xc2, 0x08,\n 0xc9, 0xb9, 0x44, 0x23, 0x03, 0x04, 0x3c, 0x21, 0x8e, 0x04, 0x79, 0x21,\n 0x0f, 0x00, 0x24, 0xbb, 0xcb, 0x7f, 0x65, 0x78, 0x85, 0x71, 0xe5, 0x0c,\n 0x24, 0x94, 0xca, 0x22, 0x42, 0x20, 0x07, 0xf0, 0xb0, 0xd8, 0x2f, 0x5b,\n 0xad, 0x70, 0x13, 0xf0, 0x0c, 0x70, 0x5e, 0x0f, 0x4f, 0x0c, 0x1e, 0x0f,\n 0x6f, 0x0c, 0x42, 0x40, 0x22, 0x40, 0x02, 0x41, 0x82, 0x42, 0x7e, 0x0e,\n 0xef, 0xff, 0x62, 0x43, 0x05, 0xe8, 0x12, 0xd8, 0xad, 0x71, 0xab, 0x20,\n 0xa0, 0x0d, 0xa1, 0x40, 0xd0, 0xc6, 0xe0, 0x78, 0xe4, 0xc3, 0x82, 0x24,\n 0x11, 0x39, 0x8a, 0x21, 0x0c, 0x08, 0x00, 0x24, 0x80, 0x3f, 0x00, 0x00,\n 0x44, 0x01, 0x80, 0xc2, 0x38, 0x60, 0x0d, 0x0a, 0x25, 0x00, 0x40, 0xc2,\n 0x00, 0x42, 0x40, 0xc0, 0x81, 0xc0, 0x56, 0x20, 0x00, 0x0a, 0x09, 0x0a,\n 0x05, 0x00, 0x40, 0xc0, 0xcb, 0x45, 0x80, 0x00, 0xcc, 0x12, 0xcb, 0x46,\n 0x80, 0x00, 0xd0, 0x22, 0xcb, 0x44, 0xa5, 0x5a, 0x6b, 0xb6, 0x00, 0x24,\n 0x80, 0x3f, 0x00, 0x00, 0x44, 0x01, 0x28, 0xd9, 0x81, 0xc2, 0x10, 0xdb,\n 0xa0, 0xa6, 0x0e, 0x0d, 0xef, 0xff, 0x80, 0xa5, 0x44, 0x6d, 0xc3, 0x41,\n 0x80, 0x00, 0x00, 0x00, 0xc3, 0x43, 0x7f, 0x00, 0x74, 0x99, 0xc3, 0x44,\n 0x80, 0x00, 0x00, 0x00, 0x2e, 0x09, 0xef, 0x0c, 0xa1, 0x40, 0x0c, 0x70,\n 0xc4, 0xc7, 0xe0, 0x78, 0xf0, 0xc2, 0x70, 0x41, 0x50, 0x42, 0x30, 0x43,\n 0x10, 0x44, 0xab, 0x0b, 0x30, 0x00, 0xcd, 0x70, 0x8a, 0x20, 0x01, 0x23,\n 0x1a, 0x26, 0x0f, 0x14, 0x42, 0x77, 0xe1, 0x40, 0x25, 0x5b, 0x0d, 0x08,\n 0x95, 0x00, 0x22, 0x1f, 0x83, 0x10, 0x0a, 0xf0, 0x11, 0x08, 0x34, 0x02,\n 0xc1, 0x40, 0x9a, 0x20, 0x01, 0x03, 0x42, 0x70, 0x22, 0x18, 0xc3, 0x0f,\n 0x4c, 0xd8, 0xcc, 0x78, 0x42, 0x70, 0x35, 0x88, 0xc1, 0xb9, 0x23, 0x09,\n 0x71, 0x00, 0xa4, 0x68, 0x01, 0x95, 0x1b, 0xe8, 0x2f, 0x38, 0x03, 0x00,\n 0xc3, 0x41, 0x7f, 0x00, 0x60, 0x8d, 0xe1, 0x42, 0x33, 0x5b, 0x2b, 0x08,\n 0x33, 0x00, 0x01, 0xad, 0x23, 0xf0, 0xa1, 0x40, 0x82, 0x41, 0x62, 0x42,\n 0x42, 0x43, 0xa6, 0x08, 0x20, 0x00, 0x0a, 0x24, 0x40, 0x04, 0x09, 0xe8,\n 0x00, 0x41, 0x00, 0x80, 0xfe, 0xe8, 0xe0, 0xa1, 0x03, 0xf0, 0x01, 0x1d,\n 0xc3, 0x1f, 0xc9, 0x45, 0x9a, 0x25, 0x01, 0x13, 0x42, 0x75, 0x06, 0x85,\n 0x0d, 0xe8, 0x39, 0x8d, 0xc1, 0xb9, 0x13, 0x09, 0xb1, 0x00, 0x0f, 0x78,\n 0x82, 0x41, 0x62, 0x42, 0x23, 0x5b, 0x06, 0xa5, 0x03, 0xf0, 0x18, 0x1d,\n 0x01, 0x10, 0xc5, 0x71, 0xad, 0x70, 0x6d, 0x0e, 0x64, 0x94, 0xed, 0x70,\n 0x05, 0xf0, 0xad, 0x70, 0xed, 0x70, 0x03, 0xf0, 0xa5, 0x71, 0x49, 0x0d,\n 0x65, 0x14, 0x4c, 0xde, 0xac, 0x7e, 0x00, 0x22, 0x90, 0xa3, 0xfa, 0xf3,\n 0x02, 0x40, 0x26, 0x5b, 0x76, 0xe8, 0x42, 0x76, 0x15, 0x8e, 0xc1, 0xb8,\n 0xe5, 0x08, 0x70, 0x80, 0x02, 0x40, 0x25, 0x5b, 0x08, 0x46, 0x02, 0x40,\n 0x26, 0x5b, 0x25, 0x5b, 0xd5, 0x0e, 0x25, 0x90, 0xa1, 0x41, 0x9a, 0x21,\n 0x01, 0x03, 0x02, 0x40, 0x00, 0x22, 0x4e, 0x20, 0x26, 0x5b, 0x25, 0x5b,\n 0xed, 0x71, 0x22, 0x1e, 0x02, 0x10, 0xde, 0xf1, 0xf5, 0x70, 0xad, 0x70,\n 0xed, 0x70, 0xdb, 0xf5, 0x0c, 0x71, 0xd0, 0xc6, 0xe2, 0xc2, 0x08, 0x45,\n 0x01, 0x88, 0xc1, 0xb8, 0x17, 0x08, 0xb0, 0x00, 0x80, 0x8d, 0x14, 0x71,\n 0x0c, 0x70, 0x09, 0xf7, 0x81, 0x40, 0x60, 0x41, 0x80, 0x42, 0x27, 0x5b,\n 0x03, 0xf0, 0x81, 0x40, 0x23, 0x5b, 0x00, 0xa5, 0xc2, 0xc6, 0x00, 0x00,\n 0x49, 0x4e, 0x49, 0x03, 0xfc, 0x99, 0x60, 0x00, 0x94, 0x90, 0x7f, 0x00,\n 0x05, 0x00, 0x00, 0x00, 0x01, 0x80, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00,\n 0x98, 0x90, 0x7f, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x48, 0x21, 0x80,\n 0x00, 0x88, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x90, 0x7f, 0x00,\n 0x05, 0x00, 0x00, 0x00, 0x01, 0x90, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00,\n 0xa4, 0x90, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x98, 0x22, 0x80,\n 0x00, 0x00, 0x00, 0x00, 0xa8, 0x90, 0x7f, 0x00, 0x19, 0x00, 0x00, 0x00,\n 0x01, 0x40, 0x21, 0x80, 0x00, 0x78, 0x22, 0x80, 0x00, 0xb0, 0x22, 0x80,\n 0x00, 0xb0, 0x22, 0x80, 0x00, 0xc0, 0x22, 0x80, 0x00, 0xc8, 0x22, 0x80,\n 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00,\n 0x01, 0x70, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x90, 0x7f, 0x00,\n 0x05, 0x00, 0x00, 0x00, 0x01, 0xa0, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00,\n 0xc8, 0x90, 0x7f, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0xa8, 0x22, 0x80,\n 0x00, 0x00, 0x00, 0x00, 0x50, 0x20, 0x80, 0x00, 0xd4, 0x00, 0x00, 0x00,\n 0x00, 0xfe, 0xff, 0x00, 0x0f, 0x01, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10,\n 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10,\n 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0b, 0x10, 0x10, 0xc4,\n 0x04, 0x00, 0x00, 0x01, 0x02, 0x10, 0x0c, 0xd5, 0x60, 0x00, 0x06, 0x02,\n 0x08, 0xd0, 0xd4, 0x60, 0x02, 0x06, 0x0f, 0x03, 0xff, 0x3f, 0x0f, 0x10,\n 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10,\n 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10, 0x0f, 0x10,\n 0x05, 0x10, 0x80, 0xa5, 0x08, 0x00, 0x60, 0x00, 0x68, 0x02, 0x04, 0x58,\n 0x5e, 0x61, 0x00, 0xa4, 0x37, 0x61, 0x00, 0xdc, 0xa2, 0x60, 0x00, 0x20,\n 0x80, 0xc4, 0xa3, 0x60, 0x00, 0x40, 0x02, 0x04, 0xec, 0xaa, 0x60, 0x00,\n 0x90, 0xa0, 0x60, 0x00, 0xa0, 0x02, 0x20, 0x82, 0x85, 0xf4, 0x02, 0x0c,\n 0x30, 0x1c, 0x61, 0x00, 0x3c, 0x02, 0x0c, 0x03, 0x3a, 0x05, 0x02, 0x05,\n 0x34, 0xd1, 0x60, 0x00, 0x03, 0x08, 0x94, 0x4a, 0x08, 0xd3, 0x05, 0x08,\n 0x80, 0x06, 0x10, 0x9c, 0xd2, 0x05, 0x10, 0xac, 0x06, 0x10, 0x5c, 0x06,\n 0x08, 0xc4, 0xd0, 0x05, 0x18, 0x94, 0x10, 0xa7, 0xa1, 0x7f, 0x00, 0x0a,\n 0x02, 0x40, 0x2c, 0x67, 0x61, 0x02, 0x06, 0x05, 0x03, 0x13, 0x80, 0x80,\n 0x90, 0x05, 0x18, 0x70, 0x02, 0x08, 0x01, 0x00, 0x05, 0x16, 0x00, 0x00,\n 0xcc, 0x90, 0x7f, 0x00, 0x70, 0x92, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00\n};\n",
"bhy_support.c": "/*!\n * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * \n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n * \n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n *\n * @file bhy_support.c\n *\n * @date 12/19/2016\n *\n * @brief driver on MCU for bhy\n *\n *\n */\n\n\n/********************************************************************************/\n/* HEADER FILES */\n/********************************************************************************/\n#include \"bhy_support.h\"\n#include \"bhy_uc_driver_config.h\"\n\n#include <stdio.h>\n\n\n\n/********************************************************************************/\n/* STATIC VARIABLES */\n/********************************************************************************/\nstatic struct bhy_t bhy;\nstatic ATMO_DriverInstanceHandle_t _BHY_SUPPORT_I2CInstance;\n//static uint8_t *version = BHY_MCU_REFERENCE_VERSION;\n\n/********************************************************************************/\n/* EXTERN FUNCTION DECLARATIONS */\n/********************************************************************************/\nstatic int8_t sensor_i2c_write(uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size)\n{\n int32_t status;\n\n uint8_t write_data[size + 1];\n write_data[0] = reg;\n memcpy(&write_data[1], p_buf, size);\n\n return ATMO_I2C_MasterWrite(_BHY_SUPPORT_I2CInstance, addr, NULL, 0, write_data, size + 1, 0);\n}\n\nstatic int8_t sensor_i2c_read(uint8_t addr, uint8_t reg, uint8_t *p_buf, uint16_t size)\n{\n\treturn ATMO_I2C_MasterRead(_BHY_SUPPORT_I2CInstance, addr, ®, 1, p_buf, size, 0);\n}\n\n/********************************************************************************/\n/* FUNCTION DECLARATIONS */\n/********************************************************************************/\n/*!\n* @brief Initializes BHY smart sensor and its required connections\n*\n*/\nint8_t bhy_initialize_support(void)\n{\n uint8_t tmp_retry = RETRY_NUM;\n\n bhy.bus_write = &sensor_i2c_write;\n bhy.bus_read = &sensor_i2c_read;\n bhy.delay_msec = &bhy_delay_msec;\n bhy.device_addr = BHY_I2C_SLAVE_ADDRESS;\n\n bhy_init(&bhy);\n\n bhy_set_reset_request(BHY_RESET_ENABLE);\n\n while(tmp_retry--)\n {\n bhy_get_product_id(&bhy.product_id);\n\n if(PRODUCT_ID_7183 == bhy.product_id)\n {\n return BHY_SUCCESS;\n }\n\n bhy_delay_msec(BHY_PARAMETER_ACK_DELAY);\n }\n\n return BHY_PRODUCT_ID_ERROR;\n}\n/*!\n* @brief Initiates a delay of the length of the argument in milliseconds\n*\n* @param[in] msec Delay length in terms of milliseconds\n*\n*/\nvoid bhy_delay_msec(uint32_t msec)\n{\n ATMO_PLATFORM_DelayMilliseconds(msec);\n}\n/*!\n * @brief provides a print function to the bhy driver on DD2.0 platform\n */\nvoid bhy_printf(const char * string)\n{\n ATMO_PLATFORM_DebugPrint(\"%s\\r\\n\", string);\n}\n\nvoid bhy_set_driver_instance(ATMO_DriverInstanceHandle_t i2cInstance)\n{\n _BHY_SUPPORT_I2CInstance = i2cInstance;\n}\n\n/*!\n * @brief provides the mcu reference code version\n */\n//uint8_t * bhy_get_version(void)\n//{\n// return (version);\n//}\n/** @}*/\n",
"bhy_uc_driver.c": "/*!\n * Copyright (C) 2015 - 2016 Bosch Sensortec GmbH\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * \n * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * Neither the name of the copyright holder nor the names of the\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n * CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER\n * OR CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE\n * \n * The information provided is believed to be accurate and reliable.\n * The copyright holder assumes no responsibility\n * for the consequences of use\n * of such information nor for any infringement of patents or\n * other rights of third parties which may result from its use.\n * No license is granted by implication or otherwise under any patent or\n * patent rights of the copyright holder.\n *\n *\n * @file bhy_uc_driver.c\n *\n * @date 12/19/2016\n *\n * @brief driver on MCU for bhy\n *\n *\n */\n\n/********************************************************************************/\n/* HEADER FILES */\n/********************************************************************************/\n#include \"bhy_uc_driver.h\"\n\n/********************************************************************************/\n/* MACROS */\n/********************************************************************************/\n\n/* firmware download retry time */\n#define BHY_INIT_RETRY_COUNT 3\n/* these FIFO sizes are dependent on the type enumeration */\n/* do not change the order */\n#define BHY_DATA_SIZE_PADDING 1\n#define BHY_DATA_SIZE_QUATERNION 11\n#define BHY_DATA_SIZE_VECTOR 8\n#define BHY_DATA_SIZE_SCALAR_U8 2\n#define BHY_DATA_SIZE_SCALAR_U16 3\n#define BHY_DATA_SIZE_SCALAR_S16 3\n#define BHY_DATA_SIZE_SCALAR_U24 4\n#define BHY_DATA_SIZE_SENSOR_EVENT 1\n#define BHY_DATA_SIZE_UNCALIB_VECTOR 14\n#define BHY_DATA_SIZE_META_EVENT 4\n#define BHY_DATA_SIZE_BSX 17\n#define BHY_DATA_SIZE_DEBUG 14\n\n/* set default custom sensor packet size to 1, same as padding */\n#define BHY_DATA_SIZE_CUS1 1\n#define BHY_DATA_SIZE_CUS2 1\n#define BHY_DATA_SIZE_CUS3 1\n#define BHY_DATA_SIZE_CUS4 1\n#define BHY_DATA_SIZE_CUS5 1\n\n#define MAX_PAGE_NUM 15\n#define MAX_SENSOR_ID 0x20\n#define MAX_SENSOR_ID_NONWAKEUP 0x3F\n#define MAX_WRITE_BYTES 8\n#define SENSOR_CALLBACK_LIST_NUM 64\n#define TIMESTAMP_CALLBACK_LIST_NUM 2\n#define METAEVENT_CALLBACK_LIST_NUM 32\n#define SENSOR_PARAMETER_WRITE 0xC0\n#define MAX_METAEVENT_ID 17\n\n/********************************************************************************/\n/* GLOBAL VARIABLES */\n/********************************************************************************/\n\n/* these FIFO sizes are dependent on the enumeration above */\n/* do not change the order */\nuint8_t _fifoSizes[] = {\n BHY_DATA_SIZE_PADDING,\n BHY_DATA_SIZE_QUATERNION,\n BHY_DATA_SIZE_VECTOR,\n BHY_DATA_SIZE_SCALAR_U8,\n BHY_DATA_SIZE_SCALAR_U16,\n BHY_DATA_SIZE_SCALAR_S16,\n BHY_DATA_SIZE_SCALAR_U24,\n BHY_DATA_SIZE_SENSOR_EVENT,\n BHY_DATA_SIZE_UNCALIB_VECTOR,\n BHY_DATA_SIZE_META_EVENT,\n BHY_DATA_SIZE_BSX,\n BHY_DATA_SIZE_DEBUG,\n BHY_DATA_SIZE_CUS1,\n BHY_DATA_SIZE_CUS2,\n BHY_DATA_SIZE_CUS3,\n BHY_DATA_SIZE_CUS4,\n BHY_DATA_SIZE_CUS5,\n};\n\n#if BHY_CALLBACK_MODE\n/* The callback feature is a type of software interrupt. */\n/* The driver keeps in RAM an array of function pointers */\n/* for every sensor ID, wakeup and non-wakeup, every meta */\n/* event, and both wakeup and non-wakeup timestamps. When */\n/* parsing the fifo within the bhy_parse_next_fifo_packet */\n/* function, it will jump into the callback if the pointer */\n/* is non-null. */\n/* to sort through the array, it use either the sensor_id */\n/* or the event id. */\n\nstatic void (*sensor_callback_list[SENSOR_CALLBACK_LIST_NUM])(bhy_data_generic_t *, bhy_virtual_sensor_t) = {0};\nstatic void (*timestamp_callback_list[TIMESTAMP_CALLBACK_LIST_NUM])(bhy_data_scalar_u16_t *) = {0};\nstatic void (*meta_event_callback_list[METAEVENT_CALLBACK_LIST_NUM])(bhy_data_meta_event_t *, bhy_meta_event_type_t) = {0};\n#endif\n\n#if defined(BHY_DEBUG)\nextern void trace_log(const char *fmt, ...);\n#endif\n\n/********************************************************************************/\n/* FUNCTIONS */\n/********************************************************************************/\n\n/*!\n * @brief This function initializes the driver, the API and loads the ram patch into the sensor\n *\n * @param[in] bhy_fw_data pointer to the firmware of bhy\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_driver_init(const uint8_t *bhy_fw_data)\n{\n uint32_t tmp_fw_len = 0;\n int8_t init_retry_count = BHY_INIT_RETRY_COUNT;\n BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;\n\n /* get fw lenght */\n tmp_fw_len = 16 + bhy_fw_data[12] + (256 * bhy_fw_data[13]);\n\n /* retry BHY_INIT_RETRY_COUNT times to avoid firmware download fail*/\n while (init_retry_count > 0)\n {\n bhy_initialize_support();\n\n /* downloads the ram patch to the BHy */\n result += bhy_initialize_from_rom(bhy_fw_data, /*bhy_fw_len*/tmp_fw_len);\n\n if (result == BHY_SUCCESS)\n {\n break;\n }\n\n init_retry_count--;\n }\n\n return result;\n}\n\n/*!\n * @brief this function configures meta event\n *\n * @param[in] meta_event_id ID of meta event\n * @param[in] fifo_sel to choose the FIFO\n * @param[in] enable_state enable state of bhy\n * @param[in] int_enable_state enable state of interrupt\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_meta_event_set_config(bhy_meta_event_type_t meta_event_id,\n bhy_meta_event_fifo_type_t fifo_sel,\n uint8_t enable_state, uint8_t int_enable_state)\n{\n BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;\n\n result += bhy_set_meta_event(meta_event_id, enable_state, BHY_META_EVENT_ENABLE, fifo_sel);\n result += bhy_set_meta_event(meta_event_id, int_enable_state, BHY_META_INTR_ENABLE, fifo_sel);\n\n return result;\n}\n\n/*!\n * @brief this function gets configuration from specific meta event\n *\n * @param[in] meta_event_id ID of meta event\n * @param[in] fifo_sel to choose the FIFO\n * @param[in] p_enable_state pointer of enable state of bhy\n * @param[in] p_int_enable_state pointer of the enable state of interrupt\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_meta_event_get_config(bhy_meta_event_type_t meta_event_id,\n bhy_meta_event_fifo_type_t fifo_sel,\n uint8_t *p_enable_state, uint8_t *p_int_enable_state)\n{\n BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;\n\n result += bhy_get_meta_event(meta_event_id, BHY_META_EVENT_ENABLE, p_int_enable_state, p_enable_state, fifo_sel);\n result += bhy_get_meta_event(meta_event_id, BHY_META_INTR_ENABLE, p_int_enable_state, p_enable_state, fifo_sel);\n\n return result;\n}\n\n/*!\n * @brief this functions enables the selected virtual sensor\n *\n * @param[in] sensor_id sensor ID\n * @param[in] wakeup_status status after wakeup\n * @param[in] sample_rate sample rate\n * @param[in] max_report_latency_ms max report latency,unit is millisecond\n * @param[in] flush_sensor how to flush the fifo of sensor\n * @param[in] change_sensitivity whether to change the sensitivity\n * @param[in] dynamic_range dynamic range\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_enable_virtual_sensor(bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status,\n uint16_t sample_rate, uint16_t max_report_latency_ms,\n uint8_t flush_sensor, uint16_t change_sensitivity,\n uint16_t dynamic_range)\n{\n BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;\n union\n {\n struct sensor_configuration_wakeup_t sensor_configuration_wakeup;\n struct sensor_configuration_non_wakeup_t sensor_configuration_non_wakeup;\n } sensor_configuration;\n\n /* checks if sensor id is in range */\n if ((uint8_t)sensor_id >= MAX_SENSOR_ID)\n {\n return BHY_OUT_OF_RANGE;\n }\n\n /*computes the sensor id */\n sensor_id += wakeup_status;\n\n /* flush the fifo if requested */\n switch (flush_sensor)\n {\n case VS_FLUSH_SINGLE:\n result += bhy_set_fifo_flush(sensor_id);\n break;\n case VS_FLUSH_ALL:\n result += bhy_set_fifo_flush(VS_FLUSH_ALL);\n break;\n case VS_FLUSH_NONE:\n break;\n default:\n return BHY_OUT_OF_RANGE;\n }\n\n /* computes the param page as sensor_id + 0xC0 (sensor parameter write)*/\n sensor_id += SENSOR_PARAMETER_WRITE;\n\n /*calls the right function */\n switch (wakeup_status)\n {\n case VS_NON_WAKEUP:\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_sample_rate = sample_rate;\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_max_report_latency = max_report_latency_ms;\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_change_sensitivity = change_sensitivity;\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_dynamic_range = dynamic_range;\n result += bhy_set_non_wakeup_sensor_configuration( &sensor_configuration.sensor_configuration_non_wakeup, sensor_id);\n return result;\n case VS_WAKEUP:\n sensor_configuration.sensor_configuration_wakeup.wakeup_sample_rate = sample_rate;\n sensor_configuration.sensor_configuration_wakeup.wakeup_max_report_latency = max_report_latency_ms;\n sensor_configuration.sensor_configuration_wakeup.wakeup_change_sensitivity = change_sensitivity;\n sensor_configuration.sensor_configuration_wakeup.wakeup_dynamic_range = dynamic_range;\n result += bhy_set_wakeup_sensor_configuration(&sensor_configuration.sensor_configuration_wakeup, sensor_id);\n return result;\n default:\n return BHY_OUT_OF_RANGE;\n }\n}\n\n/*!\n * @brief this functions disables the selected virtual sensor\n *\n * @param[in] sensor_id sensor ID\n * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_disable_virtual_sensor(bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status)\n{\n union\n {\n struct sensor_configuration_wakeup_t sensor_configuration_wakeup;\n struct sensor_configuration_non_wakeup_t sensor_configuration_non_wakeup;\n } sensor_configuration;\n\n /* checks if sensor id is in range */\n if (sensor_id >= MAX_SENSOR_ID)\n {\n return BHY_OUT_OF_RANGE;\n }\n\n /* computes the param page as */\n /* wakeup_status + sensor_id + 0xC0 (sensor parameter write) */\n sensor_id += wakeup_status + SENSOR_PARAMETER_WRITE;\n\n /*calls the right function */\n switch (wakeup_status)\n {\n case VS_NON_WAKEUP:\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_sample_rate = 0;\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_max_report_latency = 0;\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_change_sensitivity = 0;\n sensor_configuration.sensor_configuration_non_wakeup.non_wakeup_dynamic_range = 0;\n return bhy_set_non_wakeup_sensor_configuration(&sensor_configuration.sensor_configuration_non_wakeup, sensor_id);\n\n case VS_WAKEUP:\n sensor_configuration.sensor_configuration_wakeup.wakeup_sample_rate = 0;\n sensor_configuration.sensor_configuration_wakeup.wakeup_max_report_latency = 0;\n sensor_configuration.sensor_configuration_wakeup.wakeup_change_sensitivity = 0;\n sensor_configuration.sensor_configuration_wakeup.wakeup_dynamic_range = 0;\n return bhy_set_wakeup_sensor_configuration(&sensor_configuration.sensor_configuration_wakeup, sensor_id);\n\n default:\n return BHY_OUT_OF_RANGE;\n }\n}\n\n/*!\n * @brief this functions retrieves the fifo data,it needs a buffer of at least (BHY_I2C_REG_BUFFER_LENGTH + 1) bytes to work.\n * it outputs the data into the variable buffer. the number of bytes read.\n *\n * @param[in] buffer pointer of buffer\n * @param[in] buffer_size size of the buffer in bytes\n * @param[out] bytes_read the bytes in fifo which have been read\n * @param[out] bytes_left the bytes left in fifo which have not been read\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_read_fifo(uint8_t *buffer, uint16_t buffer_size, uint16_t *bytes_read, uint16_t *bytes_left)\n{\n BHY_RETURN_FUNCTION_TYPE result = BHY_SUCCESS;\n static uint16_t current_index = 0;\n static uint16_t current_transaction_size = 0;\n\n if (buffer_size <= BHY_I2C_REG_BUFFER_LENGTH)\n {\n return BHY_OUT_OF_RANGE;\n }\n\n /* gets the number of bytes left in the fifo either from memory of from */\n /* the register */\n if (current_transaction_size == 0)\n {\n result = bhy_read_bytes_remaining(¤t_transaction_size);\n }\n\n /* if there are bytes in the fifo to read */\n if (current_transaction_size)\n {\n /* calculates the number of bytes to read. either the number of */\n /* bytes left, or the buffer size, or just enough so the last page */\n /* does not get turned */\n if (buffer_size >= current_transaction_size - current_index)\n {\n *bytes_read = current_transaction_size - current_index;\n }\n else if (current_transaction_size - (current_index+buffer_size) <= BHY_I2C_REG_BUFFER_LENGTH)\n {\n *bytes_read = (current_transaction_size - (BHY_I2C_REG_BUFFER_LENGTH + 1)) - current_index;\n }\n else\n {\n *bytes_read = buffer_size;\n }\n\n result += bhy_read_reg(current_index % BHY_I2C_REG_BUFFER_LENGTH, buffer, *bytes_read);\n\n current_index += *bytes_read;\n\n (*bytes_left) = current_transaction_size - current_index;\n\n if ((*bytes_left) == 0)\n {\n current_index = 0;\n current_transaction_size = 0;\n }\n\n }\n else\n {\n (*bytes_read) = 0;\n (*bytes_left) = 0;\n return result;\n }\n\n return result;\n}\n\n/*!\n * @brief this functions parse the packet in fifo and get the actual fifo data of sensors\n *\n *\n * @param[in] fifo_buffer pointer of fifo\n * @param[in] fifo_buffer_length size of the fifo\n * @param[out] fifo_data_output the actual fifo data of sensors\n * @param[out] fifo_data_type data type of fifo data\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_parse_next_fifo_packet (uint8_t **fifo_buffer, uint16_t *fifo_buffer_length,\n bhy_data_generic_t * fifo_data_output,\n bhy_data_type_t * fifo_data_type)\n{\n uint16_t i = 0;\n\n if ((*fifo_buffer_length) == 0)\n {\n /* there are no more bytes in the fifo buffer to read */\n return BHY_SUCCESS;\n }\n\n /* the first fifo byte should be a known virtual sensor ID */\n switch (**fifo_buffer)\n {\n case VS_ID_PADDING:\n (*fifo_data_type) = BHY_DATA_TYPE_PADDING;\n fifo_data_output->data_padding.sensor_id = (**fifo_buffer);\n break;\n\n case VS_ID_ROTATION_VECTOR:\n case VS_ID_ROTATION_VECTOR_WAKEUP:\n case VS_ID_GAME_ROTATION_VECTOR:\n case VS_ID_GAME_ROTATION_VECTOR_WAKEUP:\n case VS_ID_GEOMAGNETIC_ROTATION_VECTOR:\n case VS_ID_GEOMAGNETIC_ROTATION_VECTOR_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_QUATERNION])\n return BHY_OUT_OF_RANGE;\n (*fifo_data_type) = BHY_DATA_TYPE_QUATERNION;\n fifo_data_output->data_quaternion.sensor_id = (**fifo_buffer);\n fifo_data_output->data_quaternion.x =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));\n fifo_data_output->data_quaternion.y =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 3)) | ((uint16_t)*((*fifo_buffer) + 4) << 8));\n fifo_data_output->data_quaternion.z =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 5)) | ((uint16_t)*((*fifo_buffer) + 6) << 8));\n fifo_data_output->data_quaternion.w =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 7)) | ((uint16_t)*((*fifo_buffer) + 8) << 8));\n fifo_data_output->data_quaternion.estimated_accuracy =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 9)) | ((uint16_t)*((*fifo_buffer) + 10) << 8));\n break;\n\n case VS_ID_ACCELEROMETER:\n case VS_ID_ACCELEROMETER_WAKEUP:\n case VS_ID_MAGNETOMETER:\n case VS_ID_MAGNETOMETER_WAKEUP:\n case VS_ID_ORIENTATION:\n case VS_ID_ORIENTATION_WAKEUP:\n case VS_ID_GYROSCOPE:\n case VS_ID_GYROSCOPE_WAKEUP:\n case VS_ID_GRAVITY:\n case VS_ID_GRAVITY_WAKEUP:\n case VS_ID_LINEAR_ACCELERATION:\n case VS_ID_LINEAR_ACCELERATION_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_VECTOR])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_VECTOR;\n fifo_data_output->data_vector.sensor_id = (**fifo_buffer);\n fifo_data_output->data_vector.x =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));\n fifo_data_output->data_vector.y =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 3)) | ((uint16_t)*((*fifo_buffer) + 4) << 8));\n fifo_data_output->data_vector.z =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 5)) | ((uint16_t)*((*fifo_buffer) + 6) << 8));\n fifo_data_output->data_vector.status = *((*fifo_buffer) + 7);\n break;\n\n case VS_ID_HEART_RATE:\n case VS_ID_HEART_RATE_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_U8])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_U8;\n fifo_data_output->data_scalar_u8.sensor_id = (**fifo_buffer);\n fifo_data_output->data_scalar_u8.data = *((*fifo_buffer) + 1);\n break;\n\n case VS_ID_LIGHT:\n case VS_ID_LIGHT_WAKEUP:\n case VS_ID_PROXIMITY:\n case VS_ID_PROXIMITY_WAKEUP:\n case VS_ID_HUMIDITY:\n case VS_ID_HUMIDITY_WAKEUP:\n case VS_ID_STEP_COUNTER:\n case VS_ID_STEP_COUNTER_WAKEUP:\n case VS_ID_ACTIVITY:\n case VS_ID_ACTIVITY_WAKEUP:\n case VS_ID_TIMESTAMP_LSW:\n case VS_ID_TIMESTAMP_LSW_WAKEUP:\n case VS_ID_TIMESTAMP_MSW:\n case VS_ID_TIMESTAMP_MSW_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_U16])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_U16;\n fifo_data_output->data_scalar_u16.sensor_id = (**fifo_buffer);\n fifo_data_output->data_scalar_u16.data =\n (uint16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));\n break;\n\n case VS_ID_TEMPERATURE:\n case VS_ID_TEMPERATURE_WAKEUP:\n case VS_ID_AMBIENT_TEMPERATURE:\n case VS_ID_AMBIENT_TEMPERATURE_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_S16])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_S16;\n fifo_data_output->data_scalar_s16.sensor_id = (**fifo_buffer);\n fifo_data_output->data_scalar_s16.data =\n (int16_t)(((uint16_t)*(*fifo_buffer + 1)) | ((uint16_t)*(*fifo_buffer + 2) << 8));\n break;\n\n case VS_ID_BAROMETER:\n case VS_ID_BAROMETER_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_SCALAR_U24])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_SCALAR_U24;\n fifo_data_output->data_scalar_u24.sensor_id = (**fifo_buffer);\n fifo_data_output->data_scalar_u24.data =\n (uint32_t)(((uint32_t)*((*fifo_buffer) + 1)) | ((uint32_t)*((*fifo_buffer) + 2) << 8) |\n ((uint32_t)*((*fifo_buffer) + 3) << 16));\n break;\n\n case VS_ID_SIGNIFICANT_MOTION:\n case VS_ID_SIGNIFICANT_MOTION_WAKEUP:\n case VS_ID_STEP_DETECTOR:\n case VS_ID_STEP_DETECTOR_WAKEUP:\n case VS_ID_TILT_DETECTOR:\n case VS_ID_TILT_DETECTOR_WAKEUP:\n case VS_ID_WAKE_GESTURE:\n case VS_ID_WAKE_GESTURE_WAKEUP:\n case VS_ID_GLANCE_GESTURE:\n case VS_ID_GLANCE_GESTURE_WAKEUP:\n case VS_ID_PICKUP_GESTURE:\n case VS_ID_PICKUP_GESTURE_WAKEUP:\n (*fifo_data_type) = BHY_DATA_TYPE_SENSOR_EVENT;\n fifo_data_output->data_sensor_event.sensor_id = (**fifo_buffer);\n break;\n\n case VS_ID_UNCALIBRATED_MAGNETOMETER:\n case VS_ID_UNCALIBRATED_MAGNETOMETER_WAKEUP:\n case VS_ID_UNCALIBRATED_GYROSCOPE:\n case VS_ID_UNCALIBRATED_GYROSCOPE_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_UNCALIB_VECTOR])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_UNCALIB_VECTOR;\n fifo_data_output->data_uncalib_vector.sensor_id = (**fifo_buffer);\n fifo_data_output->data_uncalib_vector.x =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 1)) | ((uint16_t)*((*fifo_buffer) + 2) << 8));\n fifo_data_output->data_uncalib_vector.y =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 3)) | ((uint16_t)*((*fifo_buffer) + 4) << 8));\n fifo_data_output->data_uncalib_vector.z =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 5)) | ((uint16_t)*((*fifo_buffer) + 6) << 8));\n fifo_data_output->data_uncalib_vector.x_bias =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 7)) | ((uint16_t)*((*fifo_buffer) + 8) << 8));\n fifo_data_output->data_uncalib_vector.y_bias =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 9)) | ((uint16_t)*((*fifo_buffer) + 10) << 8));\n fifo_data_output->data_uncalib_vector.z_bias =\n (int16_t)(((uint16_t)*((*fifo_buffer) + 11)) | ((uint16_t)*((*fifo_buffer) + 12) << 8));\n fifo_data_output->data_uncalib_vector.status = *((*fifo_buffer)+13);\n break;\n\n case VS_ID_META_EVENT:\n case VS_ID_META_EVENT_WAKEUP:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_META_EVENT])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_META_EVENT;\n fifo_data_output->data_meta_event.meta_event_id = (**fifo_buffer);\n fifo_data_output->data_meta_event.event_number = (bhy_meta_event_type_t)(*((*fifo_buffer) + 1));\n fifo_data_output->data_meta_event.sensor_type = *((*fifo_buffer) + 2);\n fifo_data_output->data_meta_event.event_specific = *((*fifo_buffer) + 3);\n break;\n case VS_ID_DEBUG:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_DEBUG])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_DEBUG;\n fifo_data_output->data_debug.sensor_id = (**fifo_buffer);\n fifo_data_output->data_debug.data[0] = *((*fifo_buffer) + 1);\n fifo_data_output->data_debug.data[1] = *((*fifo_buffer) + 2);\n fifo_data_output->data_debug.data[2] = *((*fifo_buffer) + 3);\n fifo_data_output->data_debug.data[3] = *((*fifo_buffer) + 4);\n fifo_data_output->data_debug.data[4] = *((*fifo_buffer) + 5);\n fifo_data_output->data_debug.data[5] = *((*fifo_buffer) + 6);\n fifo_data_output->data_debug.data[6] = *((*fifo_buffer) + 7);\n fifo_data_output->data_debug.data[7] = *((*fifo_buffer) + 8);\n fifo_data_output->data_debug.data[8] = *((*fifo_buffer) + 9);\n fifo_data_output->data_debug.data[9] = *((*fifo_buffer) + 10);\n fifo_data_output->data_debug.data[10] = *((*fifo_buffer) + 11);\n fifo_data_output->data_debug.data[11] = *((*fifo_buffer) + 12);\n fifo_data_output->data_debug.data[12] = *((*fifo_buffer) + 13);\n break;\n case VS_ID_BSX_C:\n case VS_ID_BSX_B:\n case VS_ID_BSX_A:\n if ((*fifo_buffer_length) < _fifoSizes[BHY_DATA_TYPE_BSX])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n (*fifo_data_type) = BHY_DATA_TYPE_BSX;\n fifo_data_output->data_bsx.sensor_id = (**fifo_buffer);\n fifo_data_output->data_bsx.x =\n (uint32_t)(((uint32_t)*((*fifo_buffer) + 1)) | ((uint32_t)*((*fifo_buffer) + 2) << 8) |\n ((uint32_t)*((*fifo_buffer) + 3) << 16) | ((uint32_t)*((*fifo_buffer) + 4) << 24));\n fifo_data_output->data_bsx.y =\n (uint32_t)(((uint32_t)*((*fifo_buffer) + 5)) | ((uint32_t)*((*fifo_buffer) + 6) << 8) |\n ((uint32_t)*((*fifo_buffer) + 7) << 16) | ((uint32_t)*((*fifo_buffer) + 8) << 24));\n fifo_data_output->data_bsx.z =\n (uint32_t)(((uint32_t)*((*fifo_buffer) + 9)) | ((uint32_t)*((*fifo_buffer) + 10) << 8) |\n ((uint32_t)*((*fifo_buffer) + 11) << 16) | ((uint32_t)*((*fifo_buffer) + 12) << 24));\n fifo_data_output->data_bsx.timestamp =\n (uint32_t)(((uint32_t)*((*fifo_buffer) + 13)) | ((uint32_t)*((*fifo_buffer) + 14) << 8) |\n ((uint32_t)*((*fifo_buffer) + 15) << 16) | ((uint32_t)*((*fifo_buffer) + 16) << 24));\n break;\n\n case VS_ID_CUS1:\n case VS_ID_CUS2:\n case VS_ID_CUS3:\n case VS_ID_CUS4:\n case VS_ID_CUS5:\n (*fifo_data_type) = BHY_DATA_TYPE_CUS1+ **fifo_buffer - VS_ID_CUS1;\n\n if ((*fifo_buffer_length) < _fifoSizes[*fifo_data_type])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n fifo_data_output->data_pdr.sensor_id = (**fifo_buffer);\n\n for(i = 0; i < _fifoSizes[*fifo_data_type] - 1; i++)\n fifo_data_output->data_custom.data[i] = *((*fifo_buffer) + i);\n break;\n\n case VS_ID_CUS1_WAKEUP:\n case VS_ID_CUS2_WAKEUP:\n case VS_ID_CUS3_WAKEUP:\n case VS_ID_CUS4_WAKEUP:\n case VS_ID_CUS5_WAKEUP:\n (*fifo_data_type) = BHY_DATA_TYPE_CUS1+ **fifo_buffer - VS_ID_CUS1_WAKEUP;\n\n if ((*fifo_buffer_length) < _fifoSizes[*fifo_data_type])\n {\n return BHY_OUT_OF_RANGE;\n }\n\n fifo_data_output->data_pdr.sensor_id = (**fifo_buffer);\n\n for(i = 0; i < _fifoSizes[*fifo_data_type]-1; i++)\n fifo_data_output->data_custom.data[i] = *((*fifo_buffer) + i);\n break;\n\n /* the VS sensor ID is unknown. Either the sync has been lost or the */\n /* ram patch implements a new sensor ID that this driver doesn't yet */\n /* support */\n default:\n return BHY_OUT_OF_RANGE;\n }\n\n\n#if defined(BHY_DEBUG)\n {\n uint8_t *p_name = \"UnDefined\";\n const char *sensors[] = {\"PAdding\", \"Acc\", \"Mag\", \"Orient\", \"Gyro\", \"Light\", \"Bar\", \"Temp\"\n ,\"Prox\", \"Gravity\", \"Line Acc\", \"R Vector\", \"Humidity\", \"A temp\", \"un Mag\", \"GR Vector\"\n ,\"Un Gyro\",\"SigMotion\",\"StepDet\", \"StepCnt\", \"GeoR Vector\", \"HeartRate\", \"TiltDect\",\"WGesture\"\n ,\"Glance\", \"PickUp\", \"Cus1\", \"Cus2\", \"Cus3\", \"Cus4\", \"Cus5\", \"Activity\"\n };\n\n if((uint8_t)**fifo_buffer <= VS_ID_ACTIVITY)\n {\n p_name = sensors[(uint8_t)**fifo_buffer];\n }\n else if((uint8_t)**fifo_buffer <= VS_ID_ACTIVITY_WAKEUP)\n {\n p_name = sensors[(uint8_t)**fifo_buffer - 32];\n }\n else\n {\n switch(**fifo_buffer)\n {\n case VS_ID_DEBUG:\n p_name = \"DString\";\n break;\n case VS_ID_TIMESTAMP_LSW_WAKEUP:\n case VS_ID_TIMESTAMP_LSW:\n p_name = \"LSW\";\n break;\n case VS_ID_TIMESTAMP_MSW_WAKEUP:\n case VS_ID_TIMESTAMP_MSW:\n p_name = \"MSW\";\n break;\n case VS_ID_META_EVENT_WAKEUP:\n case VS_ID_META_EVENT:\n p_name = \"Meta Evt\";\n break;\n case VS_ID_BSX_A:\n p_name = \"BSX A\";\n break;\n case VS_ID_BSX_B:\n p_name = \"BSX B\";\n break;\n case VS_ID_BSX_C:\n p_name = \"BSX C\";\n break;\n default:\n p_name = \"UnKnown\";\n break;\n }\n }\n\n trace_log(\"[Sample](%12s):(%02d)\", p_name, _fifoSizes[*fifo_data_type]);\n for(i = 0; i < _fifoSizes[*fifo_data_type]; i++)\n trace_log(\" %02x\", *((*fifo_buffer) + i));\n trace_log(\"\\n\");\n }\n#endif\n\n\n#if BHY_CALLBACK_MODE\n if((**fifo_buffer) < 0x40)\n {\n if (sensor_callback_list[(**fifo_buffer)] != 0)\n {\n sensor_callback_list[(**fifo_buffer)](fifo_data_output, (bhy_virtual_sensor_t)(**fifo_buffer));\n }\n }\n else if ((**fifo_buffer) == VS_ID_TIMESTAMP_LSW ||(**fifo_buffer) == VS_ID_TIMESTAMP_MSW)\n {\n if (timestamp_callback_list[0] != 0)\n {\n timestamp_callback_list[0](&fifo_data_output->data_scalar_u16);\n }\n }\n else if ((**fifo_buffer) == VS_ID_TIMESTAMP_LSW_WAKEUP ||(**fifo_buffer) == VS_ID_TIMESTAMP_MSW_WAKEUP)\n {\n if (timestamp_callback_list[1] != 0)\n {\n timestamp_callback_list[1](&fifo_data_output->data_scalar_u16);\n }\n }\n else if ((**fifo_buffer) == VS_ID_META_EVENT ||(**fifo_buffer) == VS_ID_META_EVENT_WAKEUP)\n {\n if (meta_event_callback_list[fifo_data_output->data_meta_event.event_number] != 0)\n {\n meta_event_callback_list[fifo_data_output->data_meta_event.event_number](&fifo_data_output->data_meta_event,\n fifo_data_output->data_meta_event.event_number);\n }\n }\n#endif\n\n\n (*fifo_buffer) += _fifoSizes[*fifo_data_type];\n (*fifo_buffer_length) -= _fifoSizes[*fifo_data_type];\n\n return BHY_SUCCESS;\n};\n\n/*!\n * @brief This function will detect the timestamp packet accordingly and update\n * either the MSW or the LSW of the system timestamp\n *\n * system_timestamp is only valid after LSW comes.\n *\n * @param[in] timestamp_packet timestamp of packets\n * @param[in/out] system_timestamp timestamp of system\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_update_system_timestamp(bhy_data_scalar_u16_t *timestamp_packet,\n uint32_t *system_timestamp)\n{\n static uint32_t timestamp_wakeup = 0;\n static uint32_t timestamp_nonwakeup = 0;\n \n switch (timestamp_packet->sensor_id)\n {\n case VS_ID_TIMESTAMP_LSW:\n timestamp_nonwakeup = (timestamp_nonwakeup & 0xFFFF0000) | (uint32_t)timestamp_packet->data;\n *system_timestamp = timestamp_nonwakeup;\n break;\n case VS_ID_TIMESTAMP_LSW_WAKEUP:\n timestamp_wakeup = (timestamp_wakeup & 0xFFFF0000) | (uint32_t)timestamp_packet->data;\n *system_timestamp = timestamp_wakeup;\n break;;\n\n case VS_ID_TIMESTAMP_MSW:\n timestamp_nonwakeup = (timestamp_nonwakeup & 0x0000FFFF) | ((uint32_t)timestamp_packet->data << 16);\n break;\n case VS_ID_TIMESTAMP_MSW_WAKEUP:\n timestamp_wakeup = (timestamp_wakeup & 0x0000FFFF) | ((uint32_t)timestamp_packet->data << 16);\n break;\n default:\n return BHY_OUT_OF_RANGE;\n }\n\n return BHY_SUCCESS;\n}\n\n/*!\n * @brief This function writes arbitrary data to an arbitrary parameter page\n *\n * @param[in] page select the page of parameter\n * @param[in] parameter select the parameter\n * @param[in] data data to be written to parameter\n * @param[in] length length of data\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_write_parameter_page(uint8_t page, uint8_t parameter, uint8_t *data, uint8_t length)\n{\n /* variable used for return the status of communication result */\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n\n uint8_t v_parameter_ack = BHY_INIT_VALUE;\n uint8_t v_parameter_ack_check = BHY_INIT_VALUE;\n\n /* write values to the load address*/\n if (length > MAX_WRITE_BYTES)\n {\n length = MAX_WRITE_BYTES;\n }\n else if (length == 0)\n {\n return BHY_SUCCESS;\n }\n\n com_rslt = bhy_write_reg(BHY_I2C_REG_PARAMETER_WRITE_BUFFER_ZERO, data, length);\n\n /* select the page*/\n if (page > MAX_PAGE_NUM)\n {\n page = MAX_PAGE_NUM;\n }\n else if (page == 0)\n {\n return BHY_SUCCESS;\n }\n\n page = ((length & 0x07) << 4) | page;\n com_rslt += bhy_write_reg(BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG, &page, 1);\n\n /* select the parameter*/\n parameter |= 0x80;\n com_rslt += bhy_set_parameter_request(parameter);\n for (v_parameter_ack_check = BHY_INIT_VALUE;\n v_parameter_ack_check < BHY_PARAMETER_ACK_LENGTH;\n v_parameter_ack_check++)\n {\n /* read the acknowledgment*/\n com_rslt += bhy_get_parameter_acknowledge(&v_parameter_ack);\n if (v_parameter_ack == parameter)\n {\n com_rslt += BHY_SUCCESS;\n break;\n }\n else if (v_parameter_ack == BHY_PARAMETER_ACK_CHECK)\n {\n bhy_delay_msec(BHY_PARAMETER_ACK_DELAY);\n com_rslt += BHY_ERROR;\n }\n else\n {\n /* device not ready yet */\n bhy_delay_msec(1);\n }\n }\n return com_rslt;\n}\n\n/*!\n * @brief This function reads arbitrary data from an arbitrary parameter page\n *\n * @param[in] page select the page of parameter\n * @param[in] parameter select the parameter\n * @param[out] data data to be read from parameter\n * @param[in] length length of data\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_read_parameter_page(uint8_t page, uint8_t parameter, uint8_t *data, uint8_t length)\n{\n /* variable used for return the status of communication result*/\n BHY_RETURN_FUNCTION_TYPE com_rslt = BHY_COMM_RES;\n\n uint8_t v_parameter_ack = BHY_INIT_VALUE;\n uint8_t v_parameter_ack_check = BHY_INIT_VALUE;\n\n if (length > 16)\n {\n length = 16;\n }\n else if (length == 0)\n {\n return BHY_SUCCESS;\n }\n\n /* select the page*/\n if (page > 15)\n {\n page = 15;\n }\n else if (page == 0)\n {\n return BHY_SUCCESS;\n }\n\n page = ((length & 0x0F) << 4) | page;\n com_rslt = bhy_write_reg(BHY_I2C_REG_PARAMETER_PAGE_SELECT__REG, &page, 1);\n\n /* select the parameter*/\n parameter &= 0x7F;\n com_rslt += bhy_set_parameter_request(parameter);\n for (v_parameter_ack_check = BHY_INIT_VALUE;\n v_parameter_ack_check < BHY_PARAMETER_ACK_LENGTH;\n v_parameter_ack_check++)\n {\n /* read the acknowledgment*/\n com_rslt += bhy_get_parameter_acknowledge(&v_parameter_ack);\n if (v_parameter_ack == parameter)\n {\n com_rslt += BHY_SUCCESS;\n break;\n }\n else if(v_parameter_ack == BHY_PARAMETER_ACK_CHECK)\n {\n bhy_delay_msec(BHY_PARAMETER_ACK_DELAY);\n com_rslt += BHY_ERROR;\n }\n else\n {\n /* device not ready yet */\n bhy_delay_msec(1);\n }\n }\n /* read values to the load address*/\n com_rslt += bhy_read_reg(BHY_I2C_REG_PARAMETER_READ_BUFFER_ZERO, data, length);\n\n return com_rslt;\n}\n\n/*!\n * @brief This function set mapping matrix to a corresponding physical sensor.\n *\n * @param[in] index physical sensor index\n * @param[in] mapping_matrix pointer to a int8_t mapping_matrix[9]\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_set(bhy_physical_sensor_index_type_t index ,int8_t *mapping_matrix)\n{\n uint8_t data[8] = { 0, };\n int32_t i;\n int32_t handle;\n BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;\n\n switch (index)\n {\n case PHYSICAL_SENSOR_INDEX_ACC:\n handle = VS_ID_ACCELEROMETER;\n break;\n case PHYSICAL_SENSOR_INDEX_MAG:\n handle = VS_ID_UNCALIBRATED_MAGNETOMETER;\n break;\n case PHYSICAL_SENSOR_INDEX_GYRO:\n handle = VS_ID_UNCALIBRATED_GYROSCOPE;\n break;\n default:\n return BHY_ERROR;\n }\n\n for (i = 0; i < 5; ++i)\n {\n switch (mapping_matrix[2 * i])\n {\n case 0:\n data[i] = 0;\n break;\n case 1:\n data[i] = 1;\n break;\n case -1:\n data[i] = 0xF;\n break;\n default:\n return BHY_ERROR;\n }\n\n if (i == 4)\n {\n break;\n }\n\n switch (mapping_matrix[2 * i + 1])\n {\n case 0:\n break;\n case 1:\n data[i] |= 0x10;\n break;\n case -1:\n data[i] |= 0xF0;\n break;\n default:\n return BHY_ERROR;\n }\n }\n\n /* mutex_lock(&client_data->mutex_bus_op); */\n ret = bhy_write_parameter_page(BHY_PAGE_SYSTEM, BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_0 + handle, data, sizeof(data));\n\n /* mutex_unlock(&client_data->mutex_bus_op); */\n if (ret < 0)\n {\n return ret;\n }\n\n return 0;\n}\n\n/*!\n * @brief This function get mapping matrix from a corresponding physical sensor.\n *\n * @param[in] index physical sensor index\n * @param[in] mapping_matrix pointer to a int8_t mapping_matrix[9]\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_mapping_matrix_get(bhy_physical_sensor_index_type_t index , int8_t* mapping_matrix)\n{\n int32_t i, j;\n BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;\n uint8_t data[16];\n uint8_t map[32];\n uint8_t handle[3] =\n {\n VS_ID_ACCELEROMETER,\n VS_ID_UNCALIBRATED_MAGNETOMETER,\n VS_ID_UNCALIBRATED_GYROSCOPE,\n };\n uint8_t param;\n\n /* Check sensor existance */\n ret = bhy_read_parameter_page(BHY_PAGE_SYSTEM, BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_PRESENT,\n data, sizeof(data));\n if (ret < 0)\n {\n return ret;\n }\n\n for (i = 0; i < 4; ++i)\n {\n for (j = 0; j < 8; ++j)\n {\n if (data[i] & (1 << j))\n {\n map[i * 8 + j] = 1;\n }\n else\n {\n map[i * 8 + j] = 0;\n }\n }\n }\n\n if (!map[handle[index]])\n {\n return BHY_ERROR;\n }\n\n param = BHY_PARAM_SYSTEM_PHYSICAL_SENSOR_DETAIL_0 + handle[index];\n ret = bhy_read_parameter_page(BHY_PAGE_SYSTEM,param, data, sizeof(data));\n if (ret < 0)\n {\n return ret;\n }\n\n mapping_matrix[0] = ((data[11] & 0x0F) == 0x0F) ? (-1) : (data[11] & 0x0F);\n mapping_matrix[1] = (((data[11] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[11] >> 4) & 0x0F);\n mapping_matrix[2] = (data[12] & 0x0F) == 0x0F ? (-1) : (data[12] & 0x0F);\n mapping_matrix[3] = (((data[12] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[12] >> 4) & 0x0F);\n mapping_matrix[4] = (data[13] & 0x0F) == 0x0F ? (-1) : (data[13] & 0x0F);\n mapping_matrix[5] = (((data[13] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[13] >> 4) & 0x0F);\n mapping_matrix[6] = (data[14] & 0x0F) == 0x0F ? (-1) : (data[14] & 0x0F);\n mapping_matrix[7] = (((data[14] >> 4) & 0x0F) == 0x0F) ? (-1) : ((data[14] >> 4) & 0x0F);\n mapping_matrix[8] = (data[15] & 0x0F) == 0x0F ? (-1) : (data[15] & 0x0F);\n\n return ret;\n}\n\n/*!\n * @brief Soft pass-through parameter write function.\n *\n * @param[in] addr physical sensor index\n * @param[in] reg register address to be written\n * @param[in] data pointer to data to be written\n * @param[in] length\n * @param[in] increment_reg if true, the function will automatically increment the register between successive 4-bytes transfers\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_write(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg)\n{\n /* follows data structures in page table 26 and 27 of datasheet */\n uint8_t temp_data[8];\n BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;\n\n while (length)\n {\n temp_data[0] = addr;\n temp_data[1] = reg;\n temp_data[2] = (length > 4) ? 4 : length;\n length -= temp_data[2];\n if (increment_reg)\n {\n reg += temp_data[2];\n }\n temp_data[3] = 0x00;\n temp_data[4] = *(data++);\n temp_data[5] = (temp_data[2] >= 2) ? *(data++) : 0x00;\n temp_data[6] = (temp_data[2] >= 3) ? *(data++) : 0x00;\n temp_data[7] = (temp_data[2] >= 4) ? *(data++) : 0x00;\n\n ret = bhy_write_parameter_page(15, 2, temp_data, 8);\n\n /* wait until transaction is over */\n do\n {\n ret = bhy_read_parameter_page(15, 2, temp_data, 8);\n } while (temp_data[3] == 0x00);\n }\n return ret;\n}\n\n/*!\n * @brief Soft pass-through parameter read function.\n *\n * @param[in] addr physical sensor index\n * @param[in] reg register address to be written\n * @param[out] data pointer to data to be written\n * @param[in] length\n * @param[in] increment_reg if true, the function will automatically increment the register between successive 4-bytes transfers\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_soft_passthru_read(uint8_t addr, uint8_t reg, uint8_t *data, uint8_t length, uint8_t increment_reg)\n{\n /* follows data structures in page table 26 and 27 of datasheet */\n uint8_t temp_data[8];\n BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;\n\n while (length)\n {\n temp_data[0] = addr;\n temp_data[1] = reg;\n temp_data[2] = (length > 4) ? 4 : length;\n length -= temp_data[2];\n if (increment_reg)\n {\n reg += temp_data[2];\n }\n temp_data[3] = 0x00;\n temp_data[4] = 0x00;\n temp_data[5] = 0x00;\n temp_data[6] = 0x00;\n temp_data[7] = 0x00;\n\n ret = bhy_write_parameter_page(15, 1, temp_data, 8);\n\n /* wait until transaction is over */\n do\n {\n ret = bhy_read_parameter_page(15, 1, temp_data, 8);\n } while (temp_data[3] == 0x00);\n\n if (temp_data[3] == 0x01)\n {\n *(data++) = temp_data[4];\n if (temp_data[2] >= 2)\n {\n *(data++) = temp_data[5];\n }\n\n if (temp_data[2] >= 3)\n {\n *(data++) = temp_data[6];\n }\n\n if (temp_data[2] >= 4)\n {\n *(data++) = temp_data[7];\n }\n }\n }\n\n return ret;\n}\n\n/*!\n * @brief Write data to specific GP register.\n *\n * @param[in] gp_reg GP register address\n * @param[in] data data to be written to GP register\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_gp_register_write(bhy_gp_register_type_t gp_reg, uint8_t data)\n{\n BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;\n\n if((gp_reg >= BHY_GP_REG_20) && (gp_reg <= BHY_GP_REG_24))\n {\n /* GP register 20~24 are read only */\n ret = BHY_ERROR;\n }\n else\n {\n ret += bhy_write_reg(gp_reg, &data, 1);\n }\n\n return ret;\n}\n\n/*!\n * @brief Write data to specific GP register.\n *\n * @param[in] gp_reg GP register address\n * @param[in] data pointer to receive buffer\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_gp_register_read(bhy_gp_register_type_t gp_reg, uint8_t *data)\n{\n BHY_RETURN_FUNCTION_TYPE ret = BHY_SUCCESS;\n\n ret += bhy_read_reg(gp_reg, data, 1);\n\n return ret;\n}\n\n/*!\n * @brief This function reads out the current SIC matrix from BHy\n *\n * @param[in] sic_matrix pointer to SIC matrix\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_get_sic_matrix(float * sic_matrix)\n{\n BHY_RETURN_FUNCTION_TYPE return_val;\n\n return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_0_1, (uint8_t *)(&sic_matrix[0]), 8);\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_2_3, (uint8_t *)(&sic_matrix[2]), 8);\n }\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_4_5, (uint8_t *)(&sic_matrix[4]), 8);\n }\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_6_7, (uint8_t *)(&sic_matrix[6]), 8);\n }\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_read_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_8, (uint8_t *)(&sic_matrix[8]), 4);\n }\n\n return return_val;\n}\n\n/*!\n * @brief This function get all the custom sensor data length according reading information from hub.\n *\n * @param[in] none\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_sync_cus_evt_size(void)\n{\n struct sensor_information_wakeup_t sensor_info_wakeup;\n uint8_t i = 0;\n\n for(i = 0; i < 5; i++)\n {\n bhy_get_wakeup_sensor_information(VS_ID_CUS1 + i, &sensor_info_wakeup);\n\n if(sensor_info_wakeup.wakeup_sensor_type == (VS_TYPE_CUS1 + i))\n {\n _fifoSizes[BHY_DATA_TYPE_CUS1+i] = sensor_info_wakeup.wakeup_event_size;\n }\n }\n\n return BHY_SUCCESS;\n}\n\n/*!\n * @brief This function get the specific custom sensor data length according reading information from hub.\n *\n * @param[in] sensor_id pointer to sensor_id\n *\n * @retval result of data length\n */\nint8_t bhy_get_cus_evt_size(bhy_virtual_sensor_t sensor_id)\n{\n if(sensor_id >= VS_TYPE_CUS1 && sensor_id <= VS_TYPE_CUS5)\n {\n return _fifoSizes[BHY_DATA_TYPE_CUS1 + sensor_id - VS_TYPE_CUS1];\n }\n\n return BHY_ERROR;\n}\n\n/*!\n * @brief This function write a new SIC matrix to the BHy\n *\n * @param[in] sic_matrix pointer to SIC matrix\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_set_sic_matrix(float *sic_matrix)\n{\n BHY_RETURN_FUNCTION_TYPE return_val;\n\n return_val = bhy_write_parameter_page(BHY_PAGE_2, PAGE2_SIC_MATRIX_0_1, (uint8_t *)(&sic_matrix[0]), 8);\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_2_3, (uint8_t *)(&sic_matrix[2]), 8);\n }\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_4_5, (uint8_t *)(&sic_matrix[4]), 8);\n }\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_6_7, (uint8_t *)(&sic_matrix[6]), 8);\n }\n\n if (BHY_SUCCESS == return_val)\n {\n return_val = bhy_write_parameter_page(BHY_PAGE_2,PAGE2_SIC_MATRIX_8, (uint8_t *)(&sic_matrix[8]), 4);\n }\n\n return return_val;\n}\n\n/*!\n * @brief This function outputs the debug data to function pointer\n * You need to provide a function that takes as argument a zero-terminated string and prints it\n *\n * @param[in] packet debug message\n * @param[in] debug_print_ptr print function\n *\n * @retval result of execution\n */\nvoid bhy_print_debug_packet(bhy_data_debug_t *packet, void (*debug_print_ptr)(const uint8_t *))\n{\n uint8_t len;\n uint8_t tempstr[25];\n uint8_t i=0;\n\n len = packet->data[0] & 0x3F;\n if (packet->data[0] & 0x40)\n {\n /* Binary data */\n while (i < len)\n {\n tempstr[i*2] = (packet->data[i+1] & 0xF0) > 0x90 ?\n ((packet->data[i+1] & 0xF0)>>4) - 0x0A + 'A' :\n ((packet->data[i+1] & 0xF0)>>4) + '0' ;\n tempstr[i*2+1] = (packet->data[i+1] & 0x0F) > 0x09 ?\n (packet->data[i+1] & 0x0F) - 0x0A + 'A' :\n (packet->data[i+1] & 0x0F) + '0' ;\n ++i;\n }\n tempstr[i*2] = '\\0';\n }\n else\n {\n while (i < len)\n {\n tempstr[i] = packet->data[i+1];\n ++i;\n }\n tempstr[i] = '\\0';\n }\n\n debug_print_ptr(tempstr);\n}\n\n#if BHY_CALLBACK_MODE\n/*!\n * @brief configure callback function for sensor\n *\n * @param[in] sensor_id sensor ID\n * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP\n * @param[in] sensor_callback callback function to be configured\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_install_sensor_callback (bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status,\n void (*sensor_callback)(bhy_data_generic_t *, bhy_virtual_sensor_t))\n{\n if ((uint8_t)sensor_id > MAX_SENSOR_ID_NONWAKEUP)\n {\n /* Invalid sensor ID */\n return BHY_OUT_OF_RANGE;\n }\n\n if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))\n {\n /* Invalid wakeup state */\n return BHY_OUT_OF_RANGE;\n }\n\n sensor_id = (bhy_virtual_sensor_t)((sensor_id & 0x1F) + wakeup_status);\n\n if (sensor_callback_list[sensor_id] != 0)\n {\n /* There is already a callback installed */\n return BHY_OUT_OF_RANGE;\n }\n else\n {\n sensor_callback_list[sensor_id] = sensor_callback;\n return BHY_SUCCESS;\n }\n}\n\n/*!\n * @brief uninstall callback function for sensor\n *\n *\n * @param[in] sensor_id sensor ID\n * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_uninstall_sensor_callback(bhy_virtual_sensor_t sensor_id, uint8_t wakeup_status)\n{\n if ((uint8_t)sensor_id > MAX_SENSOR_ID_NONWAKEUP)\n {\n /* Invalid sensor ID */\n return BHY_OUT_OF_RANGE;\n }\n\n if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))\n {\n /* Invalid wakeup state */\n return BHY_OUT_OF_RANGE;\n }\n\n sensor_id = (bhy_virtual_sensor_t)((sensor_id & 0x1F) + wakeup_status);\n if (sensor_callback_list[sensor_id] == 0)\n {\n /* There are no callback installed */\n return BHY_OUT_OF_RANGE;\n }\n else\n {\n sensor_callback_list[sensor_id] = 0;\n return BHY_SUCCESS;\n }\n}\n\n/*!\n * @brief install callback function for timestamp\n *\n *\n * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP\n * @param[in] sensor_callback callback function to be configured\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_install_timestamp_callback (uint8_t wakeup_status, void (*timestamp_callback)(bhy_data_scalar_u16_t *))\n{\n if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))\n {\n /* Invalid wakeup state */\n return BHY_OUT_OF_RANGE;\n }\n if (timestamp_callback_list[wakeup_status == VS_WAKEUP] != 0)\n {\n /* There is already a callback installed */\n return BHY_OUT_OF_RANGE;\n }\n else\n {\n timestamp_callback_list[wakeup_status == VS_WAKEUP] = timestamp_callback;\n return BHY_SUCCESS;\n }\n}\n\n/*!\n * @brief uninstall callback function for timestamp\n *\n * @param[in] wakeup_status status of WAKEUP OR NONWAKEUP\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_uninstall_timestamp_callback (uint8_t wakeup_status)\n{\n if ((wakeup_status != VS_WAKEUP) && (wakeup_status != VS_NON_WAKEUP))\n {\n /* Invalid wakeup state */\n return BHY_OUT_OF_RANGE;\n }\n if (timestamp_callback_list[wakeup_status == VS_WAKEUP] == 0)\n {\n /* There are no callback installed */\n return BHY_OUT_OF_RANGE;\n }\n else\n {\n timestamp_callback_list[wakeup_status == VS_WAKEUP] = 0;\n return BHY_SUCCESS;\n }\n}\n\n/*!\n * @brief install callback function for meta event\n *\n *\n * @param[in] meta_event_id meta event ID\n * @param[in] meta_event_callback callback function to be configured\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_install_meta_event_callback (bhy_meta_event_type_t meta_event_id,\n void (*meta_event_callback)(bhy_data_meta_event_t *,\n bhy_meta_event_type_t))\n{\n if (meta_event_id > MAX_METAEVENT_ID)\n {\n /* Invalid meta event ID */\n return BHY_OUT_OF_RANGE;\n }\n else if (meta_event_callback_list[meta_event_id] != 0)\n {\n /* There is already a callback installed */\n return BHY_OUT_OF_RANGE;\n }\n else\n {\n meta_event_callback_list[meta_event_id] = meta_event_callback;\n return BHY_SUCCESS;\n }\n}\n\n/*!\n * @brief uninstall callback function for meta event\n *\n *\n * @param[in] meta_event_id meta event ID\n *\n * @retval result of execution\n */\nBHY_RETURN_FUNCTION_TYPE bhy_uninstall_meta_event_callback (bhy_meta_event_type_t meta_event_id)\n{\n if (meta_event_id > MAX_METAEVENT_ID)\n {\n /* Invalid meta event ID */\n return BHY_OUT_OF_RANGE;\n }\n else if (meta_event_callback_list[meta_event_id] == 0)\n {\n /* There is no callback installed */\n return BHY_OUT_OF_RANGE;\n }\n else\n {\n meta_event_callback_list[meta_event_id] = 0;\n return BHY_SUCCESS;\n }\n}\n#endif\n\n/** @}*/\n"
}
}
},
"md5": "314a91546f130fac7c477a703841bb2d"
},
"noa1305": {
"libName": "noa1305",
"manufacturer": "ON Semiconductor",
"description": "Ambient Light Sensor",
"type": "Ambient Light Sensor",
"icon": "EmbeddedAmbientLight.svg",
"image": "",
"version": "",
"eelVersion": "3",
"shoppingCartLinks": {
"digikey": {
"links": {
"info": "https://www.digikey.com/products/en?keywords=rsl10-sense-gevk"
},
"cartData": {
"part": "",
"partid": "",
"source": "dkstudio",
"qty": "1"
}
}
},
"requires": [
"embedded",
"i2c",
"fpmath"
],
"elements": [
{
"name": "NOA1305AmbientLight",
"type": "EmbeddedNOA1305",
"icon": "EmbeddedAmbientLight.svg",
"defaultAbility": "readAmbientLight",
"defaultTrigger": "ambientLightRead",
"hidden": false,
"abilities": [
{
"name": "setup",
"hidden": true,
"code": " if(!NOA1305_Init(ATMO_PROPERTY(undefined, i2cInstance)))\n {\n return ATMO_Status_Fail;\n }\n\n return ATMO_Status_Success;"
},
{
"name": "readAmbientLight",
"triggers": [
"ambientLightRead"
],
"code": " uint32_t ambientLightLux = 0;\n if(!NOA1305_GetAmbientLight(&ambientLightLux))\n {\n return ATMO_Status_Fail;\n }\n ATMO_CreateValueUnsignedInt(out, ambientLightLux);\n return ATMO_Status_Success;"
}
],
"properties": [
{
"name": "i2cInstance",
"input": "driverInstance",
"driverType": "i2c"
}
],
"triggers": [],
"variables": [],
"language": {
"en-US": {
"EmbeddedNOA1305": "NOA1305 Ambient Light",
"i2cInstance": "I2C Driver Instance",
"readAmbientLight": "Read Ambient Light (lux)",
"ambientLightRead": "Ambient Light Read",
"i2cAddress": "I2C Address"
}
}
}
],
"files": {
"common": {
"headers": {
"noa1305.h": "#ifndef _NOA1305_H_\n#define _NOA1305_H_\n\n#include \"../app_src/atmosphere_platform.h\"\n\nATMO_BOOL_t NOA1305_Init(ATMO_DriverInstanceHandle_t i2cInstance);\n\nATMO_BOOL_t NOA1305_GetAmbientLight(uint32_t *lightLux);\n\n#endif",
"noa1305_onsemi.h": "//-----------------------------------------------------------------------------\n// Copyright (c) 2018 Semiconductor Components Industries LLC\n// (d/b/a \"ON Semiconductor\"). All rights reserved.\n// This software and/or documentation is licensed by ON Semiconductor under\n// limited terms and conditions. The terms and conditions pertaining to the\n// software and/or documentation are available at\n// http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf (\"ON Semiconductor Standard\n// Terms and Conditions of Sale, Section 8 Software\") and if applicable the\n// software license agreement. Do not use this software and/or documentation\n// unless you have carefully read and you agree to the limited terms and\n// conditions. By using this software and/or documentation, you agree to the\n// limited terms and conditions.\n//-----------------------------------------------------------------------------\n//! \\file noa1305.h\n//!\n//! \\mainpage\n//!\n//! This driver library contains the ON Semiconductor's <b>NOA1305\n//! Ambient Light Sensor</b> API\n//!\n//! Product page:<br>\n//! https://www.onsemi.com/PowerSolutions/product.do?id=NOA1305\n//!\n//! IDK Evaluation board:<br>\n//! https://www.onsemi.com/PowerSolutions/evalBoard.do?id=ALS-GEVB\n//!\n//! API reference:<br>\n//! \\ref NOA1305_DRIVER_GRP\n//!\n//! \\addtogroup NOA1305_DRIVER_GRP NOA1305 API\n//! \\{\n//-----------------------------------------------------------------------------\n#ifndef NOA1305_H_\n#define NOA1305_H_\n\n#include <stdbool.h>\n#include <stdint.h>\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif\n\n//! \\name Library error codes\n//! \\{\n\n/** \\brief Library call was successful. */\n#define NOA1305_OK (0)\n\n/** \\brief Invalid pointer argument was passed to library function. */\n#define NOA1305_E_NULL_PTR (1)\n\n/** \\brief Transfer function indicated communication error. */\n#define NOA1305_E_COMM (2)\n\n/** \\brief Device ID register content does not match expected value. */\n#define NOA1305_E_DEV_NOT_FOUND (3)\n\n/** \\brief Argument passed to library function has invalid value. */\n#define NOA1305_E_OUT_OF_RANGE (4)\n\n/** \\brief Given operation is not supported. */\n#define NOA1305_E_UNSUPPORTED (5)\n\n/** \\brief Success return code for I2C transfer function. */\n#define NOA1305_COMM_OK (0)\n\n/** \\brief Failure return code for I2C transfer function. */\n#define NOA1305_COMM_ERROR (1)\n\n//! \\}\n\n/** \\brief NOA1305 I2C Interface 7-bit address */\n#define NOA1305_I2C_ADDR (0x39)\n\n//! \\anchor NOA1305_GRP_I2C_REG_MAP\n//! \\name I2C Register Map\n//! \\{\n\n#define NOA1305_REG_POWER_CONTROL (0x00)\n#define NOA1305_REG_RESET (0x01)\n#define NOA1305_REG_INTEGEGRATION_TIME (0x02)\n#define NOA1305_REG_INT_SELECT (0x03)\n#define NOA1305_REG_INT_THRESHOLD_LSB (0x04)\n#define NOA1305_REG_INT_THRESHOLD_MSB (0x05)\n#define NOA1305_REG_ALS_DATA_LSB (0x06)\n#define NOA1305_REG_ALS_DATA_MSB (0x07)\n#define NOA1305_REG_DEVICE_ID_LSB (0x08)\n#define NOA1305_REG_DEVICE_ID_MSB (0x09)\n\n//! \\}\n\n//! \\anchor NOA1305_DRIVER_GRP_POWER_MODES\n//! \\name NOA1305 Power Modes\n//! \\{\n\n/** \\brief Sensor is powered down. */\n#define NOA1305_POWER_DOWN (0x00)\n\n/** \\brief Sensor is powered up and does periodic measurements.\n *\n * This is the default power mode after power up.\n */\n#define NOA1305_POWER_ON (0x08)\n\n#define NOA1305_TEST_MODE_1 (0x09) /**< Reserved */\n#define NOA1305_TEST_MODE_2 (0x0A) /**< Fixed output of 0x5555 */\n#define NOA1305_TEST_MODE_3 (0x0B) /**< Fixed output of 0xAAAA */\n\n//! \\}\n\n/** \\brief Value that needs to be written into the reset register to do\n * software reset of the device.\n */\n#define NOA1305_RESET_VAL (0x10)\n\n//! \\anchor NOA1305_DRIVER_GRP_INTEG_TIME\n//! \\name NOA1305 Integration Time Setting\n//! \\{\n\n#define NOA1305_INTEG_TIME_800MS (0x00)\n#define NOA1305_INTEG_TIME_400MS (0x01)\n#define NOA1305_INTEG_TIME_200MS (0x02)\n#define NOA1305_INTEG_TIME_100MS (0x03)\n#define NOA1305_INTEG_TIME_50MS (0x04)\n#define NOA1305_INTEG_TIME_25MS (0x05)\n#define NOA1305_INTEG_TIME_12p5MS (0x06)\n#define NOA1305_INTEG_TIME_6p25MS (0x07)\n\n//! \\}\n\n//! \\name NOA1305 Interrupt generation Setting\n//! \\{\n\n/** \\brief INT pin is High if measured ALS level is greater then threshold\n * value.\n */\n#define NOA1305_INT_LOW_TO_HIGH (0x01)\n\n/** \\brief INT pin is Low if measured ALS level is greater then threshold\n * value.\n */\n#define NOA1305_INT_HIGH_TO_LOW (0x02)\n\n/** \\brief INT pin is inactive, always High. */\n#define NOA1305_INT_INACTIVE (0x03)\n\n//! \\}\n\n/** \\brief NOA1305 Device ID value, LSB */\n#define NOA1305_DEVICE_ID_LSB_VAL (0x19)\n\n/** \\brief NOA1305 Device ID value, MSB */\n#define NOA1305_DEVICE_ID_MSB_VAL (0x05)\n\n/** \\brief NOA1305 Device ID value */\n#define NOA1305_DEVICE_ID (0x0519)\n\n/** \\brief Scaling factor for integration constant stored in noa1305_t\n * structure.\n */\n#define NOA1305_INTEG_CONSTANT_DIV (1000.0f)\n\n/** \\brief Control structure for NOA1305 containing platform dependent\n * communication functions and device parameters.\n *\n * \\note\n * All member variables of this structure have to be set before it can be used\n * with the NOA1305 API functions.\n */\nstruct noa1305_t\n{\n\tint32_t (*read_func)(uint8_t dev_id, uint8_t addr, uint8_t *value);\n\tint32_t (*write_func)(uint8_t dev_id, uint8_t addr, uint8_t value);\n\tvoid (*delay_func)(uint32_t ms);\n\n\t/** \\brief I_K times 1000 */\n\tint32_t integration_constatnt;\n\n\t/** \\brief Device id passed to bus read / write functions.\n\t *\n\t * Needs to be set before calling noa1305_init function.\n\t */\n\tuint8_t id;\n};\n\n/** \\brief Initializes NOA1305 Ambient Light Sensor.\n *\n * This function does the following steps:\n *\n * 1. Issues Software reset command to NOA1305.\n * 2. Tests for correct Device ID value.\n * 3. Turns the sensor into power off mode.\n *\n * \\param dev\n * Pointer to NOA1305 control structure.\n * This structure must have all of its member variables set to platform specific\n * communication functions before calling this function.\n *\n * \\returns\n * \\ref NOA1305_OK - On success.<br>\n * \\ref NOA1305_E_DEV_NOT_FOUND - Device ID mismatch.<br>\n * \\ref NOA1305_E_NULL_PTR - \\p dev pointer or its value are invalid.\n * \\b NOA1305_E_* - Error code on error.\n */\nextern int32_t noa1305_init(struct noa1305_t *dev);\n\n/** \\brief Set NOA1305 power mode.\n *\n * \\param power_mode\n * One of available \\ref NOA1305_GRP_POWER_MODES.\n *\n * \\param dev\n * Pointer to initialized NOA1305 control structure.\n *\n * \\returns\n * \\ref NOA1305_OK - On success.<br>\n * \\b NOA1305_E_* - Error code on error.\n */\nextern int32_t noa1305_set_power_mode(uint8_t power_mode, struct noa1305_t *dev);\n\n/** \\brief Read current NOA1305 power mode.\n *\n * \\param power_mode\n * Pointer to variable where read poer mode will be saved.\n *\n * \\param dev\n * Pointer to initialized NOA1305 control structure.\n *\n * \\returns\n * \\ref NOA1305_OK - On success.<br>\n * \\b NOA1305_E_* - Error code on error.\n */\nextern int32_t noa1305_get_power_mode(uint8_t *power_mode,\n\t\tstruct noa1305_t *dev);\n\n/** \\brief Issues a software reset command to NOA1305.\n *\n * \\param dev\n * Pointer to initialized NOA1305 control structure.\n *\n * \\returns\n * \\ref NOA1305_OK - On success.<br>\n * \\b NOA1305_E_* - Error code on error.\n */\nextern int32_t noa1305_reset(struct noa1305_t *dev);\n\n/** \\brief Write new integration time setting to NOA1305. */\nextern int32_t noa1305_set_integration_time(uint8_t integ_time,\n\t\tstruct noa1305_t *dev);\n\nextern int32_t noa1305_get_integration_time(uint8_t *integ_time,\n\t\tstruct noa1305_t *dev);\n\n/** \\brief Write new interrupt select setting to NOA1305. */\nextern int32_t noa1305_set_int_select(uint8_t int_select, struct noa1305_t *dev);\n\nextern int32_t noa1305_get_int_select(uint8_t *int_select,\n\t\tstruct noa1305_t *dev);\n\n/** \\brief Write new interrupt threshold value setting to NOA1305. */\nextern int32_t noa1305_set_int_threshold(uint16_t threshold,\n\t\tstruct noa1305_t *dev);\n\nextern int32_t noa1305_get_int_threshold(uint16_t *threshold,\n\t\tstruct noa1305_t *dev);\n\n/** \\brief Read latest ambient light measurement from NOA1305. */\nextern int32_t noa1305_read_als_data(uint16_t *als_data, struct noa1305_t *dev);\n\n/** \\brief Read device ID from NOA1305. */\nextern int32_t noa1305_read_device_id(uint16_t *dev_id, struct noa1305_t *dev);\n\n/** \\brief Read latest ambient light measurement from NOA1305 and convert it\n * into Lux.\n *\n * This function uses integer arithmetic and has the precision of 1 Lux.\n *\n * \\param lux\n * Pointer to variable where the read ambient light value in Lux will be\n * stored.\n *\n * \\param dev\n * Pointer to initialized NOA1305 control structure.\n *\n * \\returns\n * \\ref NOA1305_OK - On success.<br>\n * \\b NOA1305_E_* - Error code on error.\n */\nextern int32_t noa1305_convert_als_data_lux(uint32_t *lux,\n\t\tstruct noa1305_t *dev);\n\n/** \\brief Write new interrupt threshold value into NOA1305 based on Lux value.\n *\n * This function uses integer arithmetic and has the precision of 1 Lux.\n *\n * \\param lux\n * Ambient light value in Lux that will be converted and written into the\n * threshold register.\n *\n * \\param dev\n * Pointer to initialized NOA1305 control structure.\n *\n * \\returns\n * \\ref NOA1305_OK - On success.<br>\n * \\b NOA1305_E_* - Error code on error.\n */\nextern int32_t noa1305_set_int_threshold_lux(uint32_t lux,\n\t\tstruct noa1305_t *dev);\n\n/** \\brief Reads current interrupt threshold value from NOA1305 and converts it\n * into Lux.\n *\n * \\param lux\n * Pointer to variable where the read ambient light value in Lux will be\n * stored.\n *\n * \\param dev\n * Pointer to initialized NOA1305 control structure.\n *\n * \\returns\n * \\ref NOA1305_OK - On success.<br>\n * \\b NOA1305_E_* - Error code on error.\n */\nextern int32_t noa1305_get_int_threshold_lux(uint32_t *lux,\n\t\tstruct noa1305_t *dev);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* NOA1305_H_ */\n\n//! \\}\n"
},
"objects": {
"noa1305.c": "#include \"noa1305.h\"\n#include \"noa1305_onsemi.h\"\n\nstatic ATMO_DriverInstanceHandle_t _NOA1305_I2CInstance = 0;\nstatic ATMO_BOOL_t _NOA1305_Connected = false;\nstatic struct noa1305_t _NOA1305_Dev;\n\n#define NOA1305_DEVICE_ID\t\t0x0519\n#define NOA1305_REG_DEVICE_ID_LSB\t0x08\n#define NOA1305_REG_DEVICE_ID_MSB\t0x09\n\n#define NOA1305_INTEG_TIME_200MS 2\n\n#define NOA1305_I2C_ADDR 0x39\n\nstatic int32_t _NOA1305_BusRead(uint8_t dev_id, uint8_t addr, uint8_t *value)\n{\n return ATMO_I2C_MasterRead(_NOA1305_I2CInstance, dev_id, &addr, 1, value, 1, 0);\n}\n\nstatic int32_t _NOA1305_BusWrite(uint8_t dev_id, uint8_t addr, uint8_t value)\n{\n uint8_t data[2] = { addr, value };\n\n return ATMO_I2C_MasterWrite(_NOA1305_I2CInstance, dev_id, NULL, 0, data, 2, 0);\n}\n\nATMO_BOOL_t NOA1305_Init( ATMO_DriverInstanceHandle_t i2cInstance )\n{\n\t_NOA1305_Dev.id = NOA1305_I2C_ADDR;\n\t_NOA1305_Dev.integration_constatnt = 7700;\n\n\t_NOA1305_Dev.read_func = &_NOA1305_BusRead;\n\t_NOA1305_Dev.write_func = &_NOA1305_BusWrite;\n\t_NOA1305_Dev.delay_func = &ATMO_PLATFORM_DelayMilliseconds;\n\n // Initialize and verify device ID\n\tint retval = noa1305_init( &_NOA1305_Dev );\n\n\tif ( retval == NOA1305_OK )\n\t{\n\t\tretval = noa1305_set_int_select( NOA1305_INT_INACTIVE, &_NOA1305_Dev );\n\n\t\tif ( retval == NOA1305_OK )\n\t\t{\n\t\t\tretval = noa1305_set_integration_time( NOA1305_INTEG_TIME_200MS, &_NOA1305_Dev );\n\n if(retval == NOA1305_OK)\n {\n // Set to continuous mode for now\n retval = noa1305_set_power_mode(NOA1305_POWER_ON, &_NOA1305_Dev);\n }\n\t\t}\n\t}\n\n return (retval == NOA1305_OK);\n}\n\nATMO_BOOL_t NOA1305_GetAmbientLight( uint32_t *lightLux )\n{\n if( noa1305_convert_als_data_lux(lightLux, &_NOA1305_Dev) != NOA1305_OK )\n {\n return false;\n }\n\n return true;\n}\n",
"noa1305_onsemi.c": "//-----------------------------------------------------------------------------\n// Copyright (c,struct noa1305_t *dev) 2018 Semiconductor Components Industries LLC\n// (d/b/a \"ON Semiconductor\",struct noa1305_t *dev). All rights reserved.\n// This software and/or documentation is licensed by ON Semiconductor under\n// limited terms and conditions. The terms and conditions pertaining to the\n// software and/or documentation are available at\n// http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf (\"ON Semiconductor Standard\n// Terms and Conditions of Sale, Section 8 Software\",struct noa1305_t *dev) and if applicable the\n// software license agreement. Do not use this software and/or documentation\n// unless you have carefully read and you agree to the limited terms and\n// conditions. By using this software and/or documentation, you agree to the\n// limited terms and conditions.\n//-----------------------------------------------------------------------------\n//! \\file noa1305.c\n//!\n//! \\addtogroup NOA1305_DRIVER_GRP\n//! \\{\n//-----------------------------------------------------------------------------\n#include \"noa1305_onsemi.h\"\n\n#include <stdlib.h>\n\n/** \\brief COnversion constants used to convert measured ALS counts into LUX\n * value for different integration time settings.\n */\nstatic const uint32_t noa1305_conv_param[] = {\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.800f,\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.400f,\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.200f,\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.100f,\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.050f,\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.025f,\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.0125f,\n\t\tNOA1305_INTEG_CONSTANT_DIV / 0.00625f\n};\n\n/** \\brief Converts measured count value into LUX.\n *\n * \\param cnt\n * Measured ALS count sample read from NOA1305 ALS output registers.\n *\n * \\param ti\n * Integration time used to measure \\p cnt sample.\n * Use one of <b>NOA1305_INTEG_TIME_[ 800MS | 400 MS | 200MS | 100MS | 50MS |\n * 25MS | 12p5MS | 6p25MS ]</b>.\n *\n * \\param ik\n * Integration constant times 1000.\n *\n * \\returns\n * Lux value equivalent to measured \\p cnt.\n */\nstatic uint32_t noa1305_cnt_to_lux(uint16_t cnt, uint8_t ti, uint32_t ik)\n{\n\treturn (((uint32_t) cnt) * noa1305_conv_param[ti]) / ik;\n}\n\n/** \\brief Converts Lux value into NOA1305 sensor count value that cen be loaded\n * into interrupt threshold register.\n *\n * \\param lux\n * Ambient light in Lux to convert to NOA1305 sensor count.\n *\n * \\param ti\n * Integration time used by the sensor.\n * Use one of <b>NOA1305_INTEG_TIME_[ 800MS | 400 MS | 200MS | 100MS | 50MS |\n * 25MS | 12p5MS | 6p25MS ]</b>.\n *\n * \\param ik\n * Integration constant times 1000.\n *\n * \\returns\n * NOA1305 sensor count equivalent to \\p lux value.\n */\nstatic uint16_t noa1305_lux_to_cnt(uint32_t lux, uint8_t ti, uint32_t ik)\n{\n\treturn ((uint32_t) (lux * ik) / noa1305_conv_param[ti]);\n}\n\nint32_t noa1305_init(struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tif (dev != NULL && dev->read_func != NULL && dev->write_func != NULL\n\t\t\t&& dev->delay_func != NULL)\n\t{\n\t\tretval = noa1305_reset(dev);\n\t\tif (retval == NOA1305_OK)\n\t\t{\n\t\t\tdev->delay_func(2);\n\n\t\t\tuint16_t device_id;\n\t\t\tretval = noa1305_read_device_id(&device_id, dev);\n\t\t\tif (retval == NOA1305_OK)\n\t\t\t{\n\t\t\t\tif (device_id == NOA1305_DEVICE_ID)\n\t\t\t\t{\n\t\t\t\t\tretval = noa1305_set_power_mode(NOA1305_POWER_DOWN, dev);\n\t\t\t\t\tdev->delay_func(2);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tretval = NOA1305_E_DEV_NOT_FOUND;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_set_power_mode(uint8_t power_mode, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tif (dev != NULL)\n\t{\n\t\tif (power_mode == NOA1305_POWER_DOWN\n\t\t\t\t|| (power_mode >= NOA1305_POWER_ON\n\t\t\t\t\t\t&& power_mode <= NOA1305_TEST_MODE_3))\n\t\t{\n\t\t\tretval = dev->write_func(dev->id, NOA1305_REG_POWER_CONTROL,\n\t\t\t\t\tpower_mode);\n\t\t\tif (retval != NOA1305_COMM_OK)\n\t\t\t{\n\t\t\t\tretval = NOA1305_E_COMM;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tretval = NOA1305_E_OUT_OF_RANGE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_get_power_mode(uint8_t *power_mode, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tif (dev != NULL && power_mode != NULL)\n\t{\n\t\tretval = dev->read_func(dev->id, NOA1305_REG_POWER_CONTROL, power_mode);\n\t\tif (retval != NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_reset(struct noa1305_t *dev)\n{\n\tint32_t retval;\n\n\tif (dev != NULL)\n\t{\n\t\tretval = dev->write_func(dev->id, NOA1305_REG_RESET, NOA1305_RESET_VAL);\n\t\tif (retval != NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_set_integration_time(uint8_t integ_time, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tif (dev != NULL)\n\t{\n\t\tif (integ_time <= NOA1305_INTEG_TIME_6p25MS)\n\t\t{\n\t\t\tretval = dev->write_func(dev->id, NOA1305_REG_INTEGEGRATION_TIME,\n\t\t\t\t\tinteg_time);\n\t\t\tif (retval != NOA1305_COMM_OK)\n\t\t\t{\n\t\t\t\tretval = NOA1305_E_COMM;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tretval = NOA1305_E_OUT_OF_RANGE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_get_integration_time(uint8_t *integ_time, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tif (dev != NULL && integ_time != NULL)\n\t{\n\t\tretval = dev->read_func(dev->id, NOA1305_REG_INTEGEGRATION_TIME,\n\t\t\t\tinteg_time);\n\t\tif (retval != NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_set_int_select(uint8_t int_select, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tif (dev != NULL)\n\t{\n\t\tif (int_select >= NOA1305_INT_LOW_TO_HIGH\n\t\t\t\t&& int_select <= NOA1305_INT_INACTIVE)\n\t\t{\n\t\t\tretval = dev->write_func(dev->id, NOA1305_REG_INT_SELECT,\n\t\t\t\t\tint_select);\n\t\t\tif (retval != NOA1305_COMM_OK)\n\t\t\t{\n\t\t\t\tretval = NOA1305_E_COMM;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tretval = NOA1305_E_OUT_OF_RANGE;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_get_int_select(uint8_t *int_select, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tif (dev != NULL && int_select != NULL)\n\t{\n\t\tretval = dev->read_func(dev->id, NOA1305_REG_INT_SELECT, int_select);\n\t\tif (retval != NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_set_int_threshold(uint16_t threshold, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tuint8_t thresh_msb = (threshold >> 8) & 0x00FF;\n\tuint8_t thresh_lsb = threshold & 0x00FF;\n\n\tif (dev != NULL)\n\t{\n\t\tretval = dev->write_func(dev->id, NOA1305_REG_INT_THRESHOLD_LSB,\n\t\t\t\tthresh_lsb);\n\t\tif (retval == NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = dev->write_func(dev->id, NOA1305_REG_INT_THRESHOLD_MSB,\n\t\t\t\t\tthresh_msb);\n\t\t\tif (retval != NOA1305_COMM_OK)\n\t\t\t{\n\t\t\t\tretval = NOA1305_E_COMM;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_get_int_threshold(uint16_t *threshold, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tuint8_t thresh_msb, thresh_lsb;\n\n\tif (dev != NULL && threshold != NULL)\n\t{\n\t\tretval = dev->read_func(dev->id, NOA1305_REG_INT_THRESHOLD_LSB,\n\t\t\t\t&thresh_lsb);\n\t\tif (retval == NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = dev->read_func(dev->id, NOA1305_REG_INT_THRESHOLD_MSB,\n\t\t\t\t\t&thresh_msb);\n\t\t\tif (retval == NOA1305_COMM_OK)\n\t\t\t{\n\t\t\t\t*threshold = (((uint16_t)thresh_msb) << 8) | thresh_lsb;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tretval = NOA1305_E_COMM;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_read_als_data(uint16_t *als_data, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tuint8_t data_msb, data_lsb;\n\n\tif (dev != NULL && als_data != NULL)\n\t{\n\t\tretval = dev->read_func(dev->id, NOA1305_REG_ALS_DATA_LSB, &data_lsb);\n\t\tif (retval == NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = dev->read_func(dev->id, NOA1305_REG_ALS_DATA_MSB,\n\t\t\t\t\t&data_msb);\n\t\t\tif (retval == NOA1305_COMM_OK)\n\t\t\t{\n\t\t\t\t*als_data = (((uint16_t)data_msb) << 8) | data_lsb;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tretval = NOA1305_E_COMM;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_read_device_id(uint16_t *dev_id, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tuint8_t id_msb, id_lsb;\n\n\tif (dev != NULL && dev_id != NULL)\n\t{\n\t\tretval = dev->read_func(dev->id, NOA1305_REG_DEVICE_ID_LSB, &id_lsb);\n\t\tif (retval == NOA1305_COMM_OK)\n\t\t{\n\t\t\tretval = dev->read_func(dev->id, NOA1305_REG_DEVICE_ID_MSB,\n\t\t\t\t\t&id_msb);\n\t\t\tif (retval == NOA1305_COMM_OK)\n\t\t\t{\n\t\t\t\t*dev_id = (((uint16_t)id_msb) << 8) | id_lsb;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tretval = NOA1305_E_COMM;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tretval = NOA1305_E_COMM;\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_convert_als_data_lux(uint32_t *lux, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\tuint16_t als_data;\n\tuint8_t ti_setting; /* integreation time reg value */\n\n\tif (dev != NULL && lux != NULL)\n\t{\n\t\tretval = noa1305_read_als_data(&als_data, dev);\n\t\tif (retval == NOA1305_OK)\n\t\t{\n\t\t\tretval = noa1305_get_integration_time(&ti_setting, dev);\n\t\t\tif (retval == NOA1305_OK)\n\t\t\t{\n\t\t\t\t*lux = noa1305_cnt_to_lux(als_data, ti_setting,\n\t\t\t\t\t\tdev->integration_constatnt);\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_set_int_threshold_lux(uint32_t lux, struct noa1305_t *dev)\n{\n\tint32_t retval = NOA1305_OK;\n\n\tuint8_t ti_setting = 0;\n\tuint16_t new_threshold = 0;\n\n\tif (dev != NULL)\n\t{\n\t\tretval = noa1305_get_integration_time(&ti_setting, dev);\n\t\tif (retval == NOA1305_OK)\n\t\t{\n\t\t\tnew_threshold = noa1305_lux_to_cnt(lux, ti_setting,\n\t\t\t\t\tdev->integration_constatnt);\n\n\t\t\tretval = noa1305_set_int_threshold(new_threshold, dev);\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\nint32_t noa1305_get_int_threshold_lux(uint32_t *lux, struct noa1305_t *dev)\n{\n\tint retval = NOA1305_OK;\n\n\tuint8_t ti_setting = 0;\n\tuint16_t threshold = 0;\n\n\tif (dev != NULL && lux != NULL)\n\t{\n\t\tretval = noa1305_get_integration_time(&ti_setting, dev);\n\t\tif (retval == NOA1305_OK)\n\t\t{\n\t\t\tretval = noa1305_get_int_threshold(&threshold, dev);\n\t\t\tif (retval == NOA1305_OK)\n\t\t\t{\n\t\t\t\t*lux = noa1305_cnt_to_lux(threshold, ti_setting,\n\t\t\t\t\t\tdev->integration_constatnt);\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tretval = NOA1305_E_NULL_PTR;\n\t}\n\n\treturn retval;\n}\n\n//! \\}\n"
}
}
},
"md5": "90acea465a88bcc0fc01a92b1e906592"
}
},
"drivers": {
"adc": [],
"ble": [
{
"id": 0,
"name": "ATMO_DRIVERINSTANCE_BLE_BLE1"
}
],
"block": [
{
"id": 0,
"name": "ATMO_DRIVERINSTANCE_BLOCK_BLOCK1"
}
],
"datetime": [],
"filesytem": [
{
"id": 0,
"name": "ATMO_DRIVERINSTANCE_FILESYSTEM_FILESYSTEM1"
}
],
"gpio": [
{
"id": 0,
"name": "ATMO_DRIVERINSTANCE_GPIO_GPIO1"
}
],
"http": [],
"i2c": [
{
"id": 0,
"name": "ATMO_DRIVERINSTANCE_I2C_I2C1",
"primary": true
}
],
"interval": [
{
"id": 0,
"name": "ATMO_DRIVERINSTANCE_INTERVAL_INTERVAL1"
}
],
"nfc": [],
"pwm": [],
"spi": [],
"uart": [],
"wifi": []
},
"firmwareFiles": {
"artifactName": "firmware",
"fileName": "firmware.zip"
},
"static": {
"header": "",
"footer": "",
"functions": {
"ATMO_Setup": {
"returnType": "void",
"code": "",
"arguments": []
}
}
}
},
"Application": {
"type": "app",
"compilerVersion": "latest",
"variants": [],
"meta": {
"appViewLayouts": {
"320": {
"560": true
}
}
},
"elements": [
{
"name": "Interval1",
"type": "AppInterval",
"variants": [
"app"
],
"properties": {
"errorData": null,
"time": "600",
"startOnInitialize": true
},
"meta": {
"editorX": 64,
"editorY": 172,
"lastTrigger": "interval"
},
"triggers": {
"triggered": [],
"interval": [
{
"mapping": {},
"targetOrder": [],
"targetElement": "Temperature",
"targetAbility": "read"
},
{
"mapping": {},
"targetOrder": [],
"targetElement": "Light",
"targetAbility": "read"
}
],
"started": [],
"paused": []
}
},
{
"name": "Temperature",
"type": "AppBLECharacteristicCustom",
"variants": [
"app",
"ble"
],
"properties": {
"errorData": {},
"readData": null,
"code": {
"trigger": "\treturn ATMO_Status_Success;",
"setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\t&ATMO_VARIABLE(Temperature, bleServiceHandle), \n\t\tATMO_PROPERTY(Temperature, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(Temperature, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(Temperature, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(Temperature, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(Temperature, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(Temperature, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(Temperature, writeDataType), ATMO_PROPERTY(Temperature, readDataType), ATMO_PROPERTY(Temperature, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\t&ATMO_VARIABLE(Temperature, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(Temperature, bleServiceHandle), \n\t\tATMO_PROPERTY(Temperature, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\tATMO_VARIABLE(Temperature, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(Temperature, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
"setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(Temperature, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(Temperature, instance),\n\t\tATMO_VARIABLE(Temperature, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
"written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(Temperature, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
"subscibed": "\treturn ATMO_Status_Success;",
"unsubscribed": "\treturn ATMO_Status_Success;"
},
"variables": {
"bleServiceHandle": {
"type": "ATMO_BLE_Handle_t"
},
"bleCharacteristicHandle": {
"type": "ATMO_BLE_Handle_t"
}
},
"embeddedPropertyConversions": {
"bleServiceUuid": "string",
"bleCharacteristicUuid": "string"
},
"codeUserChanged": {
"setup": false,
"setValue": false,
"written": false,
"subscibed": false,
"unsubscribed": false
},
...
This file has been truncated, please download it to see its full contents.
Comments