CAC_smartcushion / Mbed OS AdiSense1000_V21_Smartcushion

Fork of Sean_AdiSense1000_V21 by Rohan Gurav

Committer:
nfathurr
Date:
Thu Sep 27 12:14:22 2018 +0000
Revision:
35:853be4d80ff3
Parent:
34:029fc3b83f78
Child:
36:4aded4b4f060
fixed the adxl configuration

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kevin1990 15:78f3f517417f 1 /*
kevin1990 28:4eb837cd71df 2 CONFIDENTIAL AND PROPRIETARY INFORMATION
kevin1990 28:4eb837cd71df 3
kevin1990 28:4eb837cd71df 4 Copyright (c) 2018 Emutex Ltd. All rights reserved.
kevin1990 28:4eb837cd71df 5 This software and documentation contain confidential and
kevin1990 28:4eb837cd71df 6 proprietary information that is the property of
kevin1990 28:4eb837cd71df 7 Emutex Ltd. The software and documentation are
kevin1990 28:4eb837cd71df 8 furnished under a license agreement and may be used
kevin1990 28:4eb837cd71df 9 or copied only in accordance with the terms of the license
kevin1990 28:4eb837cd71df 10 agreement. No part of the software and documentation
kevin1990 28:4eb837cd71df 11 may be reproduced, transmitted, or translated, in any
kevin1990 28:4eb837cd71df 12 form or by any means, electronic, mechanical, manual,
kevin1990 28:4eb837cd71df 13 optical, or otherwise, without prior written permission
kevin1990 28:4eb837cd71df 14 of Emutex Ltd., or as expressly provided by the license agreement.
kevin1990 28:4eb837cd71df 15 Reverse engineering is prohibited, and reproduction,
kevin1990 28:4eb837cd71df 16 disclosure or use without specific written authorization
kevin1990 28:4eb837cd71df 17 of Emutex Ltd. is strictly forbidden.
kevin1990 15:78f3f517417f 18 *
danodonovan 23:2adb6216b001 19 Copyright 2017 (c) Analog Devices, Inc.
kevin1990 15:78f3f517417f 20
kevin1990 15:78f3f517417f 21 All rights reserved.
kevin1990 15:78f3f517417f 22
danodonovan 23:2adb6216b001 23 Redistribution and use in source and binary forms, with or without
danodonovan 23:2adb6216b001 24 modification, are permitted provided that the following conditions are met:
danodonovan 23:2adb6216b001 25 - Redistributions of source code must retain the above copyright
danodonovan 23:2adb6216b001 26 notice, this list of conditions and the following disclaimer.
danodonovan 23:2adb6216b001 27 - Redistributions in binary form must reproduce the above copyright
danodonovan 23:2adb6216b001 28 notice, this list of conditions and the following disclaimer in
danodonovan 23:2adb6216b001 29 the documentation and/or other materials provided with the
danodonovan 23:2adb6216b001 30 distribution.
kevin1990 15:78f3f517417f 31 - Neither the name of Analog Devices, Inc. nor the names of its
kevin1990 15:78f3f517417f 32 contributors may be used to endorse or promote products derived
kevin1990 15:78f3f517417f 33 from this software without specific prior written permission.
danodonovan 23:2adb6216b001 34 - The use of this software may or may not infringe the patent rights
danodonovan 23:2adb6216b001 35 of one or more patent holders. This license does not release you
danodonovan 23:2adb6216b001 36 from the requirement that you obtain separate licenses from these
danodonovan 23:2adb6216b001 37 patent holders to use this software.
danodonovan 23:2adb6216b001 38 - Use of the software either in source or binary form, must be run
danodonovan 23:2adb6216b001 39 on or directly connected to an Analog Devices Inc. component.
kevin1990 15:78f3f517417f 40
danodonovan 23:2adb6216b001 41 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
danodonovan 23:2adb6216b001 42 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
danodonovan 23:2adb6216b001 43 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
danodonovan 23:2adb6216b001 44 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
danodonovan 23:2adb6216b001 45 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
danodonovan 23:2adb6216b001 46 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
danodonovan 23:2adb6216b001 47 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
danodonovan 23:2adb6216b001 48 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
danodonovan 23:2adb6216b001 49 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
danodonovan 23:2adb6216b001 50 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
kevin1990 15:78f3f517417f 51 *
kevin1990 15:78f3f517417f 52 *****************************************************************************/
kevin1990 28:4eb837cd71df 53 /*!
kevin1990 28:4eb837cd71df 54 ******************************************************************************
kevin1990 28:4eb837cd71df 55 * @file:
kevin1990 28:4eb837cd71df 56 *-----------------------------------------------------------------------------
kevin1990 28:4eb837cd71df 57 *
kevin1990 28:4eb837cd71df 58 */
kevin1990 15:78f3f517417f 59 #include "mbed.h"
kevin1990 15:78f3f517417f 60 #include "inc/adi_sense_api.h"
kevin1990 15:78f3f517417f 61 #include "inc/adi_sense_1000/adi_sense_1000_api.h"
kevin1990 15:78f3f517417f 62 #include "inc/adi_sense_log.h"
kevin1990 15:78f3f517417f 63 #include "common/utils.h"
kevin1990 15:78f3f517417f 64
nfathurr 34:029fc3b83f78 65 //additional libraries
nfathurr 34:029fc3b83f78 66 #include "adisense1000_boot.h"
nfathurr 34:029fc3b83f78 67 #include "ble_interface/ble_interface.h"
nfathurr 34:029fc3b83f78 68 #include "myproswift_eval.h"
nfathurr 34:029fc3b83f78 69 #include "eeprom_virtual/eeprom.h"
nfathurr 34:029fc3b83f78 70 #include "myproswift_periph.h"
nfathurr 34:029fc3b83f78 71 #include "led.h"
nfathurr 34:029fc3b83f78 72 #include "bootloader.h"
nfathurr 34:029fc3b83f78 73 #include "rcc_backup_registers.h"
kevin1990 15:78f3f517417f 74
nfathurr 34:029fc3b83f78 75 #ifdef BL652
nfathurr 34:029fc3b83f78 76 #include "ble_interface/bl652.h"
nfathurr 34:029fc3b83f78 77 #endif
kevin1990 15:78f3f517417f 78
nfathurr 34:029fc3b83f78 79 /*BLE COMMAND
nfathurr 34:029fc3b83f78 80 * REQ_REG_PACKET_COUNT = 0x21, //'!'
nfathurr 34:029fc3b83f78 81 * REQ_REG_PACKETS = 0x40, //'@'
nfathurr 34:029fc3b83f78 82 * REQ_FIELD_NAMES = 0x23, //'#'
nfathurr 34:029fc3b83f78 83 * START_STREAM = 0x24, //'$'
nfathurr 34:029fc3b83f78 84 * STOP_STREAM = 0x25, //'%'
nfathurr 34:029fc3b83f78 85 */
nfathurr 35:853be4d80ff3 86 //error log
nfathurr 35:853be4d80ff3 87 /*
nfathurr 35:853be4d80ff3 88 [INFO] Resetting ADI Sense device, please wait...
nfathurr 35:853be4d80ff3 89 [INFO] ADI Sense device ready
nfathurr 35:853be4d80ff3 90 [INFO] Setting device configuration
nfathurr 35:853be4d80ff3 91 [INFO] Assembling LUT data
nfathurr 35:853be4d80ff3 92 [INFO] Setting LUT data
nfathurr 35:853be4d80ff3 93 [INFO] Status Summary:
nfathurr 35:853be4d80ff3 94 [INFO] Active Errors - RESET REQUIRED
nfathurr 35:853be4d80ff3 95 [INFO] Active Errors - ATTENTION REQUIRED
nfathurr 35:853be4d80ff3 96 [INFO] Last Error Code: 306 (0x132)
nfathurr 35:853be4d80ff3 97 [INFO] No diagnostics faults detected
nfathurr 35:853be4d80ff3 98 [INFO] Configuration completed, starting measurement cycles
nfathurr 35:853be4d80ff3 99 */
nfathurr 35:853be4d80ff3 100
nfathurr 35:853be4d80ff3 101 extern ADI_SENSE_CONNECTION connectionInfo;
nfathurr 35:853be4d80ff3 102
nfathurr 35:853be4d80ff3 103 /*
nfathurr 35:853be4d80ff3 104 //normal routine for debugging
nfathurr 35:853be4d80ff3 105 int main()
nfathurr 35:853be4d80ff3 106 {
nfathurr 35:853be4d80ff3 107 ADI_SENSE_RESULT res;
nfathurr 35:853be4d80ff3 108 ADI_SENSE_STATUS status;
nfathurr 35:853be4d80ff3 109 ADI_SENSE_DEVICE_HANDLE hDevice;
nfathurr 35:853be4d80ff3 110 ADI_SENSE_MEASUREMENT_MODE eMeasurementMode = ADI_SENSE_MEASUREMENT_MODE_NORMAL;
nfathurr 35:853be4d80ff3 111 bool_t bDeviceReady;
nfathurr 35:853be4d80ff3 112
nfathurr 35:853be4d80ff3 113
nfathurr 35:853be4d80ff3 114 //Open an ADI Sense device instance.
nfathurr 35:853be4d80ff3 115
nfathurr 35:853be4d80ff3 116 res = adi_sense_Open(0, &connectionInfo, &hDevice);
nfathurr 35:853be4d80ff3 117 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 118 {
nfathurr 35:853be4d80ff3 119 ADI_SENSE_LOG_ERROR("Failed to open device instance");
nfathurr 35:853be4d80ff3 120 return res;
nfathurr 35:853be4d80ff3 121 }
nfathurr 35:853be4d80ff3 122
nfathurr 35:853be4d80ff3 123
nfathurr 35:853be4d80ff3 124 //Reset the given ADI Sense device....
nfathurr 35:853be4d80ff3 125
nfathurr 35:853be4d80ff3 126 ADI_SENSE_LOG_INFO("Resetting ADI Sense device, please wait...");
nfathurr 35:853be4d80ff3 127 res = adi_sense_Reset(hDevice);
nfathurr 35:853be4d80ff3 128 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 129 {
nfathurr 35:853be4d80ff3 130 ADI_SENSE_LOG_ERROR("Failed to reset device");
nfathurr 35:853be4d80ff3 131 return res;
nfathurr 35:853be4d80ff3 132 }
nfathurr 35:853be4d80ff3 133
nfathurr 35:853be4d80ff3 134 // ...and wait until the device is ready.
nfathurr 35:853be4d80ff3 135
nfathurr 35:853be4d80ff3 136 do {
nfathurr 35:853be4d80ff3 137 wait_ms(100);
nfathurr 35:853be4d80ff3 138 res = adi_sense_GetDeviceReadyState(hDevice, &bDeviceReady);
nfathurr 35:853be4d80ff3 139 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 140 {
nfathurr 35:853be4d80ff3 141 ADI_SENSE_LOG_ERROR("Failed to get device ready-state");
nfathurr 35:853be4d80ff3 142 return res;
nfathurr 35:853be4d80ff3 143 }
nfathurr 35:853be4d80ff3 144 } while (! bDeviceReady);
nfathurr 35:853be4d80ff3 145 ADI_SENSE_LOG_INFO("ADI Sense device ready");
nfathurr 35:853be4d80ff3 146
nfathurr 35:853be4d80ff3 147
nfathurr 35:853be4d80ff3 148 // Write configuration settings to the device registers.
nfathurr 35:853be4d80ff3 149 // Settings are not applied until adi_sense_ApplyConfigUpdates() is called.
nfathurr 35:853be4d80ff3 150
nfathurr 35:853be4d80ff3 151 ADI_SENSE_LOG_INFO("Setting device configuration");
nfathurr 35:853be4d80ff3 152 res = adi_sense_SetConfig(hDevice, pSelectedConfig);
nfathurr 35:853be4d80ff3 153 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 154 {
nfathurr 35:853be4d80ff3 155 ADI_SENSE_LOG_ERROR("Failed to set device configuration");
nfathurr 35:853be4d80ff3 156 return res;
nfathurr 35:853be4d80ff3 157 }
nfathurr 35:853be4d80ff3 158
nfathurr 35:853be4d80ff3 159 unsigned lutBufferSize = ADI_SENSE_LUT_MAX_SIZE;
nfathurr 35:853be4d80ff3 160 ADI_SENSE_1000_LUT *pLutBuffer = (ADI_SENSE_1000_LUT *) ::operator new (lutBufferSize);
nfathurr 35:853be4d80ff3 161 if (pLutBuffer == NULL)
nfathurr 35:853be4d80ff3 162 {
nfathurr 35:853be4d80ff3 163 ADI_SENSE_LOG_ERROR("Failed to allocate memory for user-defined LUT data buffer");
nfathurr 35:853be4d80ff3 164 return ADI_SENSE_NO_MEM;
nfathurr 35:853be4d80ff3 165 }
nfathurr 35:853be4d80ff3 166
nfathurr 35:853be4d80ff3 167 ADI_SENSE_LOG_INFO("Assembling LUT data");
nfathurr 35:853be4d80ff3 168 res = adi_sense_1000_AssembleLutData(pLutBuffer, lutBufferSize,
nfathurr 35:853be4d80ff3 169 sample_lut_num_tables,
nfathurr 35:853be4d80ff3 170 sample_lut_desc_list,
nfathurr 35:853be4d80ff3 171 sample_lut_data_list);
nfathurr 35:853be4d80ff3 172 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 173 {
nfathurr 35:853be4d80ff3 174 ADI_SENSE_LOG_ERROR("Failed to assemble user-defined LUT data");
nfathurr 35:853be4d80ff3 175 return res;
nfathurr 35:853be4d80ff3 176 }
nfathurr 35:853be4d80ff3 177
nfathurr 35:853be4d80ff3 178
nfathurr 35:853be4d80ff3 179 // Write assembled user-defined Look-Up Table data structure to the device
nfathurr 35:853be4d80ff3 180 // User-defined LUT data is not applied until adi_sense_ApplyConfigUpdates() is called.
nfathurr 35:853be4d80ff3 181
nfathurr 35:853be4d80ff3 182 ADI_SENSE_LOG_INFO("Setting LUT data");
nfathurr 35:853be4d80ff3 183 res = adi_sense_1000_SetLutData(hDevice, pLutBuffer);
nfathurr 35:853be4d80ff3 184 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 185 {
nfathurr 35:853be4d80ff3 186 ADI_SENSE_LOG_ERROR("Failed to set user-defined LUT data");
nfathurr 35:853be4d80ff3 187 return res;
nfathurr 35:853be4d80ff3 188 }
nfathurr 35:853be4d80ff3 189
nfathurr 35:853be4d80ff3 190 delete pLutBuffer;
nfathurr 35:853be4d80ff3 191
nfathurr 35:853be4d80ff3 192
nfathurr 35:853be4d80ff3 193 res = adi_sense_ApplyConfigUpdates(hDevice);
nfathurr 35:853be4d80ff3 194 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 195 {
nfathurr 35:853be4d80ff3 196 ADI_SENSE_LOG_ERROR("Failed to apply device configuration");
nfathurr 35:853be4d80ff3 197 return res;
nfathurr 35:853be4d80ff3 198 }
nfathurr 35:853be4d80ff3 199
nfathurr 35:853be4d80ff3 200 //Check device status after updating the configuration
nfathurr 35:853be4d80ff3 201
nfathurr 35:853be4d80ff3 202 res = adi_sense_GetStatus(hDevice, &status);
nfathurr 35:853be4d80ff3 203 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 204 {
nfathurr 35:853be4d80ff3 205 ADI_SENSE_LOG_ERROR("Failed to retrieve device status");
nfathurr 35:853be4d80ff3 206 return res;
nfathurr 35:853be4d80ff3 207 }
nfathurr 35:853be4d80ff3 208 if (status.deviceStatus &
nfathurr 35:853be4d80ff3 209 (ADI_SENSE_DEVICE_STATUS_ERROR | ADI_SENSE_DEVICE_STATUS_ALERT))
nfathurr 35:853be4d80ff3 210 {
nfathurr 35:853be4d80ff3 211 utils_printStatus(&status);
nfathurr 35:853be4d80ff3 212 }
nfathurr 35:853be4d80ff3 213
nfathurr 35:853be4d80ff3 214
nfathurr 35:853be4d80ff3 215 //Kick off the measurement cycle here
nfathurr 35:853be4d80ff3 216
nfathurr 35:853be4d80ff3 217 ADI_SENSE_LOG_INFO("Configuration completed, starting measurement cycles");
nfathurr 35:853be4d80ff3 218 utils_runMeasurement(hDevice, eMeasurementMode);
nfathurr 35:853be4d80ff3 219
nfathurr 35:853be4d80ff3 220
nfathurr 35:853be4d80ff3 221 //Clean up and exit
nfathurr 35:853be4d80ff3 222
nfathurr 35:853be4d80ff3 223 res = adi_sense_Close(hDevice);
nfathurr 35:853be4d80ff3 224 if (res != ADI_SENSE_SUCCESS)
nfathurr 35:853be4d80ff3 225 {
nfathurr 35:853be4d80ff3 226 ADI_SENSE_LOG_ERROR("Failed to close device instance");
nfathurr 35:853be4d80ff3 227 return res;
nfathurr 35:853be4d80ff3 228 }
nfathurr 35:853be4d80ff3 229
nfathurr 35:853be4d80ff3 230 return 0;
nfathurr 35:853be4d80ff3 231 }
nfathurr 35:853be4d80ff3 232 */
nfathurr 35:853be4d80ff3 233
kevin1990 15:78f3f517417f 234
nfathurr 34:029fc3b83f78 235 int main( void )
nfathurr 34:029fc3b83f78 236 {
nfathurr 34:029fc3b83f78 237 int ret = 1;
nfathurr 34:029fc3b83f78 238 bool bleActive;
nfathurr 34:029fc3b83f78 239
nfathurr 34:029fc3b83f78 240 // Indicate device is booting
nfathurr 34:029fc3b83f78 241 Led_Boot();
nfathurr 34:029fc3b83f78 242
nfathurr 34:029fc3b83f78 243 // Check if device needs to enter bootloader function, this is set via a PC command
nfathurr 34:029fc3b83f78 244 // Flag is stored in RTC registers that persist while vbat is powered
nfathurr 34:029fc3b83f78 245 bool_t bBootLoader = Rcc_ReadBackupReg( BOOTLOADER_FLAG_BACKUP_REG ) == 1 ? true : false;
nfathurr 34:029fc3b83f78 246
nfathurr 34:029fc3b83f78 247 if( bBootLoader ) {
nfathurr 34:029fc3b83f78 248
nfathurr 34:029fc3b83f78 249 // Let user know device is entering bootloader mode
nfathurr 34:029fc3b83f78 250 Pc_ResetSuccess( bBootLoader );
nfathurr 34:029fc3b83f78 251
nfathurr 34:029fc3b83f78 252 // Jump to bootloader
nfathurr 34:029fc3b83f78 253 Bootloader_Init();
kevin1990 15:78f3f517417f 254 }
RGurav 33:640b6bebda17 255
nfathurr 34:029fc3b83f78 256 // Otherwise, boot main program
nfathurr 34:029fc3b83f78 257
nfathurr 34:029fc3b83f78 258 // Boot the adisense1000 to a known state
nfathurr 34:029fc3b83f78 259 ret = Adisense1000_Boot();
nfathurr 34:029fc3b83f78 260 bool adiSense1000Active = !ret;
nfathurr 34:029fc3b83f78 261
nfathurr 34:029fc3b83f78 262 #ifdef BL652
nfathurr 34:029fc3b83f78 263 //boot BLE device
nfathurr 34:029fc3b83f78 264 ret = Bl652_Boot();
nfathurr 34:029fc3b83f78 265 if (ret == 0) {
nfathurr 34:029fc3b83f78 266 ADI_SENSE_LOG_INFO("BLE Boot success..");
nfathurr 34:029fc3b83f78 267 } else {
nfathurr 34:029fc3b83f78 268 ADI_SENSE_LOG_INFO("BLE Boot unsuccessful..");
nfathurr 34:029fc3b83f78 269 }
nfathurr 34:029fc3b83f78 270 #endif
RGurav 33:640b6bebda17 271
nfathurr 34:029fc3b83f78 272 // Set if ble is present or not
nfathurr 34:029fc3b83f78 273 // If not, the PC interface can still be initialised
nfathurr 34:029fc3b83f78 274 bleActive = !ret;
RGurav 33:640b6bebda17 275
nfathurr 34:029fc3b83f78 276 // Check adisense has booted correctly
nfathurr 34:029fc3b83f78 277 if( adiSense1000Active ) {
nfathurr 34:029fc3b83f78 278 Pc_ResetSuccess( bBootLoader );
nfathurr 35:853be4d80ff3 279 ADI_SENSE_LOG_INFO("ADIsense boot successful 25/09/2018");
nfathurr 34:029fc3b83f78 280 ADI_SENSE_LOG_INFO("Firmware Version 2.1");
nfathurr 35:853be4d80ff3 281 ADI_SENSE_LOG_INFO("\t Available BLE COMMANDS:");
nfathurr 34:029fc3b83f78 282 ADI_SENSE_LOG_INFO("REQ_REG_PACKET_COUNT = 0x21, //'!'");
nfathurr 34:029fc3b83f78 283 ADI_SENSE_LOG_INFO("REQ_REG_PACKETS = 0x40, //'@'");
nfathurr 34:029fc3b83f78 284 ADI_SENSE_LOG_INFO("REQ_FIELD_NAMES = 0x23 0x0, //'#'");
nfathurr 34:029fc3b83f78 285 ADI_SENSE_LOG_INFO("START_STREAM = 0x24, //'$'");
nfathurr 34:029fc3b83f78 286 ADI_SENSE_LOG_INFO("STOP_STREAM = 0x25, //'percentage symbol'");
nfathurr 35:853be4d80ff3 287 ADI_SENSE_LOG_INFO(" ");
nfathurr 35:853be4d80ff3 288 ADI_SENSE_LOG_INFO("\t Available PC COMMANDS:");
nfathurr 35:853be4d80ff3 289 ADI_SENSE_LOG_INFO("DEVICE_INFO = 'i'");
nfathurr 35:853be4d80ff3 290 ADI_SENSE_LOG_INFO("FLASH_LED = 'f'");
nfathurr 35:853be4d80ff3 291 ADI_SENSE_LOG_INFO("RESET = 'r'");
nfathurr 35:853be4d80ff3 292 ADI_SENSE_LOG_INFO("CONFIGURE = 'c'");
nfathurr 35:853be4d80ff3 293 ADI_SENSE_LOG_INFO("APPLY = 'u'");
nfathurr 35:853be4d80ff3 294 ADI_SENSE_LOG_INFO("SAMPLE = 's'");
nfathurr 35:853be4d80ff3 295 ADI_SENSE_LOG_INFO("START_STREAM = 'd'");
nfathurr 35:853be4d80ff3 296 ADI_SENSE_LOG_INFO("STOP_STREAM = 'h'");
nfathurr 35:853be4d80ff3 297 ADI_SENSE_LOG_INFO("UPDATE_FW_VERSION = 'v'");
kevin1990 15:78f3f517417f 298 }
nfathurr 34:029fc3b83f78 299 else {
nfathurr 34:029fc3b83f78 300 // Cannot continue without adi_sense module
nfathurr 34:029fc3b83f78 301 exit( 1 );
kevin1990 28:4eb837cd71df 302 }
nfathurr 34:029fc3b83f78 303
nfathurr 34:029fc3b83f78 304 // Set led on to indicate boot has completed
nfathurr 34:029fc3b83f78 305
nfathurr 34:029fc3b83f78 306 ADI_SENSE_LOG_INFO("Set LED Idle...");
nfathurr 34:029fc3b83f78 307 Led_Idle();
nfathurr 34:029fc3b83f78 308
nfathurr 34:029fc3b83f78 309 // Begin main program
nfathurr 34:029fc3b83f78 310 ADI_SENSE_LOG_INFO("Begin main program...");
nfathurr 34:029fc3b83f78 311 while(1) {
nfathurr 34:029fc3b83f78 312 // Read in a command and handle appropriately
nfathurr 34:029fc3b83f78 313 ret = MyProSwift_Command( bleActive );
nfathurr 34:029fc3b83f78 314 if( ret != 0 ) {
nfathurr 34:029fc3b83f78 315 // Errors should be handled at lower levels, using reponse codes
nfathurr 34:029fc3b83f78 316 // to the appropriate active interface
nfathurr 34:029fc3b83f78 317 // exit(1);
nfathurr 34:029fc3b83f78 318 }
nfathurr 34:029fc3b83f78 319 }
nfathurr 34:029fc3b83f78 320 }
kevin1990 15:78f3f517417f 321