| ISF 2.2 rev 5 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

App1.c
Go to the documentation of this file.
1 /* ###################################################################
2 ** This component module is generated by Processor Expert. Do not modify it.
3 ** Filename : App1.c
4 ** CDE edition : Standard
5 ** Project : ISF2P2_K64F_MQX_PROJ
6 ** Processor : MK64FN1M0VLL12
7 ** Component : ISF_KSDK_EmbApp
8 ** Version : Component 02.500, Driver 02.00, CPU db: 3.00.000
9 ** Repository : My Components
10 ** Compiler : GNU C Compiler
11 ** Date/Time : 2016-10-06, 13:38, # CodeGen: 0
12 ** Abstract :
13 **
14 ** Settings :
15 ** Component Name : App1
16 ** Main Application Settings :
17 ** App ID : 2
18 ** Sensor Signalling Method : AnySensor
19 ** Processed Data Buffer Size : 34
20 ** App Control Register :
21 ** Initial Power : Normal Power
22 ** Quick Read Output Enabled : no
23 ** Initial State : STOPPED_UNSUBSCRIBED
24 ** Application Version Number : 0100
25 ** Additional User-Defined App Info :
26 ** Host Interface :
27 ** Host Command Interface Supported : yes
28 ** User Defined Host Commands : 0
29 ** ISF_Core : ISFCore1
30 ** App Task Priority : 11
31 ** App Task Stack Size : 1200
32 ** Subscription List : 20
33 ** Sensor Subscription :
34 ** Sensor Type : Accelerometer
35 ** Selected Sensor : FXLC95000_1
36 ** Settings To Use : UseGiven
37 ** Sample Period : 10000
38 ** Sensor Data Format : Raw Sensor Format
39 ** Sensor Data Type : Native Sensor Output
40 ** FIFO Depth : 1
41 ** Sensor Subscription :
42 ** Sensor Type : Accelerometer
43 ** Selected Sensor : FXLC95000_2
44 ** Settings To Use : UseGiven
45 ** Sample Period : 10000
46 ** Sensor Data Format : Raw Sensor Format
47 ** Sensor Data Type : Native Sensor Output
48 ** FIFO Depth : 1
49 ** Sensor Subscription :
50 ** Sensor Type : Accelerometer
51 ** Selected Sensor : FXLS8471_1
52 ** Settings To Use : UseGiven
53 ** Sample Period : 10000
54 ** Sensor Data Format : Raw Sensor Format
55 ** Sensor Data Type : Native Sensor Output
56 ** FIFO Depth : 1
57 ** Sensor Subscription :
58 ** Sensor Type : Accelerometer
59 ** Selected Sensor : FXLS8471_2
60 ** Settings To Use : UseGiven
61 ** Sample Period : 10000
62 ** Sensor Data Format : Raw Sensor Format
63 ** Sensor Data Type : Native Sensor Output
64 ** FIFO Depth : 1
65 ** Sensor Subscription :
66 ** Sensor Type : Accelerometer
67 ** Selected Sensor : FXLS8952_1
68 ** Settings To Use : UseGiven
69 ** Sample Period : 10000
70 ** Sensor Data Format : Raw Sensor Format
71 ** Sensor Data Type : Native Sensor Output
72 ** FIFO Depth : 1
73 ** Sensor Subscription :
74 ** Sensor Type : Accelerometer
75 ** Selected Sensor : FXOS8700_1
76 ** Settings To Use : UseGiven
77 ** Sample Period : 10000
78 ** Sensor Data Format : Raw Sensor Format
79 ** Sensor Data Type : Native Sensor Output
80 ** FIFO Depth : 1
81 ** Sensor Subscription :
82 ** Sensor Type : Accelerometer
83 ** Selected Sensor : MMA8491Q_1
84 ** Settings To Use : UseGiven
85 ** Sample Period : 10000
86 ** Sensor Data Format : Raw Sensor Format
87 ** Sensor Data Type : Native Sensor Output
88 ** FIFO Depth : 1
89 ** Sensor Subscription :
90 ** Sensor Type : Accelerometer
91 ** Selected Sensor : MMA865x_1
92 ** Settings To Use : UseGiven
93 ** Sample Period : 10000
94 ** Sensor Data Format : Raw Sensor Format
95 ** Sensor Data Type : Native Sensor Output
96 ** FIFO Depth : 1
97 ** Sensor Subscription :
98 ** Sensor Type : Magnetometer
99 ** Selected Sensor : FXOS8700_2
100 ** Settings To Use : UseGiven
101 ** Sample Period : 10000
102 ** Sensor Data Format : Raw Sensor Format
103 ** Sensor Data Type : Native Sensor Output
104 ** FIFO Depth : 1
105 ** Sensor Subscription :
106 ** Sensor Type : Magnetometer
107 ** Selected Sensor : MAG3110_1
108 ** Settings To Use : UseGiven
109 ** Sample Period : 200000
110 ** Sensor Data Format : Raw Sensor Format
111 ** Sensor Data Type : Native Sensor Output
112 ** FIFO Depth : 1
113 ** Sensor Subscription :
114 ** Sensor Type : Gyrometer
115 ** Selected Sensor : FXAS21002_1
116 ** Settings To Use : UseGiven
117 ** Sample Period : 10000
118 ** Sensor Data Format : Raw Sensor Format
119 ** Sensor Data Type : Native Sensor Output
120 ** FIFO Depth : 1
121 ** Sensor Subscription :
122 ** Sensor Type : Gyrometer
123 ** Selected Sensor : FXAS21002_2
124 ** Settings To Use : UseGiven
125 ** Sample Period : 10000
126 ** Sensor Data Format : Raw Sensor Format
127 ** Sensor Data Type : Native Sensor Output
128 ** FIFO Depth : 1
129 ** Sensor Subscription :
130 ** Sensor Type : Pressure
131 ** Selected Sensor : MPL3115_1
132 ** Settings To Use : UseGiven
133 ** Sample Period : 10000
134 ** Sensor Data Format : Raw Sensor Format
135 ** Sensor Data Type : Native Sensor Output
136 ** FIFO Depth : 1
137 ** Sensor Subscription :
138 ** Sensor Type : Temperature
139 ** Selected Sensor : MPL3115_1
140 ** Settings To Use : UseGiven
141 ** Sample Period : 10000
142 ** Sensor Data Format : Raw Sensor Format
143 ** Sensor Data Type : Native Sensor Output
144 ** FIFO Depth : 1
145 ** Sensor Subscription :
146 ** Sensor Type : Orientation
147 ** Selected Sensor : ORIENT_1
148 ** Settings To Use : UseGiven
149 ** Sample Period : 10000
150 ** Sensor Data Format : Raw Sensor Format
151 ** Sensor Data Type : Native Sensor Output
152 ** FIFO Depth : 1
153 ** Sensor Subscription :
154 ** Sensor Type : Altitude
155 ** Selected Sensor : MPL3115_1
156 ** Settings To Use : UseGiven
157 ** Sample Period : 10000
158 ** Sensor Data Format : Raw Sensor Format
159 ** Sensor Data Type : Native Sensor Output
160 ** FIFO Depth : 1
161 ** Sensor Subscription :
162 ** Sensor Type : Pedometer
163 ** Selected Sensor : MMA955x_1
164 ** Settings To Use : UseGiven
165 ** Sample Period : 8192
166 ** Sensor Data Format : Raw Sensor Format
167 ** Sensor Data Type : Native Sensor Output
168 ** FIFO Depth : 1
169 ** Sensor Subscription :
170 ** Sensor Type : Pedometer
171 ** Selected Sensor : MMA955x_2
172 ** Settings To Use : UseGiven
173 ** Sample Period : 8192
174 ** Sensor Data Format : Raw Sensor Format
175 ** Sensor Data Type : Native Sensor Output
176 ** FIFO Depth : 1
177 ** Sensor Subscription :
178 ** Sensor Type : Custom
179 ** Selected Sensor : Custom_1
180 ** Settings To Use : UseGiven
181 ** Sample Period : 10000
182 ** Sensor Data Format : Raw Sensor Format
183 ** Sensor Data Type : Native Sensor Output
184 ** FIFO Depth : 1
185 ** Sensor Subscription :
186 ** Sensor Type : Analog
187 ** Selected Sensor : Analog_1
188 ** Settings To Use : UseGiven
189 ** Sample Period : 10000
190 ** Sensor Data Format : Raw Sensor Format
191 ** Sensor Data Type : Native Sensor Output
192 ** FIFO Depth : 1
193 ** Contents :
194 ** No public methods
195 **
196 ** (c) Copyright Freescale Semiconductor, Inc., 2015,
197 **
198 http://www.freescale.com
199 ** ###################################################################*/
200 /*!
201 ** @file App1.c
202 ** @version 02.00
203 ** @brief
204 **
205 */
206 /*!
207 ** @addtogroup App1_module App1 module documentation
208 ** @{
209 */
210
211 /* MODULE App1. */
212
213 #include "App1_Functions.h"
214 #include "App1.h"
215 #include "App1_types.h"
216
217 /* MQX includes */
218
219 /* ISF includes */
220 #include "isf_target.h"
221 #include "isf_types.h"
222 #include "isf.h"
223 #include "isf_init.h"
224 #include "isf_ci.h"
225 #include "isf_ci_stream.h"
226 #include "isf_sm_types.h"
227 #include "fsl_os_abstraction.h"
228 #include "isf_util.h"
229 #include "isf_dsa_direct.h"
230 #include "isf_pm.h"
231 #include "Events.h"
232 #include "isf_sensor_configuration.h"
233 #include "isf_sensor_configuration_extern.h"
234
235 /* Task1 task name */
236 #define App1_TASK_NAME "App1_task"
237 /* Task1 task stack size */
238 #define App1_TASK_STACK_SIZE 1200
239 /* Task1 task priority value */
240 #define App1_TASK_PRIORITY 11
241 OSA_TASK_DEFINE(App1, App1_TASK_STACK_SIZE);
242
243 /* App Info Structure returned by the CI_CMD_READ_APP_VERSION command */
244 static const App1_app_info_t gsApp1_AppInfo = {
245 .appType = ISF_EMB_APP,
246 .version_info = 0x0100,
247 .numBytes = sizeof(App1_APP_DATA),
248 .appData = App1_APP_DATA
249 };
250
251 /* Generic sensor interfaces */
252 #include "isf_accelerometer_types.h"
253 #include "isf_accelerometer_types.h"
254 #include "isf_accelerometer_types.h"
255 #include "isf_accelerometer_types.h"
256 #include "isf_accelerometer_types.h"
257 #include "isf_accelerometer_types.h"
258 #include "isf_accelerometer_types.h"
259 #include "isf_accelerometer_types.h"
260 #include "isf_magnetometer_types.h"
261 #include "isf_magnetometer_types.h"
262 #include "isf_gyrometer_types.h"
263 #include "isf_gyrometer_types.h"
264 #include "isf_pressure_types.h"
265 #include "isf_temperature_types.h"
266 #include "isf_orientation_types.h"
267 #include "isf_altitude_types.h"
268 #include "isf_pedometer_types.h"
269 #include "isf_pedometer_types.h"
270 #include "fsl_Sensor_Custom_1_Functions.h"
271 #include "fsl_Sensor_Analog_1_Functions.h"
272
273 /* Structure offset calculation macros */
274 #define startof(type,member) ((int32)&((type *)0)->member)
275
276 /*! @brief Macro thats holds number of active sensors. */
277 #define NUM_SENSORS (sizeof(App1AppInstance.info)/sizeof(SensorInfo_t))
278
279 /*! @brief Macro that extracts one of the fields below. */
280 #define SET_FIELD(name,val) (((val)<<name##_SHIFT)&(name##_MASK))
281 #define GET_FIELD(name,val) ((val&name##_MASK)>>name##_SHIFT)
282
283 /*! @brief Control register mask/shift definitions for the application. */
284 #define CTRL_STATE_MASK 0x0F
285 #define CTRL_STATE_SHIFT 0
286 #define CTRL_QREN_MASK 0x10
287 #define CTRL_QREN_SHIFT 4
288 #define CTRL_RESET_MASK 0x20
289 #define CTRL_RESET_SHIFT 5
290 #define CTRL_POWER_MASK 0xC0
291 #define CTRL_POWER_SHIFT 6
292
293 /******************************************************
294 * Global Variables
295 *****************************************************/
296
297 /* Generate the initial default configuration statically for now.
298 Eventually this data should partially come from the actual sensor
299 components */
300 App1AppInstance_t App1AppInstance = {
301 .instance.appId = 2,
302 .settings.control = SET_FIELD(CTRL_STATE,App1_STATE_STOPPED_UNSUBSCRIBED) | SET_FIELD(CTRL_POWER,1) | SET_FIELD(CTRL_QREN,0),
303 .info.AccelerometerInfo_Sub0.sensorId = DSA_FXLC95000_1,
304 .info.AccelerometerInfo_Sub1.sensorId = DSA_FXLC95000_2,
305 .info.AccelerometerInfo_Sub2.sensorId = DSA_FXLS8471_1,
306 .info.AccelerometerInfo_Sub3.sensorId = DSA_FXLS8471_2,
307 .info.AccelerometerInfo_Sub4.sensorId = DSA_FXLS8952_1,
308 .info.AccelerometerInfo_Sub5.sensorId = DSA_FXOS8700_1,
309 .info.AccelerometerInfo_Sub6.sensorId = DSA_MMA8491Q_1,
310 .info.AccelerometerInfo_Sub7.sensorId = DSA_MMA865x_1,
311 .info.MagnetometerInfo_Sub8.sensorId = DSA_FXOS8700_2,
312 .info.MagnetometerInfo_Sub9.sensorId = DSA_MAG3110_1,
313 .info.GyrometerInfo_Sub10.sensorId = DSA_FXAS21002_1,
314 .info.GyrometerInfo_Sub11.sensorId = DSA_FXAS21002_2,
315 .info.PressureInfo_Sub12.sensorId = DSA_MPL3115_1,
316 .info.TemperatureInfo_Sub13.sensorId = DSA_MPL3115_1,
317 .info.OrientationInfo_Sub14.sensorId = DSA_ORIENT_1,
318 .info.AltitudeInfo_Sub15.sensorId = DSA_MPL3115_1,
319 .info.PedometerInfo_Sub16.sensorId = DSA_MMA955x_1,
320 .info.PedometerInfo_Sub17.sensorId = DSA_MMA955x_2,
321 .info.CustomInfo_Sub18.sensorId = DSA_Custom_1,
322 .info.AnalogInfo_Sub19.sensorId = DSA_Analog_1,
323 };
324
325 /*!
326 * @struct subscriptionConfig_t
327 * @brief This structure holds the sensor subscriptions configuration info.
328 *
329 */
330 typedef struct {
331 uint8 sensorId;
332 isf_SensorDataTypes_t sensorDataType;
333 isf_dsa_result_types_t sensorResultType;
334 uint16 sampleRateOffset;
335 } subscriptionConfig_t;
336
337 /* Attempts to match the App1AppSettings_t array layout in order to compute the Subscription settings offset only*/
338 /* Not actually used to hold any real information */
339 typedef struct {
340 uint8 control;
341 isf_SubscriptionSettings_t subArray[NUM_SENSORS];
342 } pseudoSettings_t;
343
344 /*!
345 * @struct appSubscriptionResponse_t
346 * @brief This structure holds the ISF application subscriptions information
347 * in the "GET_APP_SUBSCRIPTION" CI command response buffer.
348 *
349 */
350 #pragma pack(push,1)
351 typedef struct {
352 uint8 numSensors;
353 uint16 processedDataBufferOffset;
354 subscriptionConfig_t configArray[NUM_SENSORS];
355 } appSubscriptionResponse_t;
356 #pragma pack(pop)
357
358
359 /******************************************************
360 * Function Prototypes
361 *****************************************************/
362 int32 App1_GotoState(uint8 desiredState);
363 static int8 App1_FlashSensor(uint8 numBytes, uint8 *pFlashData);
364 static int32 SettingsCompare(const isf_SubscriptionSettings_t *s1, const isf_SubscriptionSettings_t *s2);
365 static int32 SmSettingsCompare(const App1AppSettings_t *s1, const App1AppSettings_t *s2);
366
367
368 /*
369 ** ===================================================================
370 ** Method : App1_Task()
371 **
372 ** Description :
373 ** inititialize the app task
374 ** Parameters : None.
375 ** Returns : None.
376 ** ===================================================================
377 */
378 void App1_task(os_task_param_t task_init_data)
379 {
380 // Waiting for the system synchronisation.
381 // ISF initialization.
382 isf_lib_init(0);
383 isf_system_sync();
384 App1_MainTask();
385 }
386
387 /*
388 ** ===================================================================
389 ** Method : d App1_init
390 **
391 ** Description :
392 ** start the task
393 ** Parameters : None.
394 ** Returns : None.
395 ** ===================================================================
396 */
397 void App1_init(void)
398 {
399 // Create the Application Task
400 OSA_TaskCreate(App1_task, /* The task function entry */
401 (uint8_t *)App1_TASK_NAME, /* The name of this task */
402 App1_TASK_STACK_SIZE, /* The stack size in byte */
403 App1_stack, /* Pointer to the stack */
404 App1_TASK_PRIORITY, /* Initial priority of the task */
405 (task_param_t)(NULL), /* Pointer to be passed to the task when it is created */
406 false, /* This task will use not float register */
407 &App1_task_handler); /* Pointer to the task handler */
408 }
409
410 /*
411 ** ===================================================================
412 ** Method : App1_MainTask()
413 **
414 ** Description :
415 ** The method functions as the main task for the Embedded Application.
416 ** The method initializes the Embedded Application global instance, calls the
417 ** user defined initialization, brings the selected subscriptions to a known state,
418 ** waits for raw sensor data as prescribed, calls the user defined data processing,
419 ** performs processed data output to the host interface. If the task should exit,
420 ** then it will call the user defined exit processing before the task is destroyed.
421 ** This method is internal. It is used by Processor Expert only.
422 ** Parameters : None.
423 ** Returns : None.
424 ** ===================================================================
425 */
426 void App1_MainTask(void) {
427 // User function for initialization.
428 App1_Initialization();
429
430 // Initialize the application instance.
431 App1AppInstance.info.AccelerometerInfo_Sub0.sensorId = DSA_FXLC95000_1;
432 App1AppInstance.settings.AccelerometerSettings_Sub0.resultType = 0;
433 App1AppInstance.settings.AccelerometerSettings_Sub0.resultFormat = 1;
434 App1AppInstance.settings.AccelerometerSettings_Sub0.nSamplePeriod = 10000;
435 App1AppInstance.settings.AccelerometerSettings_Sub0.nSettingsToUse = 2;
436 App1AppInstance.settings.AccelerometerSettings_Sub0.nFifoDepth = 1;
437 App1AppInstance.info.AccelerometerInfo_Sub1.sensorId = DSA_FXLC95000_2;
438 App1AppInstance.settings.AccelerometerSettings_Sub1.resultType = 0;
439 App1AppInstance.settings.AccelerometerSettings_Sub1.resultFormat = 1;
440 App1AppInstance.settings.AccelerometerSettings_Sub1.nSamplePeriod = 10000;
441 App1AppInstance.settings.AccelerometerSettings_Sub1.nSettingsToUse = 2;
442 App1AppInstance.settings.AccelerometerSettings_Sub1.nFifoDepth = 1;
443 App1AppInstance.info.AccelerometerInfo_Sub2.sensorId = DSA_FXLS8471_1;
444 App1AppInstance.settings.AccelerometerSettings_Sub2.resultType = 0;
445 App1AppInstance.settings.AccelerometerSettings_Sub2.resultFormat = 1;
446 App1AppInstance.settings.AccelerometerSettings_Sub2.nSamplePeriod = 10000;
447 App1AppInstance.settings.AccelerometerSettings_Sub2.nSettingsToUse = 2;
448 App1AppInstance.settings.AccelerometerSettings_Sub2.nFifoDepth = 1;
449 App1AppInstance.info.AccelerometerInfo_Sub3.sensorId = DSA_FXLS8471_2;
450 App1AppInstance.settings.AccelerometerSettings_Sub3.resultType = 0;
451 App1AppInstance.settings.AccelerometerSettings_Sub3.resultFormat = 1;
452 App1AppInstance.settings.AccelerometerSettings_Sub3.nSamplePeriod = 10000;
453 App1AppInstance.settings.AccelerometerSettings_Sub3.nSettingsToUse = 2;
454 App1AppInstance.settings.AccelerometerSettings_Sub3.nFifoDepth = 1;
455 App1AppInstance.info.AccelerometerInfo_Sub4.sensorId = DSA_FXLS8952_1;
456 App1AppInstance.settings.AccelerometerSettings_Sub4.resultType = 0;
457 App1AppInstance.settings.AccelerometerSettings_Sub4.resultFormat = 1;
458 App1AppInstance.settings.AccelerometerSettings_Sub4.nSamplePeriod = 10000;
459 App1AppInstance.settings.AccelerometerSettings_Sub4.nSettingsToUse = 2;
460 App1AppInstance.settings.AccelerometerSettings_Sub4.nFifoDepth = 1;
461 App1AppInstance.info.AccelerometerInfo_Sub5.sensorId = DSA_FXOS8700_1;
462 App1AppInstance.settings.AccelerometerSettings_Sub5.resultType = 0;
463 App1AppInstance.settings.AccelerometerSettings_Sub5.resultFormat = 1;
464 App1AppInstance.settings.AccelerometerSettings_Sub5.nSamplePeriod = 10000;
465 App1AppInstance.settings.AccelerometerSettings_Sub5.nSettingsToUse = 2;
466 App1AppInstance.settings.AccelerometerSettings_Sub5.nFifoDepth = 1;
467 App1AppInstance.info.AccelerometerInfo_Sub6.sensorId = DSA_MMA8491Q_1;
468 App1AppInstance.settings.AccelerometerSettings_Sub6.resultType = 0;
469 App1AppInstance.settings.AccelerometerSettings_Sub6.resultFormat = 1;
470 App1AppInstance.settings.AccelerometerSettings_Sub6.nSamplePeriod = 10000;
471 App1AppInstance.settings.AccelerometerSettings_Sub6.nSettingsToUse = 2;
472 App1AppInstance.settings.AccelerometerSettings_Sub6.nFifoDepth = 1;
473 App1AppInstance.info.AccelerometerInfo_Sub7.sensorId = DSA_MMA865x_1;
474 App1AppInstance.settings.AccelerometerSettings_Sub7.resultType = 0;
475 App1AppInstance.settings.AccelerometerSettings_Sub7.resultFormat = 1;
476 App1AppInstance.settings.AccelerometerSettings_Sub7.nSamplePeriod = 10000;
477 App1AppInstance.settings.AccelerometerSettings_Sub7.nSettingsToUse = 2;
478 App1AppInstance.settings.AccelerometerSettings_Sub7.nFifoDepth = 1;
479 App1AppInstance.info.MagnetometerInfo_Sub8.sensorId = DSA_FXOS8700_2;
480 App1AppInstance.settings.MagnetometerSettings_Sub8.resultType = 0;
481 App1AppInstance.settings.MagnetometerSettings_Sub8.resultFormat = 1;
482 App1AppInstance.settings.MagnetometerSettings_Sub8.nSamplePeriod = 10000;
483 App1AppInstance.settings.MagnetometerSettings_Sub8.nSettingsToUse = 2;
484 App1AppInstance.settings.MagnetometerSettings_Sub8.nFifoDepth = 1;
485 App1AppInstance.info.MagnetometerInfo_Sub9.sensorId = DSA_MAG3110_1;
486 App1AppInstance.settings.MagnetometerSettings_Sub9.resultType = 0;
487 App1AppInstance.settings.MagnetometerSettings_Sub9.resultFormat = 1;
488 App1AppInstance.settings.MagnetometerSettings_Sub9.nSamplePeriod = 200000;
489 App1AppInstance.settings.MagnetometerSettings_Sub9.nSettingsToUse = 2;
490 App1AppInstance.settings.MagnetometerSettings_Sub9.nFifoDepth = 1;
491 App1AppInstance.info.GyrometerInfo_Sub10.sensorId = DSA_FXAS21002_1;
492 App1AppInstance.settings.GyrometerSettings_Sub10.resultType = 0;
493 App1AppInstance.settings.GyrometerSettings_Sub10.resultFormat = 1;
494 App1AppInstance.settings.GyrometerSettings_Sub10.nSamplePeriod = 10000;
495 App1AppInstance.settings.GyrometerSettings_Sub10.nSettingsToUse = 2;
496 App1AppInstance.settings.GyrometerSettings_Sub10.nFifoDepth = 1;
497 App1AppInstance.info.GyrometerInfo_Sub11.sensorId = DSA_FXAS21002_2;
498 App1AppInstance.settings.GyrometerSettings_Sub11.resultType = 0;
499 App1AppInstance.settings.GyrometerSettings_Sub11.resultFormat = 1;
500 App1AppInstance.settings.GyrometerSettings_Sub11.nSamplePeriod = 10000;
501 App1AppInstance.settings.GyrometerSettings_Sub11.nSettingsToUse = 2;
502 App1AppInstance.settings.GyrometerSettings_Sub11.nFifoDepth = 1;
503 App1AppInstance.info.PressureInfo_Sub12.sensorId = DSA_MPL3115_1;
504 App1AppInstance.settings.PressureSettings_Sub12.resultType = 0;
505 App1AppInstance.settings.PressureSettings_Sub12.resultFormat = 1;
506 App1AppInstance.settings.PressureSettings_Sub12.nSamplePeriod = 10000;
507 App1AppInstance.settings.PressureSettings_Sub12.nSettingsToUse = 2;
508 App1AppInstance.settings.PressureSettings_Sub12.nFifoDepth = 1;
509 App1AppInstance.info.TemperatureInfo_Sub13.sensorId = DSA_MPL3115_1;
510 App1AppInstance.settings.TemperatureSettings_Sub13.resultType = 0;
511 App1AppInstance.settings.TemperatureSettings_Sub13.resultFormat = 1;
512 App1AppInstance.settings.TemperatureSettings_Sub13.nSamplePeriod = 10000;
513 App1AppInstance.settings.TemperatureSettings_Sub13.nSettingsToUse = 2;
514 App1AppInstance.settings.TemperatureSettings_Sub13.nFifoDepth = 1;
515 App1AppInstance.info.OrientationInfo_Sub14.sensorId = DSA_ORIENT_1;
516 App1AppInstance.settings.OrientationSettings_Sub14.resultType = 0;
517 App1AppInstance.settings.OrientationSettings_Sub14.resultFormat = 1;
518 App1AppInstance.settings.OrientationSettings_Sub14.nSamplePeriod = 10000;
519 App1AppInstance.settings.OrientationSettings_Sub14.nSettingsToUse = 2;
520 App1AppInstance.settings.OrientationSettings_Sub14.nFifoDepth = 1;
521 App1AppInstance.info.AltitudeInfo_Sub15.sensorId = DSA_MPL3115_1;
522 App1AppInstance.settings.AltitudeSettings_Sub15.resultType = 0;
523 App1AppInstance.settings.AltitudeSettings_Sub15.resultFormat = 1;
524 App1AppInstance.settings.AltitudeSettings_Sub15.nSamplePeriod = 10000;
525 App1AppInstance.settings.AltitudeSettings_Sub15.nSettingsToUse = 2;
526 App1AppInstance.settings.AltitudeSettings_Sub15.nFifoDepth = 1;
527 App1AppInstance.info.PedometerInfo_Sub16.sensorId = DSA_MMA955x_1;
528 App1AppInstance.settings.PedometerSettings_Sub16.resultType = 0;
529 App1AppInstance.settings.PedometerSettings_Sub16.resultFormat = 1;
530 App1AppInstance.settings.PedometerSettings_Sub16.nSamplePeriod = 8192;
531 App1AppInstance.settings.PedometerSettings_Sub16.nSettingsToUse = 2;
532 App1AppInstance.settings.PedometerSettings_Sub16.nFifoDepth = 1;
533 App1AppInstance.info.PedometerInfo_Sub17.sensorId = DSA_MMA955x_2;
534 App1AppInstance.settings.PedometerSettings_Sub17.resultType = 0;
535 App1AppInstance.settings.PedometerSettings_Sub17.resultFormat = 1;
536 App1AppInstance.settings.PedometerSettings_Sub17.nSamplePeriod = 8192;
537 App1AppInstance.settings.PedometerSettings_Sub17.nSettingsToUse = 2;
538 App1AppInstance.settings.PedometerSettings_Sub17.nFifoDepth = 1;
539 App1AppInstance.info.CustomInfo_Sub18.sensorId = DSA_Custom_1;
540 App1AppInstance.settings.CustomSettings_Sub18.resultType = 0;
541 App1AppInstance.settings.CustomSettings_Sub18.resultFormat = 1;
542 App1AppInstance.settings.CustomSettings_Sub18.nSamplePeriod = 10000;
543 App1AppInstance.settings.CustomSettings_Sub18.nSettingsToUse = 2;
544 App1AppInstance.settings.CustomSettings_Sub18.nFifoDepth = 1;
545 App1AppInstance.info.AnalogInfo_Sub19.sensorId = DSA_Analog_1;
546 App1AppInstance.settings.AnalogSettings_Sub19.resultType = 0;
547 App1AppInstance.settings.AnalogSettings_Sub19.resultFormat = 1;
548 App1AppInstance.settings.AnalogSettings_Sub19.nSamplePeriod = 10000;
549 App1AppInstance.settings.AnalogSettings_Sub19.nSettingsToUse = 2;
550 App1AppInstance.settings.AnalogSettings_Sub19.nFifoDepth = 1;
551
552 /* Initialize and clear the lwevent passed to the Sensor Manager as part
553 * of the subscription to the App1 Sensor Adapter. */
554 OSA_EventCreate(&App1AppInstance.instance.smLWEvent, kEventAutoClear);
555 OSA_EventClear(&App1AppInstance.instance.smLWEvent, 0x00FFFFFF);
556 /* Create the outputBufferLock used to prevent updates made while
557 * data is being read by the host. */
558 OSA_SemaCreate(&App1AppInstance.instance.outputBufferLock, 1);
559
560 // initialize the fifo using an explicitly provided data buffer
561 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub0, &App1AppInstance.data.rawAccelerometerData_Sub0, sizeof(DATA_TYPE_SUB0), DATA_FIFO_LEN_SUB0);
562 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub1, &App1AppInstance.data.rawAccelerometerData_Sub1, sizeof(DATA_TYPE_SUB1), DATA_FIFO_LEN_SUB1);
563 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub2, &App1AppInstance.data.rawAccelerometerData_Sub2, sizeof(DATA_TYPE_SUB2), DATA_FIFO_LEN_SUB2);
564 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub3, &App1AppInstance.data.rawAccelerometerData_Sub3, sizeof(DATA_TYPE_SUB3), DATA_FIFO_LEN_SUB3);
565 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub4, &App1AppInstance.data.rawAccelerometerData_Sub4, sizeof(DATA_TYPE_SUB4), DATA_FIFO_LEN_SUB4);
566 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub5, &App1AppInstance.data.rawAccelerometerData_Sub5, sizeof(DATA_TYPE_SUB5), DATA_FIFO_LEN_SUB5);
567 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub6, &App1AppInstance.data.rawAccelerometerData_Sub6, sizeof(DATA_TYPE_SUB6), DATA_FIFO_LEN_SUB6);
568 isf_fifo_init(&App1AppInstance.fifos.AccelerometerDataFifo_Sub7, &App1AppInstance.data.rawAccelerometerData_Sub7, sizeof(DATA_TYPE_SUB7), DATA_FIFO_LEN_SUB7);
569 isf_fifo_init(&App1AppInstance.fifos.MagnetometerDataFifo_Sub8, &App1AppInstance.data.rawMagnetometerData_Sub8, sizeof(DATA_TYPE_SUB8), DATA_FIFO_LEN_SUB8);
570 isf_fifo_init(&App1AppInstance.fifos.MagnetometerDataFifo_Sub9, &App1AppInstance.data.rawMagnetometerData_Sub9, sizeof(DATA_TYPE_SUB9), DATA_FIFO_LEN_SUB9);
571 isf_fifo_init(&App1AppInstance.fifos.GyrometerDataFifo_Sub10, &App1AppInstance.data.rawGyrometerData_Sub10, sizeof(DATA_TYPE_SUB10), DATA_FIFO_LEN_SUB10);
572 isf_fifo_init(&App1AppInstance.fifos.GyrometerDataFifo_Sub11, &App1AppInstance.data.rawGyrometerData_Sub11, sizeof(DATA_TYPE_SUB11), DATA_FIFO_LEN_SUB11);
573 isf_fifo_init(&App1AppInstance.fifos.PressureDataFifo_Sub12, &App1AppInstance.data.rawPressureData_Sub12, sizeof(DATA_TYPE_SUB12), DATA_FIFO_LEN_SUB12);
574 isf_fifo_init(&App1AppInstance.fifos.TemperatureDataFifo_Sub13, &App1AppInstance.data.rawTemperatureData_Sub13, sizeof(DATA_TYPE_SUB13), DATA_FIFO_LEN_SUB13);
575 isf_fifo_init(&App1AppInstance.fifos.OrientationDataFifo_Sub14, &App1AppInstance.data.rawOrientationData_Sub14, sizeof(DATA_TYPE_SUB14), DATA_FIFO_LEN_SUB14);
576 isf_fifo_init(&App1AppInstance.fifos.AltitudeDataFifo_Sub15, &App1AppInstance.data.rawAltitudeData_Sub15, sizeof(DATA_TYPE_SUB15), DATA_FIFO_LEN_SUB15);
577 isf_fifo_init(&App1AppInstance.fifos.PedometerDataFifo_Sub16, &App1AppInstance.data.rawPedometerData_Sub16, sizeof(DATA_TYPE_SUB16), DATA_FIFO_LEN_SUB16);
578 isf_fifo_init(&App1AppInstance.fifos.PedometerDataFifo_Sub17, &App1AppInstance.data.rawPedometerData_Sub17, sizeof(DATA_TYPE_SUB17), DATA_FIFO_LEN_SUB17);
579 isf_fifo_init(&App1AppInstance.fifos.CustomDataFifo_Sub18, &App1AppInstance.data.rawCustomData_Sub18, sizeof(DATA_TYPE_SUB18), DATA_FIFO_LEN_SUB18);
580 isf_fifo_init(&App1AppInstance.fifos.AnalogDataFifo_Sub19, &App1AppInstance.data.rawAnalogData_Sub19, sizeof(DATA_TYPE_SUB19), DATA_FIFO_LEN_SUB19);
581 // Call the DSA direct interface to initialize the sensor.
582 init_sensor(
583 App1AppInstance.info.AccelerometerInfo_Sub0.sensorId,
584 &App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle,
585 &App1AppInstance.instance.smLWEvent,
586 App1_Accelerometer0_DATA_READY_EVENT);
587 //Save the Sensor's handle in the global list.
588 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub0.sensorId] =
589 &App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle;
590 init_sensor(
591 App1AppInstance.info.AccelerometerInfo_Sub1.sensorId,
592 &App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle,
593 &App1AppInstance.instance.smLWEvent,
594 App1_Accelerometer1_DATA_READY_EVENT);
595 //Save the Sensor's handle in the global list.
596 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub1.sensorId] =
597 &App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle;
598 init_sensor(
599 App1AppInstance.info.AccelerometerInfo_Sub2.sensorId,
600 &App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle,
601 &App1AppInstance.instance.smLWEvent,
602 App1_Accelerometer2_DATA_READY_EVENT);
603 //Save the Sensor's handle in the global list.
604 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub2.sensorId] =
605 &App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle;
606 init_sensor(
607 App1AppInstance.info.AccelerometerInfo_Sub3.sensorId,
608 &App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle,
609 &App1AppInstance.instance.smLWEvent,
610 App1_Accelerometer3_DATA_READY_EVENT);
611 //Save the Sensor's handle in the global list.
612 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub3.sensorId] =
613 &App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle;
614 init_sensor(
615 App1AppInstance.info.AccelerometerInfo_Sub4.sensorId,
616 &App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle,
617 &App1AppInstance.instance.smLWEvent,
618 App1_Accelerometer4_DATA_READY_EVENT);
619 //Save the Sensor's handle in the global list.
620 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub4.sensorId] =
621 &App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle;
622 init_sensor(
623 App1AppInstance.info.AccelerometerInfo_Sub5.sensorId,
624 &App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle,
625 &App1AppInstance.instance.smLWEvent,
626 App1_Accelerometer5_DATA_READY_EVENT);
627 //Save the Sensor's handle in the global list.
628 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub5.sensorId] =
629 &App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle;
630 init_sensor(
631 App1AppInstance.info.AccelerometerInfo_Sub6.sensorId,
632 &App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle,
633 &App1AppInstance.instance.smLWEvent,
634 App1_Accelerometer6_DATA_READY_EVENT);
635 //Save the Sensor's handle in the global list.
636 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub6.sensorId] =
637 &App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle;
638 init_sensor(
639 App1AppInstance.info.AccelerometerInfo_Sub7.sensorId,
640 &App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle,
641 &App1AppInstance.instance.smLWEvent,
642 App1_Accelerometer7_DATA_READY_EVENT);
643 //Save the Sensor's handle in the global list.
644 gSensorHandleList[App1AppInstance.info.AccelerometerInfo_Sub7.sensorId] =
645 &App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle;
646 init_sensor(
647 App1AppInstance.info.MagnetometerInfo_Sub8.sensorId,
648 &App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle,
649 &App1AppInstance.instance.smLWEvent,
650 App1_Magnetometer8_DATA_READY_EVENT);
651 //Save the Sensor's handle in the global list.
652 gSensorHandleList[App1AppInstance.info.MagnetometerInfo_Sub8.sensorId] =
653 &App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle;
654 init_sensor(
655 App1AppInstance.info.MagnetometerInfo_Sub9.sensorId,
656 &App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle,
657 &App1AppInstance.instance.smLWEvent,
658 App1_Magnetometer9_DATA_READY_EVENT);
659 //Save the Sensor's handle in the global list.
660 gSensorHandleList[App1AppInstance.info.MagnetometerInfo_Sub9.sensorId] =
661 &App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle;
662 init_sensor(
663 App1AppInstance.info.GyrometerInfo_Sub10.sensorId,
664 &App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle,
665 &App1AppInstance.instance.smLWEvent,
666 App1_Gyrometer10_DATA_READY_EVENT);
667 //Save the Sensor's handle in the global list.
668 gSensorHandleList[App1AppInstance.info.GyrometerInfo_Sub10.sensorId] =
669 &App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle;
670 init_sensor(
671 App1AppInstance.info.GyrometerInfo_Sub11.sensorId,
672 &App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle,
673 &App1AppInstance.instance.smLWEvent,
674 App1_Gyrometer11_DATA_READY_EVENT);
675 //Save the Sensor's handle in the global list.
676 gSensorHandleList[App1AppInstance.info.GyrometerInfo_Sub11.sensorId] =
677 &App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle;
678 init_sensor(
679 App1AppInstance.info.PressureInfo_Sub12.sensorId,
680 &App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle,
681 &App1AppInstance.instance.smLWEvent,
682 App1_Pressure12_DATA_READY_EVENT);
683 //Save the Sensor's handle in the global list.
684 gSensorHandleList[App1AppInstance.info.PressureInfo_Sub12.sensorId] =
685 &App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle;
686 init_sensor(
687 App1AppInstance.info.TemperatureInfo_Sub13.sensorId,
688 &App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle,
689 &App1AppInstance.instance.smLWEvent,
690 App1_Temperature13_DATA_READY_EVENT);
691 //Save the Sensor's handle in the global list.
692 gSensorHandleList[App1AppInstance.info.TemperatureInfo_Sub13.sensorId] =
693 &App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle;
694 init_sensor(
695 App1AppInstance.info.OrientationInfo_Sub14.sensorId,
696 &App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle,
697 &App1AppInstance.instance.smLWEvent,
698 App1_Orientation14_DATA_READY_EVENT);
699 //Save the Sensor's handle in the global list.
700 gSensorHandleList[App1AppInstance.info.OrientationInfo_Sub14.sensorId] =
701 &App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle;
702 init_sensor(
703 App1AppInstance.info.AltitudeInfo_Sub15.sensorId,
704 &App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle,
705 &App1AppInstance.instance.smLWEvent,
706 App1_Altitude15_DATA_READY_EVENT);
707 //Save the Sensor's handle in the global list.
708 gSensorHandleList[App1AppInstance.info.AltitudeInfo_Sub15.sensorId] =
709 &App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle;
710 init_sensor(
711 App1AppInstance.info.PedometerInfo_Sub16.sensorId,
712 &App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle,
713 &App1AppInstance.instance.smLWEvent,
714 App1_Pedometer16_DATA_READY_EVENT);
715 //Save the Sensor's handle in the global list.
716 gSensorHandleList[App1AppInstance.info.PedometerInfo_Sub16.sensorId] =
717 &App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle;
718 init_sensor(
719 App1AppInstance.info.PedometerInfo_Sub17.sensorId,
720 &App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle,
721 &App1AppInstance.instance.smLWEvent,
722 App1_Pedometer17_DATA_READY_EVENT);
723 //Save the Sensor's handle in the global list.
724 gSensorHandleList[App1AppInstance.info.PedometerInfo_Sub17.sensorId] =
725 &App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle;
726 init_sensor(
727 App1AppInstance.info.CustomInfo_Sub18.sensorId,
728 &App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle,
729 &App1AppInstance.instance.smLWEvent,
730 App1_Custom18_DATA_READY_EVENT);
731 //Save the Sensor's handle in the global list.
732 gSensorHandleList[App1AppInstance.info.CustomInfo_Sub18.sensorId] =
733 &App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle;
734 init_sensor(
735 App1AppInstance.info.AnalogInfo_Sub19.sensorId,
736 &App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle,
737 &App1AppInstance.instance.smLWEvent,
738 App1_Analog19_DATA_READY_EVENT);
739 //Save the Sensor's handle in the global list.
740 gSensorHandleList[App1AppInstance.info.AnalogInfo_Sub19.sensorId] =
741 &App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle;
742
743 // Initialize the sensor subscriptions to Stopped/Unsubscribed state.
744 App1_GotoState(0);
745
746 // Main task loop (forever).
747 while (1) {
748 // Wait for sensor data.
749 uint32 signalledEvents = 0;
750 OSA_EventWait(&App1AppInstance.instance.smLWEvent, App1_ALL_SENSOR_DATA_READY, 0, OSA_WAIT_FOREVER, &signalledEvents );
751 OSA_SemaWait(&App1AppInstance.instance.outputBufferLock, OSA_WAIT_FOREVER);
752 // Updated based on received event(s).
753 if (signalledEvents & App1_Accelerometer0_DATA_READY_EVENT) // Accelerometer event.
754 {
755 // Lock the fifo.
756 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub0);
757 void *pData = NULL;
758 isf_fifo_status_t status = ISF_SUCCESS;
759 do {
760 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub0, &pData);
761 isf_ci_stream_update_data(1,sizeof(App1AppInstance.data.rawAccelerometerData_Sub0[0]), 0, (uint8 *)pData);
762 } while (status == ISF_SUCCESS);
763
764 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub0);
765 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub0);
766 }
767 if (signalledEvents & App1_Accelerometer1_DATA_READY_EVENT) // Accelerometer event.
768 {
769 // Lock the fifo.
770 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub1);
771 void *pData = NULL;
772 isf_fifo_status_t status = ISF_SUCCESS;
773 do {
774 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub1, &pData);
775 isf_ci_stream_update_data(2,sizeof(App1AppInstance.data.rawAccelerometerData_Sub1[0]), 0, (uint8 *)pData);
776 } while (status == ISF_SUCCESS);
777
778 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub1);
779 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub1);
780 }
781 if (signalledEvents & App1_Accelerometer2_DATA_READY_EVENT) // Accelerometer event.
782 {
783 // Lock the fifo.
784 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub2);
785 void *pData = NULL;
786 isf_fifo_status_t status = ISF_SUCCESS;
787 do {
788 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub2, &pData);
789 isf_ci_stream_update_data(3,sizeof(App1AppInstance.data.rawAccelerometerData_Sub2[0]), 0, (uint8 *)pData);
790 } while (status == ISF_SUCCESS);
791
792 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub2);
793 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub2);
794 }
795 if (signalledEvents & App1_Accelerometer3_DATA_READY_EVENT) // Accelerometer event.
796 {
797 // Lock the fifo.
798 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub3);
799 void *pData = NULL;
800 isf_fifo_status_t status = ISF_SUCCESS;
801 do {
802 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub3, &pData);
803 isf_ci_stream_update_data(4,sizeof(App1AppInstance.data.rawAccelerometerData_Sub3[0]), 0, (uint8 *)pData);
804 } while (status == ISF_SUCCESS);
805
806 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub3);
807 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub3);
808 }
809 if (signalledEvents & App1_Accelerometer4_DATA_READY_EVENT) // Accelerometer event.
810 {
811 // Lock the fifo.
812 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub4);
813 void *pData = NULL;
814 isf_fifo_status_t status = ISF_SUCCESS;
815 do {
816 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub4, &pData);
817 isf_ci_stream_update_data(5,sizeof(App1AppInstance.data.rawAccelerometerData_Sub4[0]), 0, (uint8 *)pData);
818 } while (status == ISF_SUCCESS);
819
820 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub4);
821 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub4);
822 }
823 if (signalledEvents & App1_Accelerometer5_DATA_READY_EVENT) // Accelerometer event.
824 {
825 // Lock the fifo.
826 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub5);
827 void *pData = NULL;
828 isf_fifo_status_t status = ISF_SUCCESS;
829 do {
830 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub5, &pData);
831 isf_ci_stream_update_data(6,sizeof(App1AppInstance.data.rawAccelerometerData_Sub5[0]), 0, (uint8 *)pData);
832 } while (status == ISF_SUCCESS);
833
834 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub5);
835 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub5);
836 }
837 if (signalledEvents & App1_Accelerometer6_DATA_READY_EVENT) // Accelerometer event.
838 {
839 // Lock the fifo.
840 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub6);
841 void *pData = NULL;
842 isf_fifo_status_t status = ISF_SUCCESS;
843 do {
844 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub6, &pData);
845 isf_ci_stream_update_data(7,sizeof(App1AppInstance.data.rawAccelerometerData_Sub6[0]), 0, (uint8 *)pData);
846 } while (status == ISF_SUCCESS);
847
848 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub6);
849 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub6);
850 }
851 if (signalledEvents & App1_Accelerometer7_DATA_READY_EVENT) // Accelerometer event.
852 {
853 // Lock the fifo.
854 isf_fifo_lock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub7);
855 void *pData = NULL;
856 isf_fifo_status_t status = ISF_SUCCESS;
857 do {
858 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AccelerometerDataFifo_Sub7, &pData);
859 isf_ci_stream_update_data(8,sizeof(App1AppInstance.data.rawAccelerometerData_Sub7[0]), 0, (uint8 *)pData);
860 } while (status == ISF_SUCCESS);
861
862 isf_fifo_el_clear(&App1AppInstance.fifos.AccelerometerDataFifo_Sub7);
863 isf_fifo_unlock(&App1AppInstance.fifos.AccelerometerDataFifo_Sub7);
864 }
865 if (signalledEvents & App1_Magnetometer8_DATA_READY_EVENT) // Magnetometer event.
866 {
867 // Lock the fifo.
868 isf_fifo_lock(&App1AppInstance.fifos.MagnetometerDataFifo_Sub8);
869 void *pData = NULL;
870 isf_fifo_status_t status = ISF_SUCCESS;
871 do {
872 status = isf_fifo_el_traverse(&App1AppInstance.fifos.MagnetometerDataFifo_Sub8, &pData);
873 isf_ci_stream_update_data(9,sizeof(App1AppInstance.data.rawMagnetometerData_Sub8[0]), 0, (uint8 *)pData);
874 } while (status == ISF_SUCCESS);
875
876 isf_fifo_el_clear(&App1AppInstance.fifos.MagnetometerDataFifo_Sub8);
877 isf_fifo_unlock(&App1AppInstance.fifos.MagnetometerDataFifo_Sub8);
878 }
879 if (signalledEvents & App1_Magnetometer9_DATA_READY_EVENT) // Magnetometer event.
880 {
881 // Lock the fifo.
882 isf_fifo_lock(&App1AppInstance.fifos.MagnetometerDataFifo_Sub9);
883 void *pData = NULL;
884 isf_fifo_status_t status = ISF_SUCCESS;
885 do {
886 status = isf_fifo_el_traverse(&App1AppInstance.fifos.MagnetometerDataFifo_Sub9, &pData);
887 isf_ci_stream_update_data(10,sizeof(App1AppInstance.data.rawMagnetometerData_Sub9[0]), 0, (uint8 *)pData);
888 } while (status == ISF_SUCCESS);
889
890 isf_fifo_el_clear(&App1AppInstance.fifos.MagnetometerDataFifo_Sub9);
891 isf_fifo_unlock(&App1AppInstance.fifos.MagnetometerDataFifo_Sub9);
892 }
893 if (signalledEvents & App1_Gyrometer10_DATA_READY_EVENT) // Gyrometer event.
894 {
895 // Lock the fifo.
896 isf_fifo_lock(&App1AppInstance.fifos.GyrometerDataFifo_Sub10);
897 void *pData = NULL;
898 isf_fifo_status_t status = ISF_SUCCESS;
899 do {
900 status = isf_fifo_el_traverse(&App1AppInstance.fifos.GyrometerDataFifo_Sub10, &pData);
901 isf_ci_stream_update_data(11,sizeof(App1AppInstance.data.rawGyrometerData_Sub10[0]), 0, (uint8 *)pData);
902 } while (status == ISF_SUCCESS);
903
904 isf_fifo_el_clear(&App1AppInstance.fifos.GyrometerDataFifo_Sub10);
905 isf_fifo_unlock(&App1AppInstance.fifos.GyrometerDataFifo_Sub10);
906 }
907 if (signalledEvents & App1_Gyrometer11_DATA_READY_EVENT) // Gyrometer event.
908 {
909 // Lock the fifo.
910 isf_fifo_lock(&App1AppInstance.fifos.GyrometerDataFifo_Sub11);
911 void *pData = NULL;
912 isf_fifo_status_t status = ISF_SUCCESS;
913 do {
914 status = isf_fifo_el_traverse(&App1AppInstance.fifos.GyrometerDataFifo_Sub11, &pData);
915 isf_ci_stream_update_data(12,sizeof(App1AppInstance.data.rawGyrometerData_Sub11[0]), 0, (uint8 *)pData);
916 } while (status == ISF_SUCCESS);
917
918 isf_fifo_el_clear(&App1AppInstance.fifos.GyrometerDataFifo_Sub11);
919 isf_fifo_unlock(&App1AppInstance.fifos.GyrometerDataFifo_Sub11);
920 }
921 if (signalledEvents & App1_Pressure12_DATA_READY_EVENT) // Pressure event.
922 {
923 // Lock the fifo.
924 isf_fifo_lock(&App1AppInstance.fifos.PressureDataFifo_Sub12);
925 void *pData = NULL;
926 isf_fifo_status_t status = ISF_SUCCESS;
927 do {
928 status = isf_fifo_el_traverse(&App1AppInstance.fifos.PressureDataFifo_Sub12, &pData);
929 isf_ci_stream_update_data(13,sizeof(App1AppInstance.data.rawPressureData_Sub12[0]), 0, (uint8 *)pData);
930 } while (status == ISF_SUCCESS);
931
932 isf_fifo_el_clear(&App1AppInstance.fifos.PressureDataFifo_Sub12);
933 isf_fifo_unlock(&App1AppInstance.fifos.PressureDataFifo_Sub12);
934 }
935 if (signalledEvents & App1_Temperature13_DATA_READY_EVENT) // Temperature event.
936 {
937 // Lock the fifo.
938 isf_fifo_lock(&App1AppInstance.fifos.TemperatureDataFifo_Sub13);
939 void *pData = NULL;
940 isf_fifo_status_t status = ISF_SUCCESS;
941 do {
942 status = isf_fifo_el_traverse(&App1AppInstance.fifos.TemperatureDataFifo_Sub13, &pData);
943 isf_ci_stream_update_data(14,sizeof(App1AppInstance.data.rawTemperatureData_Sub13[0]), 0, (uint8 *)pData);
944 } while (status == ISF_SUCCESS);
945
946 isf_fifo_el_clear(&App1AppInstance.fifos.TemperatureDataFifo_Sub13);
947 isf_fifo_unlock(&App1AppInstance.fifos.TemperatureDataFifo_Sub13);
948 }
949 if (signalledEvents & App1_Orientation14_DATA_READY_EVENT) // Orientation event.
950 {
951 // Lock the fifo.
952 isf_fifo_lock(&App1AppInstance.fifos.OrientationDataFifo_Sub14);
953 void *pData = NULL;
954 isf_fifo_status_t status = ISF_SUCCESS;
955 do {
956 status = isf_fifo_el_traverse(&App1AppInstance.fifos.OrientationDataFifo_Sub14, &pData);
957 isf_ci_stream_update_data(15,sizeof(App1AppInstance.data.rawOrientationData_Sub14[0]), 0, (uint8 *)pData);
958 } while (status == ISF_SUCCESS);
959
960 isf_fifo_el_clear(&App1AppInstance.fifos.OrientationDataFifo_Sub14);
961 isf_fifo_unlock(&App1AppInstance.fifos.OrientationDataFifo_Sub14);
962 }
963 if (signalledEvents & App1_Altitude15_DATA_READY_EVENT) // Altitude event.
964 {
965 // Lock the fifo.
966 isf_fifo_lock(&App1AppInstance.fifos.AltitudeDataFifo_Sub15);
967 void *pData = NULL;
968 isf_fifo_status_t status = ISF_SUCCESS;
969 do {
970 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AltitudeDataFifo_Sub15, &pData);
971 isf_ci_stream_update_data(16,sizeof(App1AppInstance.data.rawAltitudeData_Sub15[0]), 0, (uint8 *)pData);
972 } while (status == ISF_SUCCESS);
973
974 isf_fifo_el_clear(&App1AppInstance.fifos.AltitudeDataFifo_Sub15);
975 isf_fifo_unlock(&App1AppInstance.fifos.AltitudeDataFifo_Sub15);
976 }
977 if (signalledEvents & App1_Pedometer16_DATA_READY_EVENT) // Pedometer event.
978 {
979 // Lock the fifo.
980 isf_fifo_lock(&App1AppInstance.fifos.PedometerDataFifo_Sub16);
981 void *pData = NULL;
982 isf_fifo_status_t status = ISF_SUCCESS;
983 do {
984 status = isf_fifo_el_traverse(&App1AppInstance.fifos.PedometerDataFifo_Sub16, &pData);
985 isf_ci_stream_update_data(17,sizeof(App1AppInstance.data.rawPedometerData_Sub16[0]), 0, (uint8 *)pData);
986 } while (status == ISF_SUCCESS);
987
988 isf_fifo_el_clear(&App1AppInstance.fifos.PedometerDataFifo_Sub16);
989 isf_fifo_unlock(&App1AppInstance.fifos.PedometerDataFifo_Sub16);
990 }
991 if (signalledEvents & App1_Pedometer17_DATA_READY_EVENT) // Pedometer event.
992 {
993 // Lock the fifo.
994 isf_fifo_lock(&App1AppInstance.fifos.PedometerDataFifo_Sub17);
995 void *pData = NULL;
996 isf_fifo_status_t status = ISF_SUCCESS;
997 do {
998 status = isf_fifo_el_traverse(&App1AppInstance.fifos.PedometerDataFifo_Sub17, &pData);
999 isf_ci_stream_update_data(18,sizeof(App1AppInstance.data.rawPedometerData_Sub17[0]), 0, (uint8 *)pData);
1000 } while (status == ISF_SUCCESS);
1001
1002 isf_fifo_el_clear(&App1AppInstance.fifos.PedometerDataFifo_Sub17);
1003 isf_fifo_unlock(&App1AppInstance.fifos.PedometerDataFifo_Sub17);
1004 }
1005 if (signalledEvents & App1_Custom18_DATA_READY_EVENT) // Custom event.
1006 {
1007 // Lock the fifo.
1008 isf_fifo_lock(&App1AppInstance.fifos.CustomDataFifo_Sub18);
1009 void *pData = NULL;
1010 isf_fifo_status_t status = ISF_SUCCESS;
1011 do {
1012 status = isf_fifo_el_traverse(&App1AppInstance.fifos.CustomDataFifo_Sub18, &pData);
1013 isf_ci_stream_update_data(19,sizeof(App1AppInstance.data.rawCustomData_Sub18[0]), 0, (uint8 *)pData);
1014 } while (status == ISF_SUCCESS);
1015
1016 isf_fifo_el_clear(&App1AppInstance.fifos.CustomDataFifo_Sub18);
1017 isf_fifo_unlock(&App1AppInstance.fifos.CustomDataFifo_Sub18);
1018 }
1019 if (signalledEvents & App1_Analog19_DATA_READY_EVENT) // Analog event.
1020 {
1021 // Lock the fifo.
1022 isf_fifo_lock(&App1AppInstance.fifos.AnalogDataFifo_Sub19);
1023 void *pData = NULL;
1024 isf_fifo_status_t status = ISF_SUCCESS;
1025 do {
1026 status = isf_fifo_el_traverse(&App1AppInstance.fifos.AnalogDataFifo_Sub19, &pData);
1027 isf_ci_stream_update_data(20,sizeof(App1AppInstance.data.rawAnalogData_Sub19[0]), 0, (uint8 *)pData);
1028 } while (status == ISF_SUCCESS);
1029
1030 isf_fifo_el_clear(&App1AppInstance.fifos.AnalogDataFifo_Sub19);
1031 isf_fifo_unlock(&App1AppInstance.fifos.AnalogDataFifo_Sub19);
1032 }
1033 // Have the Command Interpreter update the Quick-Read registers if they are enabled.
1034 if (GET_FIELD(CTRL_QREN,App1AppInstance.settings.control))
1035 {
1036 // If the application is in a state that can produce streaming output, then send it to the host interface.
1037 isf_ci_qr_update(App1AppInstance.instance.appId, sizeof(App1AppInstance.data), (uint8 *)&App1AppInstance.data);
1038 }
1039 // User function to process the raw sensor data.
1040 App1_ProcessData(&App1AppInstance.data, signalledEvents);
1041 // Unlock the buffer when it is no longer used.
1042 OSA_SemaPost(&App1AppInstance.instance.outputBufferLock);
1043 } /* end while() */
1044
1045 // User function to clean up on exit.
1046 App1_Exit();
1047 }
1048
1049 /*
1050 ** ===================================================================
1051 ** Method : App1_HCIAppCallback
1052 **
1053 ** Description :
1054 ** This function implements the App1 user application callback
1055 ** for the Command Interpreter.
1056 ** This function implements the predefined Command Interpreter command enumerations.
1057 ** It will also include calling user-define commands if configured.
1058 ** This method is internal. It is used by Processor Expert only.
1059 ** Parameters :
1060 ** NAME DESCRIPTION
1061 ** pHostPacket Pointer to the host command.
1062 ** pAppPacket Pointer to the response data.
1063 ** Returns :
1064 ** returns a value of type ci_response_t
1065 ** ===================================================================
1066 */
1067 ci_response_t App1_ci_app_callback(ci_host_cmd_packet_t *pHostPacket, ci_app_resp_packet_t *pAppPacket) {
1068 // New application configuration.
1069 App1AppSettings_t NewConfig;
1070 // Helper pointers to application configuration and data structures.
1071 uint8 *pData = (uint8 *)&App1AppInstance.data;
1072 App1AppSettings_t *pConfig = &App1AppInstance.settings;
1073 appSubscriptionResponse_t isf_app_subscription_info;
1074 pseudoSettings_t *sensorSettings = (pseudoSettings_t*)&App1AppInstance.settings;
1075 SensorInfo_t *sensorInfo = (SensorInfo_t*)&App1AppInstance.info;
1076 uint8 num_sensors;
1077 int index=0;
1078
1079 // Handle each valid host command.
1080 switch(pHostPacket->cmd)
1081 {
1082 // Read data from the host output buffer.
1083 case CI_CMD_READ_APP_DATA:
1084 // Check if the command accesses bytes outside the valid range.
1085 if (pHostPacket->byte_cnt > sizeof(App1AppInstance.data)) {
1086 return CI_INVALID_COUNT;
1087 }
1088 if (pHostPacket->offset + pHostPacket->byte_cnt > sizeof(App1AppInstance.data)) {
1089 return CI_ERROR_COMMAND;
1090 }
1091
1092 // Lock the output buffer, update the data to the CI, then unlock the buffer.
1093 OSA_SemaWait(&App1AppInstance.instance.outputBufferLock, OSA_WAIT_FOREVER);
1094 pAppPacket->bytes_xfer = isf_ci_app_write(pHostPacket->appId, pHostPacket->byte_cnt, (uint8*)pData + pHostPacket->offset);
1095 OSA_SemaPost(&App1AppInstance.instance.outputBufferLock);
1096 break;
1097
1098 // Update the Quick-Read data.
1099 case CI_CMD_UPDATE_QUICKREAD:
1100 OSA_SemaWait(&App1AppInstance.instance.outputBufferLock, OSA_WAIT_FOREVER);
1101 isf_ci_qr_update(App1AppInstance.instance.appId, (int8)sizeof(*pData), (uint8 *)&App1AppInstance.data);
1102 OSA_SemaPost(&App1AppInstance.instance.outputBufferLock);
1103 break;
1104
1105 // Read or write the application configuration structure.
1106 case CI_CMD_READ_CONFIG:
1107 // Fall through
1108 case CI_CMD_WRITE_CONFIG:
1109 // Check if the command accesses bytes outside the valid range.
1110 if (pHostPacket->byte_cnt > sizeof(*pConfig))
1111 return CI_INVALID_COUNT;
1112 if (pHostPacket->offset + pHostPacket->byte_cnt > sizeof(*pConfig))
1113 return CI_ERROR_COMMAND;
1114
1115 if (CI_CMD_READ_CONFIG == pHostPacket->cmd) {
1116 // Create a copy of the current settings.
1117 NewConfig = App1AppInstance.settings;
1118
1119 // Convert the timestamp to big endian before sending data to the host.
1120 NewConfig.AccelerometerSettings_Sub0.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub0.nSamplePeriod);
1121 NewConfig.AccelerometerSettings_Sub1.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub1.nSamplePeriod);
1122 NewConfig.AccelerometerSettings_Sub2.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub2.nSamplePeriod);
1123 NewConfig.AccelerometerSettings_Sub3.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub3.nSamplePeriod);
1124 NewConfig.AccelerometerSettings_Sub4.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub4.nSamplePeriod);
1125 NewConfig.AccelerometerSettings_Sub5.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub5.nSamplePeriod);
1126 NewConfig.AccelerometerSettings_Sub6.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub6.nSamplePeriod);
1127 NewConfig.AccelerometerSettings_Sub7.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub7.nSamplePeriod);
1128 NewConfig.MagnetometerSettings_Sub8.nSamplePeriod = isf_swap4byte(NewConfig.MagnetometerSettings_Sub8.nSamplePeriod);
1129 NewConfig.MagnetometerSettings_Sub9.nSamplePeriod = isf_swap4byte(NewConfig.MagnetometerSettings_Sub9.nSamplePeriod);
1130 NewConfig.GyrometerSettings_Sub10.nSamplePeriod = isf_swap4byte(NewConfig.GyrometerSettings_Sub10.nSamplePeriod);
1131 NewConfig.GyrometerSettings_Sub11.nSamplePeriod = isf_swap4byte(NewConfig.GyrometerSettings_Sub11.nSamplePeriod);
1132 NewConfig.PressureSettings_Sub12.nSamplePeriod = isf_swap4byte(NewConfig.PressureSettings_Sub12.nSamplePeriod);
1133 NewConfig.TemperatureSettings_Sub13.nSamplePeriod = isf_swap4byte(NewConfig.TemperatureSettings_Sub13.nSamplePeriod);
1134 NewConfig.OrientationSettings_Sub14.nSamplePeriod = isf_swap4byte(NewConfig.OrientationSettings_Sub14.nSamplePeriod);
1135 NewConfig.AltitudeSettings_Sub15.nSamplePeriod = isf_swap4byte(NewConfig.AltitudeSettings_Sub15.nSamplePeriod);
1136 NewConfig.PedometerSettings_Sub16.nSamplePeriod = isf_swap4byte(NewConfig.PedometerSettings_Sub16.nSamplePeriod);
1137 NewConfig.PedometerSettings_Sub17.nSamplePeriod = isf_swap4byte(NewConfig.PedometerSettings_Sub17.nSamplePeriod);
1138 NewConfig.CustomSettings_Sub18.nSamplePeriod = isf_swap4byte(NewConfig.CustomSettings_Sub18.nSamplePeriod);
1139 NewConfig.AnalogSettings_Sub19.nSamplePeriod = isf_swap4byte(NewConfig.AnalogSettings_Sub19.nSamplePeriod);
1140 // Write the requested (READ) information to the host interface.
1141 pAppPacket->bytes_xfer = (uint8)isf_ci_app_write(pHostPacket->appId, (uint32)pHostPacket->byte_cnt,
1142 (uint8*)&NewConfig + pHostPacket->offset);
1143 }
1144 else
1145 {
1146 uint8 powerMode;
1147 // The host may not write the entire configuration buffer, so start with the current configuration.
1148 NewConfig = App1AppInstance.settings;
1149
1150 // Read the new data from the host.
1151 pAppPacket->bytes_xfer = (uint8)isf_ci_app_read(pHostPacket->appId, (uint32)pHostPacket->byte_cnt,
1152 (uint8*)&NewConfig + pHostPacket->offset);
1153 // If the host updated the report rate, then convert big endian to little endian for each subscription.
1154 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub0.nSamplePeriod) >= pHostPacket->offset) &&
1155 ((startof(App1AppSettings_t,AccelerometerSettings_Sub0.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1156 {
1157 NewConfig.AccelerometerSettings_Sub0.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub0.nSamplePeriod);
1158 }
1159 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub1.nSamplePeriod) >= pHostPacket->offset) &&
1160 ((startof(App1AppSettings_t,AccelerometerSettings_Sub1.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1161 {
1162 NewConfig.AccelerometerSettings_Sub1.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub1.nSamplePeriod);
1163 }
1164 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub2.nSamplePeriod) >= pHostPacket->offset) &&
1165 ((startof(App1AppSettings_t,AccelerometerSettings_Sub2.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1166 {
1167 NewConfig.AccelerometerSettings_Sub2.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub2.nSamplePeriod);
1168 }
1169 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub3.nSamplePeriod) >= pHostPacket->offset) &&
1170 ((startof(App1AppSettings_t,AccelerometerSettings_Sub3.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1171 {
1172 NewConfig.AccelerometerSettings_Sub3.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub3.nSamplePeriod);
1173 }
1174 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub4.nSamplePeriod) >= pHostPacket->offset) &&
1175 ((startof(App1AppSettings_t,AccelerometerSettings_Sub4.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1176 {
1177 NewConfig.AccelerometerSettings_Sub4.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub4.nSamplePeriod);
1178 }
1179 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub5.nSamplePeriod) >= pHostPacket->offset) &&
1180 ((startof(App1AppSettings_t,AccelerometerSettings_Sub5.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1181 {
1182 NewConfig.AccelerometerSettings_Sub5.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub5.nSamplePeriod);
1183 }
1184 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub6.nSamplePeriod) >= pHostPacket->offset) &&
1185 ((startof(App1AppSettings_t,AccelerometerSettings_Sub6.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1186 {
1187 NewConfig.AccelerometerSettings_Sub6.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub6.nSamplePeriod);
1188 }
1189 if ((startof(App1AppSettings_t,AccelerometerSettings_Sub7.nSamplePeriod) >= pHostPacket->offset) &&
1190 ((startof(App1AppSettings_t,AccelerometerSettings_Sub7.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1191 {
1192 NewConfig.AccelerometerSettings_Sub7.nSamplePeriod = isf_swap4byte(NewConfig.AccelerometerSettings_Sub7.nSamplePeriod);
1193 }
1194 if ((startof(App1AppSettings_t,MagnetometerSettings_Sub8.nSamplePeriod) >= pHostPacket->offset) &&
1195 ((startof(App1AppSettings_t,MagnetometerSettings_Sub8.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1196 {
1197 NewConfig.MagnetometerSettings_Sub8.nSamplePeriod = isf_swap4byte(NewConfig.MagnetometerSettings_Sub8.nSamplePeriod);
1198 }
1199 if ((startof(App1AppSettings_t,MagnetometerSettings_Sub9.nSamplePeriod) >= pHostPacket->offset) &&
1200 ((startof(App1AppSettings_t,MagnetometerSettings_Sub9.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1201 {
1202 NewConfig.MagnetometerSettings_Sub9.nSamplePeriod = isf_swap4byte(NewConfig.MagnetometerSettings_Sub9.nSamplePeriod);
1203 }
1204 if ((startof(App1AppSettings_t,GyrometerSettings_Sub10.nSamplePeriod) >= pHostPacket->offset) &&
1205 ((startof(App1AppSettings_t,GyrometerSettings_Sub10.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1206 {
1207 NewConfig.GyrometerSettings_Sub10.nSamplePeriod = isf_swap4byte(NewConfig.GyrometerSettings_Sub10.nSamplePeriod);
1208 }
1209 if ((startof(App1AppSettings_t,GyrometerSettings_Sub11.nSamplePeriod) >= pHostPacket->offset) &&
1210 ((startof(App1AppSettings_t,GyrometerSettings_Sub11.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1211 {
1212 NewConfig.GyrometerSettings_Sub11.nSamplePeriod = isf_swap4byte(NewConfig.GyrometerSettings_Sub11.nSamplePeriod);
1213 }
1214 if ((startof(App1AppSettings_t,PressureSettings_Sub12.nSamplePeriod) >= pHostPacket->offset) &&
1215 ((startof(App1AppSettings_t,PressureSettings_Sub12.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1216 {
1217 NewConfig.PressureSettings_Sub12.nSamplePeriod = isf_swap4byte(NewConfig.PressureSettings_Sub12.nSamplePeriod);
1218 }
1219 if ((startof(App1AppSettings_t,TemperatureSettings_Sub13.nSamplePeriod) >= pHostPacket->offset) &&
1220 ((startof(App1AppSettings_t,TemperatureSettings_Sub13.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1221 {
1222 NewConfig.TemperatureSettings_Sub13.nSamplePeriod = isf_swap4byte(NewConfig.TemperatureSettings_Sub13.nSamplePeriod);
1223 }
1224 if ((startof(App1AppSettings_t,OrientationSettings_Sub14.nSamplePeriod) >= pHostPacket->offset) &&
1225 ((startof(App1AppSettings_t,OrientationSettings_Sub14.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1226 {
1227 NewConfig.OrientationSettings_Sub14.nSamplePeriod = isf_swap4byte(NewConfig.OrientationSettings_Sub14.nSamplePeriod);
1228 }
1229 if ((startof(App1AppSettings_t,AltitudeSettings_Sub15.nSamplePeriod) >= pHostPacket->offset) &&
1230 ((startof(App1AppSettings_t,AltitudeSettings_Sub15.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1231 {
1232 NewConfig.AltitudeSettings_Sub15.nSamplePeriod = isf_swap4byte(NewConfig.AltitudeSettings_Sub15.nSamplePeriod);
1233 }
1234 if ((startof(App1AppSettings_t,PedometerSettings_Sub16.nSamplePeriod) >= pHostPacket->offset) &&
1235 ((startof(App1AppSettings_t,PedometerSettings_Sub16.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1236 {
1237 NewConfig.PedometerSettings_Sub16.nSamplePeriod = isf_swap4byte(NewConfig.PedometerSettings_Sub16.nSamplePeriod);
1238 }
1239 if ((startof(App1AppSettings_t,PedometerSettings_Sub17.nSamplePeriod) >= pHostPacket->offset) &&
1240 ((startof(App1AppSettings_t,PedometerSettings_Sub17.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1241 {
1242 NewConfig.PedometerSettings_Sub17.nSamplePeriod = isf_swap4byte(NewConfig.PedometerSettings_Sub17.nSamplePeriod);
1243 }
1244 if ((startof(App1AppSettings_t,CustomSettings_Sub18.nSamplePeriod) >= pHostPacket->offset) &&
1245 ((startof(App1AppSettings_t,CustomSettings_Sub18.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1246 {
1247 NewConfig.CustomSettings_Sub18.nSamplePeriod = isf_swap4byte(NewConfig.CustomSettings_Sub18.nSamplePeriod);
1248 }
1249 if ((startof(App1AppSettings_t,AnalogSettings_Sub19.nSamplePeriod) >= pHostPacket->offset) &&
1250 ((startof(App1AppSettings_t,AnalogSettings_Sub19.nSettingsToUse) - 1) <= (pHostPacket->offset + pHostPacket->byte_cnt) ))
1251 {
1252 NewConfig.AnalogSettings_Sub19.nSamplePeriod = isf_swap4byte(NewConfig.AnalogSettings_Sub19.nSamplePeriod);
1253 }
1254 // If the sensor settings are changed while subscribed, then unsubscribe and resubscribe to
1255 // achieve the new settings. If not currently subscribed, then just store the new settings.
1256 // Update the Quick-Read enable and power mode.
1257 App1AppInstance.settings.control =
1258 (App1AppInstance.settings.control & CTRL_STATE_MASK) |
1259 SET_FIELD(CTRL_QREN,GET_FIELD(CTRL_QREN,NewConfig.control)) |
1260 SET_FIELD(CTRL_POWER,GET_FIELD(CTRL_POWER,NewConfig.control));
1261
1262 // Set the ISF power mode based on the host request.
1263 powerMode = GET_FIELD(CTRL_POWER,App1AppInstance.settings.control);
1264 //powerMode = isf_power_set(powerMode);
1265
1266 // Store the resulting mode into the application state structure.
1267 App1AppInstance.settings.control =
1268 (App1AppInstance.settings.control & ~CTRL_POWER_MASK) |
1269 SET_FIELD(CTRL_POWER,powerMode);
1270
1271 // If the embedded application settings have been changed by the host, then bring subscriptions to Stopped/Unsubscribed.
1272 if ( SmSettingsCompare(&NewConfig, &App1AppInstance.settings)) {
1273 App1_GotoState(App1_STATE_STOPPED_UNSUBSCRIBED);
1274 App1AppInstance.settings.AccelerometerSettings_Sub0 = NewConfig.AccelerometerSettings_Sub0;
1275 App1AppInstance.settings.AccelerometerSettings_Sub1 = NewConfig.AccelerometerSettings_Sub1;
1276 App1AppInstance.settings.AccelerometerSettings_Sub2 = NewConfig.AccelerometerSettings_Sub2;
1277 App1AppInstance.settings.AccelerometerSettings_Sub3 = NewConfig.AccelerometerSettings_Sub3;
1278 App1AppInstance.settings.AccelerometerSettings_Sub4 = NewConfig.AccelerometerSettings_Sub4;
1279 App1AppInstance.settings.AccelerometerSettings_Sub5 = NewConfig.AccelerometerSettings_Sub5;
1280 App1AppInstance.settings.AccelerometerSettings_Sub6 = NewConfig.AccelerometerSettings_Sub6;
1281 App1AppInstance.settings.AccelerometerSettings_Sub7 = NewConfig.AccelerometerSettings_Sub7;
1282 App1AppInstance.settings.MagnetometerSettings_Sub8 = NewConfig.MagnetometerSettings_Sub8;
1283 App1AppInstance.settings.MagnetometerSettings_Sub9 = NewConfig.MagnetometerSettings_Sub9;
1284 App1AppInstance.settings.GyrometerSettings_Sub10 = NewConfig.GyrometerSettings_Sub10;
1285 App1AppInstance.settings.GyrometerSettings_Sub11 = NewConfig.GyrometerSettings_Sub11;
1286 App1AppInstance.settings.PressureSettings_Sub12 = NewConfig.PressureSettings_Sub12;
1287 App1AppInstance.settings.TemperatureSettings_Sub13 = NewConfig.TemperatureSettings_Sub13;
1288 App1AppInstance.settings.OrientationSettings_Sub14 = NewConfig.OrientationSettings_Sub14;
1289 App1AppInstance.settings.AltitudeSettings_Sub15 = NewConfig.AltitudeSettings_Sub15;
1290 App1AppInstance.settings.PedometerSettings_Sub16 = NewConfig.PedometerSettings_Sub16;
1291 App1AppInstance.settings.PedometerSettings_Sub17 = NewConfig.PedometerSettings_Sub17;
1292 App1AppInstance.settings.CustomSettings_Sub18 = NewConfig.CustomSettings_Sub18;
1293 App1AppInstance.settings.AnalogSettings_Sub19 = NewConfig.AnalogSettings_Sub19;
1294 }
1295 // Return the subscriptions to the requested state.
1296 if (App1_GotoState(GET_FIELD(CTRL_STATE,NewConfig.control))) {
1297 return CI_ERROR_COMMAND;
1298 }
1299
1300 }
1301 break;
1302
1303 // Reset the application state.
1304 case CI_CMD_RESET_APP:
1305 if (App1_GotoState(0) != 0) {
1306 return CI_ERROR_COMMAND;
1307 }
1308 break;
1309
1310 // Read ISF Embedded Application Version Info.
1311 case CI_CMD_READ_VERSION:
1312 // Write the ISF Application information to the host interface.
1313 pAppPacket->bytes_xfer = isf_ci_app_write(pHostPacket->appId, sizeof(gsApp1_AppInfo), (uint8*)&gsApp1_AppInfo);
1314 break;
1315
1316 // Read ISF Embedded Application Sensor Subscription Info.
1317 case CI_CMD_GET_APP_SUBSCRIPTION:
1318 // Get the ISF Application Sensor Subscription Information
1319 num_sensors = sizeof(App1AppInstance.info)/sizeof(SensorInfo_t);
1320
1321 isf_app_subscription_info.numSensors = num_sensors;
1322
1323 for (index=0; index< num_sensors; index++)
1324 {
1325 isf_app_subscription_info.configArray[index].sensorId = sensorInfo[index].sensorId;
1326 isf_app_subscription_info.configArray[index].sensorDataType = sensorSettings->subArray[index].resultType;
1327 isf_app_subscription_info.configArray[index].sensorResultType = sensorSettings->subArray[index].resultFormat;
1328 isf_app_subscription_info.configArray[index].sampleRateOffset = startof(pseudoSettings_t,subArray[index].nSamplePeriod);
1329 }
1330
1331 isf_app_subscription_info.processedDataBufferOffset = startof(App1AppInstance_t, data.processedData);
1332
1333 // Write the ISF Application Sensor Subscription Info to the host interface.
1334 pAppPacket->bytes_xfer = isf_ci_app_write(pHostPacket->appId, sizeof(appSubscriptionResponse_t), (uint8*)&isf_app_subscription_info);
1335 break;
1336 // Host writing SREC FLASH Bytes.
1337 case CI_CMD_WRITE_SREC_FLASH:
1338 // Check if the command accesses bytes outside the valid range.
1339 if (pHostPacket->byte_cnt > CI_MAX_FLASH_BYTES)
1340 return CI_INVALID_COUNT;
1341
1342 // Call f/n to send command to target Sensor.
1343 {
1344 uint8 pData[CI_MAX_FLASH_BYTES];
1345
1346 pAppPacket->bytes_xfer = (uint8)isf_ci_app_read(pHostPacket->appId, (uint32)pHostPacket->byte_cnt, pData);
1347 if(0 != App1_FlashSensor(pHostPacket->byte_cnt, pData))
1348 return CI_ERROR_COMMAND;
1349 }
1350 break;
1351
1352
1353 default:
1354 return CI_ERROR_COMMAND;
1355 break;
1356 }
1357 return CI_ERROR_NONE;
1358 }
1359
1360 /*
1361 ** ===================================================================
1362 ** Method : App1_ReturnSensorsToInit()
1363 **
1364 ** Description :
1365 ** This function is used by the App1_GotoState() state machine to manually return the sensors
1366 ** to the 'DSA_STATE_INITIALIZED' state when there is an error with any of the sensors. This is done
1367 ** with the assumption that we are already in an Error state with at least one sensor AND that error will
1368 ** be returned to a higher level, so don't try to check errors further here.
1369 ** Parameters :
1370 ** None.
1371 ** Returns :
1372 ** Nothing
1373 ** ===================================================================
1374 */
1375 void App1_ReturnSensorsToInit()
1376 {
1377 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1378 if (App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1379 {
1380 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle);
1381 }
1382 if (App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1383 {
1384 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle);
1385 }
1386 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1387 if (App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1388 {
1389 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle);
1390 }
1391 if (App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1392 {
1393 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle);
1394 }
1395 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1396 if (App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1397 {
1398 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle);
1399 }
1400 if (App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1401 {
1402 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle);
1403 }
1404 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1405 if (App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1406 {
1407 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle);
1408 }
1409 if (App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1410 {
1411 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle);
1412 }
1413 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1414 if (App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1415 {
1416 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle);
1417 }
1418 if (App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1419 {
1420 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle);
1421 }
1422 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1423 if (App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1424 {
1425 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle);
1426 }
1427 if (App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1428 {
1429 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle);
1430 }
1431 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1432 if (App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1433 {
1434 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle);
1435 }
1436 if (App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1437 {
1438 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle);
1439 }
1440 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1441 if (App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1442 {
1443 stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle);
1444 }
1445 if (App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1446 {
1447 shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle);
1448 }
1449 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1450 if (App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1451 {
1452 stop_sensor(&App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle);
1453 }
1454 if (App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1455 {
1456 shutdown_sensor(&App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle);
1457 }
1458 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1459 if (App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1460 {
1461 stop_sensor(&App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle);
1462 }
1463 if (App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1464 {
1465 shutdown_sensor(&App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle);
1466 }
1467 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1468 if (App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1469 {
1470 stop_sensor(&App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle);
1471 }
1472 if (App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1473 {
1474 shutdown_sensor(&App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle);
1475 }
1476 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1477 if (App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1478 {
1479 stop_sensor(&App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle);
1480 }
1481 if (App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1482 {
1483 shutdown_sensor(&App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle);
1484 }
1485 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1486 if (App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1487 {
1488 stop_sensor(&App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle);
1489 }
1490 if (App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1491 {
1492 shutdown_sensor(&App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle);
1493 }
1494 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1495 if (App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1496 {
1497 stop_sensor(&App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle);
1498 }
1499 if (App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1500 {
1501 shutdown_sensor(&App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle);
1502 }
1503 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1504 if (App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1505 {
1506 stop_sensor(&App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle);
1507 }
1508 if (App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1509 {
1510 shutdown_sensor(&App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle);
1511 }
1512 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1513 if (App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1514 {
1515 stop_sensor(&App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle);
1516 }
1517 if (App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1518 {
1519 shutdown_sensor(&App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle);
1520 }
1521 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1522 if (App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1523 {
1524 stop_sensor(&App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle);
1525 }
1526 if (App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1527 {
1528 shutdown_sensor(&App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle);
1529 }
1530 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1531 if (App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1532 {
1533 stop_sensor(&App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle);
1534 }
1535 if (App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1536 {
1537 shutdown_sensor(&App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle);
1538 }
1539 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1540 if (App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1541 {
1542 stop_sensor(&App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle);
1543 }
1544 if (App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1545 {
1546 shutdown_sensor(&App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle);
1547 }
1548 // Return the Sensor back to the DSA_STATE_INITIALIZED.
1549 if (App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STARTED)
1550 {
1551 stop_sensor(&App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle);
1552 }
1553 if (App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle.adapterStatus == DSA_STATE_CONFIGURED_STOPPED)
1554 {
1555 shutdown_sensor(&App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle);
1556 }
1557 }
1558
1559 /*
1560 ** ===================================================================
1561 ** Method : App1_FlashSensor()
1562 **
1563 ** Description :
1564 ** This function is used to FLASH supported sensors. This is done
1565 ** with the assumption that the sensor is in the proper state where it can be flashed AND that error will
1566 ** be returned to a higher level, so don't try to check errors further here.
1567 ** Parameters :
1568 ** numBytes : Number of Bytes of Flash Data.
1569 ** pFlashData : pointer pointing to bytes of flash.
1570 ** Returns :
1571 ** Status : 0 on Success.
1572 ** ===================================================================
1573 */
1574 int8 App1_FlashSensor(uint8 numBytes, uint8 *pFlashData)
1575 {
1576 uint8 sensorSubscription = pFlashData[0];
1577 isf_SensorHandle_t *pSensorAdapterHandle;
1578
1579 if (sensorSubscription < gNumSupportedSensors)
1580 {
1581 pSensorAdapterHandle = gSensorHandleList[sensorSubscription];
1582 }
1583
1584 if(pFlashData && pSensorAdapterHandle->pSensorStaticConfig->pAdapter->control.Flash)
1585 return pSensorAdapterHandle->pSensorStaticConfig->pAdapter->control.Flash(pSensorAdapterHandle, pFlashData+1, numBytes-1);
1586 else
1587 return -1;
1588 }
1589
1590 /*
1591 ** ===================================================================
1592 ** Method : App1_GotoState()
1593 **
1594 ** Description :
1595 ** This function implements the App1 sensor subscription state machine.
1596 ** The implementation currently supports three states:
1597 ** App1_STATE_STOPPED_UNSUBSCRIBED = 0, // Sensor is Unsubscribed; Data Flow is Stopped (Initial State).
1598 ** App1_STATE_STOPPED_SUBSCRIBED = 1, // Sensor is Subscribed; Data Flow is Stopped.
1599 ** App1_STATE_STARTED_SUBSCRIBED = 2, // Sensor is Subscribed; Data Flow has Started.
1600 ** As the state machine transitions between the states, it makes calls to the ISF Sensor Manager
1601 ** functions as necessary.
1602 ** This method is internal. It is used by Processor Expert only.
1603 ** Parameters :
1604 ** NAME DESCRIPTION
1605 ** desiredState The desiredstate for the application at the
1606 ** completion of the function call.
1607 ** pAppPacket Pointer to the response data.
1608 ** Returns :
1609 ** returns an int32 value indicating the status of its operation.
1610 ** ===================================================================
1611 */
1612 int32 App1_GotoState(uint8 desiredState)
1613 {
1614 isf_status_t smstt = 0;
1615 int32 retval = 0;
1616
1617 // Check that the desired state is within range, otherwise return an error.
1618 if (desiredState > App1_STATE_STARTED_SUBSCRIBED)
1619 {
1620 return 1;
1621 }
1622
1623 // Loop until the desired state is reached or an error occurs.
1624 while ( !smstt && (desiredState != GET_FIELD(CTRL_STATE,App1AppInstance.settings.control)) )
1625 {
1626 switch ( GET_FIELD(CTRL_STATE,App1AppInstance.settings.control) )
1627 {
1628 case App1_STATE_STOPPED_UNSUBSCRIBED:
1629 // The only valid transition from current state is to stopped, subscribed.
1630 // Subscribe to the sensor data.
1631 smstt = ISF_SUCCESS;
1632
1633 smstt |= configure_sensor(
1634 &App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle,
1635 &App1AppInstance.settings.AccelerometerSettings_Sub0,
1636 &App1AppInstance.fifos.AccelerometerDataFifo_Sub0);
1637 smstt |= configure_sensor(
1638 &App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle,
1639 &App1AppInstance.settings.AccelerometerSettings_Sub1,
1640 &App1AppInstance.fifos.AccelerometerDataFifo_Sub1);
1641 smstt |= configure_sensor(
1642 &App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle,
1643 &App1AppInstance.settings.AccelerometerSettings_Sub2,
1644 &App1AppInstance.fifos.AccelerometerDataFifo_Sub2);
1645 smstt |= configure_sensor(
1646 &App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle,
1647 &App1AppInstance.settings.AccelerometerSettings_Sub3,
1648 &App1AppInstance.fifos.AccelerometerDataFifo_Sub3);
1649 smstt |= configure_sensor(
1650 &App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle,
1651 &App1AppInstance.settings.AccelerometerSettings_Sub4,
1652 &App1AppInstance.fifos.AccelerometerDataFifo_Sub4);
1653 smstt |= configure_sensor(
1654 &App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle,
1655 &App1AppInstance.settings.AccelerometerSettings_Sub5,
1656 &App1AppInstance.fifos.AccelerometerDataFifo_Sub5);
1657 smstt |= configure_sensor(
1658 &App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle,
1659 &App1AppInstance.settings.AccelerometerSettings_Sub6,
1660 &App1AppInstance.fifos.AccelerometerDataFifo_Sub6);
1661 smstt |= configure_sensor(
1662 &App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle,
1663 &App1AppInstance.settings.AccelerometerSettings_Sub7,
1664 &App1AppInstance.fifos.AccelerometerDataFifo_Sub7);
1665 smstt |= configure_sensor(
1666 &App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle,
1667 &App1AppInstance.settings.MagnetometerSettings_Sub8,
1668 &App1AppInstance.fifos.MagnetometerDataFifo_Sub8);
1669 smstt |= configure_sensor(
1670 &App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle,
1671 &App1AppInstance.settings.MagnetometerSettings_Sub9,
1672 &App1AppInstance.fifos.MagnetometerDataFifo_Sub9);
1673 smstt |= configure_sensor(
1674 &App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle,
1675 &App1AppInstance.settings.GyrometerSettings_Sub10,
1676 &App1AppInstance.fifos.GyrometerDataFifo_Sub10);
1677 smstt |= configure_sensor(
1678 &App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle,
1679 &App1AppInstance.settings.GyrometerSettings_Sub11,
1680 &App1AppInstance.fifos.GyrometerDataFifo_Sub11);
1681 smstt |= configure_sensor(
1682 &App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle,
1683 &App1AppInstance.settings.PressureSettings_Sub12,
1684 &App1AppInstance.fifos.PressureDataFifo_Sub12);
1685 smstt |= configure_sensor(
1686 &App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle,
1687 &App1AppInstance.settings.TemperatureSettings_Sub13,
1688 &App1AppInstance.fifos.TemperatureDataFifo_Sub13);
1689 smstt |= configure_sensor(
1690 &App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle,
1691 &App1AppInstance.settings.OrientationSettings_Sub14,
1692 &App1AppInstance.fifos.OrientationDataFifo_Sub14);
1693 smstt |= configure_sensor(
1694 &App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle,
1695 &App1AppInstance.settings.AltitudeSettings_Sub15,
1696 &App1AppInstance.fifos.AltitudeDataFifo_Sub15);
1697 smstt |= configure_sensor(
1698 &App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle,
1699 &App1AppInstance.settings.PedometerSettings_Sub16,
1700 &App1AppInstance.fifos.PedometerDataFifo_Sub16);
1701 smstt |= configure_sensor(
1702 &App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle,
1703 &App1AppInstance.settings.PedometerSettings_Sub17,
1704 &App1AppInstance.fifos.PedometerDataFifo_Sub17);
1705 smstt |= configure_sensor(
1706 &App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle,
1707 &App1AppInstance.settings.CustomSettings_Sub18,
1708 &App1AppInstance.fifos.CustomDataFifo_Sub18);
1709 smstt |= configure_sensor(
1710 &App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle,
1711 &App1AppInstance.settings.AnalogSettings_Sub19,
1712 &App1AppInstance.fifos.AnalogDataFifo_Sub19);
1713 if (smstt != ISF_SUCCESS) {
1714 App1_ReturnSensorsToInit();
1715 retval = 1;
1716 }
1717 else
1718 {
1719 // State transition.
1720 App1AppInstance.settings.control = (App1AppInstance.settings.control & ~CTRL_STATE_MASK) |
1721 SET_FIELD(CTRL_STATE,App1_STATE_STOPPED_SUBSCRIBED);
1722 }
1723 break;
1724
1725 case App1_STATE_STARTED_SUBSCRIBED:
1726 // The only valid transition from the current state is to the stopped, subscribed state.
1727 smstt = ISF_SUCCESS;
1728 // End subscription to the sensor data.
1729 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle);
1730 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle);
1731 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle);
1732 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle);
1733 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle);
1734 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle);
1735 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle);
1736 smstt |= stop_sensor(&App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle);
1737 smstt |= stop_sensor(&App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle);
1738 smstt |= stop_sensor(&App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle);
1739 smstt |= stop_sensor(&App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle);
1740 smstt |= stop_sensor(&App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle);
1741 smstt |= stop_sensor(&App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle);
1742 smstt |= stop_sensor(&App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle);
1743 smstt |= stop_sensor(&App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle);
1744 smstt |= stop_sensor(&App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle);
1745 smstt |= stop_sensor(&App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle);
1746 smstt |= stop_sensor(&App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle);
1747 smstt |= stop_sensor(&App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle);
1748 smstt |= stop_sensor(&App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle);
1749 if (smstt != ISF_SUCCESS) {
1750 App1_ReturnSensorsToInit();
1751 retval = 1;
1752 }
1753 else
1754 {
1755 // State transition.
1756 App1AppInstance.settings.control = (App1AppInstance.settings.control & ~CTRL_STATE_MASK) |
1757 SET_FIELD(CTRL_STATE,App1_STATE_STOPPED_SUBSCRIBED);
1758 }
1759 break;
1760
1761 case App1_STATE_STOPPED_SUBSCRIBED:
1762 // From the current state, the valid transitions are to the stopped, unsubscribed, or started, subscribed states.
1763 smstt = ISF_SUCCESS;
1764 if (desiredState)
1765 {
1766 // Begin subscription to the sensor data.
1767 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle);
1768 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle);
1769 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle);
1770 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle);
1771 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle);
1772 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle);
1773 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle);
1774 smstt |= start_sensor(&App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle);
1775 smstt |= start_sensor(&App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle);
1776 smstt |= start_sensor(&App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle);
1777 smstt |= start_sensor(&App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle);
1778 smstt |= start_sensor(&App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle);
1779 smstt |= start_sensor(&App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle);
1780 smstt |= start_sensor(&App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle);
1781 smstt |= start_sensor(&App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle);
1782 smstt |= start_sensor(&App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle);
1783 smstt |= start_sensor(&App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle);
1784 smstt |= start_sensor(&App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle);
1785 smstt |= start_sensor(&App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle);
1786 smstt |= start_sensor(&App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle);
1787 if (smstt != ISF_SUCCESS) {
1788 App1_ReturnSensorsToInit();
1789 retval = 1;
1790 }
1791 else
1792 {
1793 // State transition.
1794 App1AppInstance.settings.control = (App1AppInstance.settings.control & ~CTRL_STATE_MASK) |
1795 SET_FIELD(CTRL_STATE,App1_STATE_STARTED_SUBSCRIBED);
1796 }
1797 }
1798 else
1799 {
1800 // Unsubscribe from the sensor adapter data.
1801 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub0.smAdapterHandle);
1802 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub1.smAdapterHandle);
1803 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub2.smAdapterHandle);
1804 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub3.smAdapterHandle);
1805 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub4.smAdapterHandle);
1806 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub5.smAdapterHandle);
1807 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub6.smAdapterHandle);
1808 smstt |= shutdown_sensor(&App1AppInstance.info.AccelerometerInfo_Sub7.smAdapterHandle);
1809 smstt |= shutdown_sensor(&App1AppInstance.info.MagnetometerInfo_Sub8.smAdapterHandle);
1810 smstt |= shutdown_sensor(&App1AppInstance.info.MagnetometerInfo_Sub9.smAdapterHandle);
1811 smstt |= shutdown_sensor(&App1AppInstance.info.GyrometerInfo_Sub10.smAdapterHandle);
1812 smstt |= shutdown_sensor(&App1AppInstance.info.GyrometerInfo_Sub11.smAdapterHandle);
1813 smstt |= shutdown_sensor(&App1AppInstance.info.PressureInfo_Sub12.smAdapterHandle);
1814 smstt |= shutdown_sensor(&App1AppInstance.info.TemperatureInfo_Sub13.smAdapterHandle);
1815 smstt |= shutdown_sensor(&App1AppInstance.info.OrientationInfo_Sub14.smAdapterHandle);
1816 smstt |= shutdown_sensor(&App1AppInstance.info.AltitudeInfo_Sub15.smAdapterHandle);
1817 smstt |= shutdown_sensor(&App1AppInstance.info.PedometerInfo_Sub16.smAdapterHandle);
1818 smstt |= shutdown_sensor(&App1AppInstance.info.PedometerInfo_Sub17.smAdapterHandle);
1819 smstt |= shutdown_sensor(&App1AppInstance.info.CustomInfo_Sub18.smAdapterHandle);
1820 smstt |= shutdown_sensor(&App1AppInstance.info.AnalogInfo_Sub19.smAdapterHandle);
1821 if (smstt != ISF_SUCCESS) {
1822 App1_ReturnSensorsToInit();
1823 retval = 1;
1824 } else {
1825 // State transition.
1826 App1AppInstance.settings.control = (App1AppInstance.settings.control & ~CTRL_STATE_MASK) |
1827 SET_FIELD(CTRL_STATE,App1_STATE_STOPPED_UNSUBSCRIBED);
1828 }
1829 }
1830 break;
1831
1832 default:
1833 // This is an invalid current state.
1834 retval = 1;
1835 }
1836 }
1837 return retval;
1838 }
1839
1840 /*
1841 ** ===================================================================
1842 ** Method : SettingsCompare()
1843 **
1844 ** Description :
1845 ** This function compares the members of the App1AppSettings_t C structure
1846 ** because C does not automatically provide for comparison of structures.
1847 ** This method is internal. It is used by Processor Expert only.
1848 ** Parameters :
1849 ** NAME DESCRIPTION
1850 ** s1 A pointer to the first structure to compare
1851 ** s2 A pointer to the second structure to compare
1852 ** Returns :
1853 ** 0 The structures are equivalent. 1 The structures are different.
1854 ** ===================================================================
1855 */
1856 static int32 SettingsCompare(const isf_SubscriptionSettings_t *s1, const isf_SubscriptionSettings_t *s2)
1857 {
1858 return (
1859 (s1->resultType != s2->resultType) ||
1860 (s1->resultFormat != s2->resultFormat) ||
1861 (s1->nSettingsToUse != s2->nSettingsToUse) ||
1862 (s1->nFifoDepth != s2->nFifoDepth) ||
1863 (s1->nSamplePeriod != s2->nSamplePeriod));
1864 }
1865
1866 /*
1867 ** ===================================================================
1868 ** Method : SmSettingsCompare()
1869 **
1870 ** Description :
1871 ** This function compares the members of the App1AppConfig_t C structure
1872 ** because C does not automatically provide for comparison of structures.
1873 ** This method is internal. It is used by Processor Expert only.
1874 ** Parameters :
1875 ** NAME DESCRIPTION
1876 ** s1 A pointer to the first structure to compare
1877 ** s2 A pointer to the second structure to compare
1878 ** Returns :
1879 ** 0 The structures are equivalent. 1 The structures are different.
1880 ** ===================================================================
1881 */
1882 static int32 SmSettingsCompare(const App1AppSettings_t *s1, const App1AppSettings_t *s2)
1883 {
1884 return (
1885 SettingsCompare(&s1->AccelerometerSettings_Sub0,&s2->AccelerometerSettings_Sub0) ||
1886 SettingsCompare(&s1->AccelerometerSettings_Sub1,&s2->AccelerometerSettings_Sub1) ||
1887 SettingsCompare(&s1->AccelerometerSettings_Sub2,&s2->AccelerometerSettings_Sub2) ||
1888 SettingsCompare(&s1->AccelerometerSettings_Sub3,&s2->AccelerometerSettings_Sub3) ||
1889 SettingsCompare(&s1->AccelerometerSettings_Sub4,&s2->AccelerometerSettings_Sub4) ||
1890 SettingsCompare(&s1->AccelerometerSettings_Sub5,&s2->AccelerometerSettings_Sub5) ||
1891 SettingsCompare(&s1->AccelerometerSettings_Sub6,&s2->AccelerometerSettings_Sub6) ||
1892 SettingsCompare(&s1->AccelerometerSettings_Sub7,&s2->AccelerometerSettings_Sub7) ||
1893 SettingsCompare(&s1->MagnetometerSettings_Sub8,&s2->MagnetometerSettings_Sub8) ||
1894 SettingsCompare(&s1->MagnetometerSettings_Sub9,&s2->MagnetometerSettings_Sub9) ||
1895 SettingsCompare(&s1->GyrometerSettings_Sub10,&s2->GyrometerSettings_Sub10) ||
1896 SettingsCompare(&s1->GyrometerSettings_Sub11,&s2->GyrometerSettings_Sub11) ||
1897 SettingsCompare(&s1->PressureSettings_Sub12,&s2->PressureSettings_Sub12) ||
1898 SettingsCompare(&s1->TemperatureSettings_Sub13,&s2->TemperatureSettings_Sub13) ||
1899 SettingsCompare(&s1->OrientationSettings_Sub14,&s2->OrientationSettings_Sub14) ||
1900 SettingsCompare(&s1->AltitudeSettings_Sub15,&s2->AltitudeSettings_Sub15) ||
1901 SettingsCompare(&s1->PedometerSettings_Sub16,&s2->PedometerSettings_Sub16) ||
1902 SettingsCompare(&s1->PedometerSettings_Sub17,&s2->PedometerSettings_Sub17) ||
1903 SettingsCompare(&s1->CustomSettings_Sub18,&s2->CustomSettings_Sub18) ||
1904 SettingsCompare(&s1->AnalogSettings_Sub19,&s2->AnalogSettings_Sub19) ||
1905 (1 != 1));
1906 }
1907 /* END App1. */
1908 /*!
1909 ** @}
1910 */
1911 /*
1912 ** ###################################################################
1913 **
1914 ** This file was created by Processor Expert 10.5 [05.21]
1915 ** for the Freescale Kinetis series of microcontrollers.
1916 **
1917 ** ###################################################################
1918 */
App1SensorData_t::rawAccelerometerData_Sub7
DATA_TYPE_SUB7 rawAccelerometerData_Sub7[DATA_FIFO_LEN_SUB7]
Definition: App1_types.h:168
DATA_FIFO_LEN_SUB8
#define DATA_FIFO_LEN_SUB8
Definition: App1_types.h:90
App1AppInstance_t::info
struct App1AppInstance_t::@1 info
appSubscriptionResponse_t::processedDataBufferOffset
uint16 processedDataBufferOffset
Definition: App1.c:353
App1AppInstance_t::PressureInfo_Sub12
SensorInfo_t PressureInfo_Sub12
Definition: App1_types.h:242
App1AppInstance_t::GyrometerDataFifo_Sub11
isf_fifo_t GyrometerDataFifo_Sub11
Definition: App1_types.h:264
isf_target.h
ISF board support header files.
App1_Pedometer16_DATA_READY_EVENT
#define App1_Pedometer16_DATA_READY_EVENT
Definition: App1_types.h:149
uint8
unsigned char uint8
Definition: isf_types.h:76
App1_ALL_SENSOR_DATA_READY
#define App1_ALL_SENSOR_DATA_READY
Definition: App1_types.h:157
isf_sensor_configuration_extern.h
The isf_sensor_configuration_extern.h contains external declarations referenced by the Sensor Manager...
SensorInfo_t::smAdapterHandle
isf_SensorHandle_t smAdapterHandle
Definition: App1_types.h:193
App1AppInstance_t
Definition: App1_types.h:223
App1SensorData_t::rawAccelerometerData_Sub1
DATA_TYPE_SUB1 rawAccelerometerData_Sub1[DATA_FIFO_LEN_SUB1]
Definition: App1_types.h:162
DSA_MMA8491Q_1
Definition: isf_sensor_configuration.h:35
App1AppInstance_t::smLWEvent
event_t smLWEvent
Definition: App1_types.h:226
DSA_FXLC95000_2
Definition: isf_sensor_configuration.h:27
CI_CMD_READ_CONFIG
Definition: isf_ci.h:74
App1AppInstance_t::GyrometerInfo_Sub10
SensorInfo_t GyrometerInfo_Sub10
Definition: App1_types.h:240
ci_host_cmd_packet_t::byte_cnt
uint8 byte_cnt
Definition: isf_ci.h:209
ci_host_cmd_packet_t::offset
uint16 offset
Definition: isf_ci.h:206
stop_sensor
int32 stop_sensor(isf_SensorHandle_t *pSensorAdapterHandle)
Definition: isf_dsa_direct.c:119
App1_Accelerometer2_DATA_READY_EVENT
#define App1_Accelerometer2_DATA_READY_EVENT
Definition: App1_types.h:121
App1AppSettings_t::AccelerometerSettings_Sub7
isf_SubscriptionSettings_t AccelerometerSettings_Sub7
Definition: App1_types.h:207
CI_MAX_FLASH_BYTES
#define CI_MAX_FLASH_BYTES
Definition: isf_ci.h:180
App1.h
ISF_EMB_APP
ISF Application Type for Embedded Application.
Definition: isf.h:55
App1AppSettings_t::PressureSettings_Sub12
isf_SubscriptionSettings_t PressureSettings_Sub12
Definition: App1_types.h:212
isf_magnetometer_types.h
The isf_magnetometer_types.h file contains the ISF data type definitions for use with the ISF generic...
App1AppInstance_t::outputBufferLock
semaphore_t outputBufferLock
Definition: App1_types.h:227
App1AppInstance_t::AccelerometerInfo_Sub4
SensorInfo_t AccelerometerInfo_Sub4
Definition: App1_types.h:234
ISF_SUCCESS
Definition: isf.h:31
App1SensorData_t::rawAccelerometerData_Sub6
DATA_TYPE_SUB6 rawAccelerometerData_Sub6[DATA_FIFO_LEN_SUB6]
Definition: App1_types.h:167
fsl_Sensor_Analog_1_Functions.h
This is user's event module. Put your event handler code here.
pseudoSettings_t::control
uint8 control
Definition: App1.c:340
DSA_MMA865x_1
Definition: isf_sensor_configuration.h:36
App1_init
void App1_init(void)
Definition: App1.c:397
isf_ci_stream.h
ISF Command Interpreter (CI) stream protocol header file.
isf_system_sync
void isf_system_sync(void)
This function synchronizes the user tasks and the system initialization.
Definition: isf_init.c:50
App1AppInstance
App1AppInstance_t App1AppInstance
Definition: App1.c:300
App1_TASK_NAME
#define App1_TASK_NAME
Definition: App1.c:236
App1_MainTask
void App1_MainTask(void)
Definition: App1.c:426
isf_fifo_lock
isf_fifo_status_t isf_fifo_lock(isf_fifo_t *pFifo)
Lock a sample buffer for exclusive access.
Definition: isf_fifo.c:170
App1AppInstance_t::MagnetometerInfo_Sub9
SensorInfo_t MagnetometerInfo_Sub9
Definition: App1_types.h:239
isf_fifo_unlock
isf_fifo_status_t isf_fifo_unlock(isf_fifo_t *pFifo)
Release the exclusive access lock on a sample buffer.
Definition: isf_fifo.c:199
App1SensorData_t::rawCustomData_Sub18
DATA_TYPE_SUB18 rawCustomData_Sub18[DATA_FIFO_LEN_SUB18]
Definition: App1_types.h:179
DATA_TYPE_SUB8
#define DATA_TYPE_SUB8
Definition: App1_types.h:91
App1_ci_app_callback
ci_response_t App1_ci_app_callback(ci_host_cmd_packet_t *pHostPacket, ci_app_resp_packet_t *pAppPacket)
Definition: App1.c:1067
DATA_FIFO_LEN_SUB14
#define DATA_FIFO_LEN_SUB14
Definition: App1_types.h:102
SensorConfig_st::pAdapter
const isf_dsa_Adapter_t * pAdapter
Definition: isf_dsa_adapter.h:156
App1_Accelerometer5_DATA_READY_EVENT
#define App1_Accelerometer5_DATA_READY_EVENT
Definition: App1_types.h:127
DSA_STATE_CONFIGURED_STARTED
Definition: isf_dsa_adapter.h:60
App1SensorData_t::rawAnalogData_Sub19
DATA_TYPE_SUB19 rawAnalogData_Sub19[DATA_FIFO_LEN_SUB19]
Definition: App1_types.h:180
App1_Gyrometer11_DATA_READY_EVENT
#define App1_Gyrometer11_DATA_READY_EVENT
Definition: App1_types.h:139
CTRL_POWER_MASK
#define CTRL_POWER_MASK
Definition: App1.c:290
App1_Gyrometer10_DATA_READY_EVENT
#define App1_Gyrometer10_DATA_READY_EVENT
Definition: App1_types.h:137
SET_FIELD
#define SET_FIELD(name, val)
Macro that extracts one of the fields below.
Definition: App1.c:280
DATA_FIFO_LEN_SUB5
#define DATA_FIFO_LEN_SUB5
Definition: App1_types.h:84
App1AppInstance_t::AccelerometerInfo_Sub3
SensorInfo_t AccelerometerInfo_Sub3
Definition: App1_types.h:233
DSA_MMA955x_2
Definition: isf_sensor_configuration.h:38
App1AppInstance_t::AltitudeInfo_Sub15
SensorInfo_t AltitudeInfo_Sub15
Definition: App1_types.h:245
DATA_FIFO_LEN_SUB18
#define DATA_FIFO_LEN_SUB18
Definition: App1_types.h:110
App1SensorData_t::rawMagnetometerData_Sub8
DATA_TYPE_SUB8 rawMagnetometerData_Sub8[DATA_FIFO_LEN_SUB8]
Definition: App1_types.h:169
isf_pedometer_types.h
App1SensorData_t::rawAccelerometerData_Sub4
DATA_TYPE_SUB4 rawAccelerometerData_Sub4[DATA_FIFO_LEN_SUB4]
Definition: App1_types.h:165
CI_ERROR_COMMAND
Definition: isf_ci.h:137
App1AppInstance_t::AccelerometerInfo_Sub7
SensorInfo_t AccelerometerInfo_Sub7
Definition: App1_types.h:237
App1AppInstance_t::AccelerometerInfo_Sub2
SensorInfo_t AccelerometerInfo_Sub2
Definition: App1_types.h:232
App1_Accelerometer0_DATA_READY_EVENT
#define App1_Accelerometer0_DATA_READY_EVENT
Definition: App1_types.h:117
isf_SensorHandle_st
This defines the DSA sensor device handle structure used to invoke the adapter access functions...
Definition: isf_dsa_adapter.h:107
App1AppInstance_t::AccelerometerDataFifo_Sub1
isf_fifo_t AccelerometerDataFifo_Sub1
Definition: App1_types.h:254
isf_fifo_el_clear
isf_fifo_status_t isf_fifo_el_clear(isf_fifo_t *pFifo)
Routine to clear the fifo.
Definition: isf_fifo.c:217
App1AppInstance_t::AltitudeDataFifo_Sub15
isf_fifo_t AltitudeDataFifo_Sub15
Definition: App1_types.h:268
App1_Custom18_DATA_READY_EVENT
#define App1_Custom18_DATA_READY_EVENT
Definition: App1_types.h:153
isf_SubscriptionSettings_t::resultFormat
isf_dsa_result_types_t resultFormat
The format of the data to be returned- 0=RAW, 1=FIXED, 2=FLOAT.
Definition: isf_dsa_direct_types.h:25
DATA_TYPE_SUB19
#define DATA_TYPE_SUB19
Definition: App1_types.h:113
DATA_TYPE_SUB15
#define DATA_TYPE_SUB15
Definition: App1_types.h:105
isf_dsa_Adapter_st::control
isf_dsa_ControlInterface_t control
Definition: isf_dsa_adapter.h:147
DSA_ORIENT_1
Definition: isf_sensor_configuration.h:40
App1AppSettings_t::AnalogSettings_Sub19
isf_SubscriptionSettings_t AnalogSettings_Sub19
Definition: App1_types.h:219
App1SensorData_t::rawPedometerData_Sub16
DATA_TYPE_SUB16 rawPedometerData_Sub16[DATA_FIFO_LEN_SUB16]
Definition: App1_types.h:177
App1AppSettings_t::OrientationSettings_Sub14
isf_SubscriptionSettings_t OrientationSettings_Sub14
Definition: App1_types.h:214
DATA_TYPE_SUB0
#define DATA_TYPE_SUB0
Definition: App1_types.h:75
App1_Accelerometer3_DATA_READY_EVENT
#define App1_Accelerometer3_DATA_READY_EVENT
Definition: App1_types.h:123
DATA_FIFO_LEN_SUB10
#define DATA_FIFO_LEN_SUB10
Definition: App1_types.h:94
CI_CMD_UPDATE_QUICKREAD
Definition: isf_ci.h:83
DATA_TYPE_SUB17
#define DATA_TYPE_SUB17
Definition: App1_types.h:109
App1SensorData_t::rawGyrometerData_Sub11
DATA_TYPE_SUB11 rawGyrometerData_Sub11[DATA_FIFO_LEN_SUB11]
Definition: App1_types.h:172
App1_STATE_STOPPED_UNSUBSCRIBED
Definition: App1_types.h:186
isf_sensor_configuration.h
The isf_sensor_configuration.h contains the enumerated list of Digital Sensor Abstraction (DSA) senso...
isf_dsa_ControlInterface_st::Flash
isf_dsa_status_t(* Flash)(isf_SensorHandle_t *pSensorHandle, void *pFlashData, uint8 numBytes)
Definition: isf_dsa_adapter.h:135
App1_Functions.h
This is user's event module. Put your event handler code here.
ci_host_cmd_packet_t::cmd
uint8 cmd
Definition: isf_ci.h:203
startof
#define startof(type, member)
Definition: App1.c:274
SensorInfo_t::sensorId
uint8 sensorId
Definition: App1_types.h:194
DATA_TYPE_SUB2
#define DATA_TYPE_SUB2
Definition: App1_types.h:79
DSA_FXOS8700_2
Definition: isf_sensor_configuration.h:32
SensorInfo_t
Definition: App1_types.h:192
App1AppInstance_t::AccelerometerDataFifo_Sub5
isf_fifo_t AccelerometerDataFifo_Sub5
Definition: App1_types.h:258
App1AppInstance_t::AccelerometerDataFifo_Sub7
isf_fifo_t AccelerometerDataFifo_Sub7
Definition: App1_types.h:260
App1_GotoState
int32 App1_GotoState(uint8 desiredState)
Definition: App1.c:1612
App1_ProcessData
void App1_ProcessData(void *pProcessedDataBuffer, int32_t signalledEvents)
Definition: App1_Functions.c:79
ci_app_resp_packet_t::bytes_xfer
uint8 bytes_xfer
Definition: isf_ci.h:233
init_sensor
int32 init_sensor(uint8 nSensorID, isf_SensorHandle_t *pSensorAdapterHandle, event_t *pEventGroup, uint32 nEventFieldIndex)
This function initializes the sensor adapters in the absence of the Sensor Manager.
Definition: isf_dsa_direct.c:41
App1_Pedometer17_DATA_READY_EVENT
#define App1_Pedometer17_DATA_READY_EVENT
Definition: App1_types.h:151
App1_app_info_t::appType
uint8 appType
ISF Embedded Application type.
Definition: App1_types.h:20
isf_dsa_direct.h
App1SensorData_t::rawGyrometerData_Sub10
DATA_TYPE_SUB10 rawGyrometerData_Sub10[DATA_FIFO_LEN_SUB10]
Definition: App1_types.h:171
DSA_FXLS8471_2
Definition: isf_sensor_configuration.h:29
App1_APP_DATA
#define App1_APP_DATA
Definition: App1_types.h:9
App1_app_info_t
Definition: App1_types.h:17
App1AppInstance_t::AccelerometerInfo_Sub6
SensorInfo_t AccelerometerInfo_Sub6
Definition: App1_types.h:236
App1AppInstance_t::AccelerometerDataFifo_Sub2
isf_fifo_t AccelerometerDataFifo_Sub2
Definition: App1_types.h:255
DATA_TYPE_SUB13
#define DATA_TYPE_SUB13
Definition: App1_types.h:101
NUM_SENSORS
#define NUM_SENSORS
Macro thats holds number of active sensors.
Definition: App1.c:277
isf_SubscriptionSettings_t::nFifoDepth
uint8 nFifoDepth
1 = no FIFO, or another value < SM_MAX_FIFO_DEPTH
Definition: isf_dsa_direct_types.h:28
App1_TASK_STACK_SIZE
#define App1_TASK_STACK_SIZE
Definition: App1.c:238
App1AppInstance_t::AccelerometerDataFifo_Sub4
isf_fifo_t AccelerometerDataFifo_Sub4
Definition: App1_types.h:257
App1SensorData_t::rawPressureData_Sub12
DATA_TYPE_SUB12 rawPressureData_Sub12[DATA_FIFO_LEN_SUB12]
Definition: App1_types.h:173
App1AppSettings_t::AccelerometerSettings_Sub1
isf_SubscriptionSettings_t AccelerometerSettings_Sub1
Definition: App1_types.h:201
DSA_FXAS21002_1
Definition: isf_sensor_configuration.h:24
isf_pm.h
isf_pm.h describes the API definitions, types, and macros for the Intelligent Sensing Framework (ISF)...
isf_types.h
The isf_types.h file contains the ISF data type definitions and some of the globally used macros...
App1SensorData_t::rawAccelerometerData_Sub0
DATA_TYPE_SUB0 rawAccelerometerData_Sub0[DATA_FIFO_LEN_SUB0]
Definition: App1_types.h:161
App1AppSettings_t::AccelerometerSettings_Sub5
isf_SubscriptionSettings_t AccelerometerSettings_Sub5
Definition: App1_types.h:205
isf_pressure_types.h
The isf_pressure_types.h file contains the ISF data type definitions for use with the ISF generic pre...
App1_ReturnSensorsToInit
void App1_ReturnSensorsToInit()
Definition: App1.c:1375
App1AppInstance_t::GyrometerInfo_Sub11
SensorInfo_t GyrometerInfo_Sub11
Definition: App1_types.h:241
gNumSupportedSensors
uint8 gNumSupportedSensors
This is the external declaration of the current number of available sensors.
Definition: isf_sensor_configuration.c:64
DATA_FIFO_LEN_SUB12
#define DATA_FIFO_LEN_SUB12
Definition: App1_types.h:98
App1AppSettings_t::AccelerometerSettings_Sub2
isf_SubscriptionSettings_t AccelerometerSettings_Sub2
Definition: App1_types.h:202
App1AppInstance_t::PressureDataFifo_Sub12
isf_fifo_t PressureDataFifo_Sub12
Definition: App1_types.h:265
App1AppSettings_t::MagnetometerSettings_Sub9
isf_SubscriptionSettings_t MagnetometerSettings_Sub9
Definition: App1_types.h:209
DATA_TYPE_SUB18
#define DATA_TYPE_SUB18
Definition: App1_types.h:111
App1AppInstance_t::GyrometerDataFifo_Sub10
isf_fifo_t GyrometerDataFifo_Sub10
Definition: App1_types.h:263
App1AppInstance_t::OrientationInfo_Sub14
SensorInfo_t OrientationInfo_Sub14
Definition: App1_types.h:244
isf_gyrometer_types.h
The isf_gyrometer_types.h file contains the ISF data type definitions for use with the ISF generic gy...
appSubscriptionResponse_t::numSensors
uint8 numSensors
Definition: App1.c:352
DATA_TYPE_SUB11
#define DATA_TYPE_SUB11
Definition: App1_types.h:97
App1AppInstance_t::settings
App1AppSettings_t settings
Definition: App1_types.h:251
App1AppSettings_t::control
uint8 control
Definition: App1_types.h:199
App1AppSettings_t::PedometerSettings_Sub16
isf_SubscriptionSettings_t PedometerSettings_Sub16
Definition: App1_types.h:216
os_task_param_t
task_param_t os_task_param_t
Definition: mqx_ksdk.h:354
App1AppInstance_t::data
App1SensorData_t data
Definition: App1_types.h:274
appSubscriptionResponse_t
This structure holds the ISF application subscriptions information in the "GET_APP_SUBSCRIPTION" CI c...
Definition: App1.c:351
App1AppInstance_t::MagnetometerDataFifo_Sub8
isf_fifo_t MagnetometerDataFifo_Sub8
Definition: App1_types.h:261
isf_fifo_status_t
uint32 isf_fifo_status_t
Definition: isf_fifo.h:16
DATA_FIFO_LEN_SUB17
#define DATA_FIFO_LEN_SUB17
Definition: App1_types.h:108
App1_Initialization
void App1_Initialization()
Definition: App1_Functions.c:60
App1SensorData_t::rawAccelerometerData_Sub5
DATA_TYPE_SUB5 rawAccelerometerData_Sub5[DATA_FIFO_LEN_SUB5]
Definition: App1_types.h:166
CI_CMD_GET_APP_SUBSCRIPTION
Definition: isf_ci.h:98
App1AppSettings_t::AccelerometerSettings_Sub4
isf_SubscriptionSettings_t AccelerometerSettings_Sub4
Definition: App1_types.h:204
isf_util.h
The isf_util.h file contains the utility method declarations and macros.
isf_dsa_result_types_t
enum isf_dsa_result_enums isf_dsa_result_types_t
configure_sensor
int32 configure_sensor(isf_SensorHandle_t *pSensorAdapterHandle, isf_SubscriptionSettings_t *pRequiredSettings, isf_fifo_t *pfifo)
Definition: isf_dsa_direct.c:88
App1AppInstance_t::TemperatureInfo_Sub13
SensorInfo_t TemperatureInfo_Sub13
Definition: App1_types.h:243
DATA_FIFO_LEN_SUB7
#define DATA_FIFO_LEN_SUB7
Definition: App1_types.h:88
DATA_FIFO_LEN_SUB6
#define DATA_FIFO_LEN_SUB6
Definition: App1_types.h:86
DATA_TYPE_SUB10
#define DATA_TYPE_SUB10
Definition: App1_types.h:95
isf_lib_init
isf_status_t isf_lib_init(void *pNull)
API to get ISF information.
Definition: isf_init.c:18
App1AppInstance_t::AnalogInfo_Sub19
SensorInfo_t AnalogInfo_Sub19
Definition: App1_types.h:249
start_sensor
int32 start_sensor(isf_SensorHandle_t *pSensorAdapterHandle)
Definition: isf_dsa_direct.c:112
App1AppInstance_t::TemperatureDataFifo_Sub13
isf_fifo_t TemperatureDataFifo_Sub13
Definition: App1_types.h:266
DATA_TYPE_SUB7
#define DATA_TYPE_SUB7
Definition: App1_types.h:89
DATA_FIFO_LEN_SUB15
#define DATA_FIFO_LEN_SUB15
Definition: App1_types.h:104
DATA_FIFO_LEN_SUB16
#define DATA_FIFO_LEN_SUB16
Definition: App1_types.h:106
App1_STATE_STOPPED_SUBSCRIBED
Definition: App1_types.h:187
DSA_FXLS8471_1
Definition: isf_sensor_configuration.h:28
CI_CMD_READ_APP_DATA
Definition: isf_ci.h:80
isf_fifo_init
isf_fifo_status_t isf_fifo_init(isf_fifo_t *pFifo, void *pData, uint16 sampleSize, uint16 bufferCapacity)
Initializes a new fifo structure with a provided buffer.
Definition: isf_fifo.c:24
App1AppInstance_t::instance
struct App1AppInstance_t::@0 instance
DSA_FXAS21002_2
Definition: isf_sensor_configuration.h:25
subscriptionConfig_t::sensorDataType
isf_SensorDataTypes_t sensorDataType
Definition: App1.c:332
App1_Orientation14_DATA_READY_EVENT
#define App1_Orientation14_DATA_READY_EVENT
Definition: App1_types.h:145
CI_INVALID_COUNT
Definition: isf_ci.h:134
isf_ci_app_read
uint32 isf_ci_app_read(uint8 aAppId, uint32 anumBytes, uint8 *apDst)
This API reads data from the host via the mailboxes.
Definition: ci_protocol_mbox.c:226
isf_ci_app_write
uint32 isf_ci_app_write(uint8 aAppId, uint32 anumBytes, uint8 *apSrc)
This API writes data to the host via the mailboxes.
Definition: ci_protocol_mbox.c:277
subscriptionConfig_t
This structure holds the sensor subscriptions configuration info.
Definition: App1.c:330
App1AppInstance_t::PedometerDataFifo_Sub17
isf_fifo_t PedometerDataFifo_Sub17
Definition: App1_types.h:270
DSA_FXOS8700_1
Definition: isf_sensor_configuration.h:31
App1AppInstance_t::AccelerometerInfo_Sub0
SensorInfo_t AccelerometerInfo_Sub0
Definition: App1_types.h:230
App1_Accelerometer6_DATA_READY_EVENT
#define App1_Accelerometer6_DATA_READY_EVENT
Definition: App1_types.h:129
DATA_FIFO_LEN_SUB0
#define DATA_FIFO_LEN_SUB0
Definition: App1_types.h:74
CI_CMD_WRITE_SREC_FLASH
Definition: isf_ci.h:101
isf_SensorDataTypes_t
isf_SensorDataTypes_t
Definition: isf_sensor_types.h:61
App1AppSettings_t::AccelerometerSettings_Sub0
isf_SubscriptionSettings_t AccelerometerSettings_Sub0
Definition: App1_types.h:200
App1_Altitude15_DATA_READY_EVENT
#define App1_Altitude15_DATA_READY_EVENT
Definition: App1_types.h:147
Events.h
This is user's event module. Put your event handler code here.
isf_altitude_types.h
The isf_altitude_types.h file contains the ISF data type definitions for use with the ISF generic alt...
isf_temperature_types.h
The isf_temperature_fixed_t.h file contains the ISF data type definitions for use with the ISF generi...
App1_STATE_STARTED_SUBSCRIBED
Definition: App1_types.h:188
App1SensorData_t::rawOrientationData_Sub14
DATA_TYPE_SUB14 rawOrientationData_Sub14[DATA_FIFO_LEN_SUB14]
Definition: App1_types.h:175
App1_Temperature13_DATA_READY_EVENT
#define App1_Temperature13_DATA_READY_EVENT
Definition: App1_types.h:143
DATA_FIFO_LEN_SUB19
#define DATA_FIFO_LEN_SUB19
Definition: App1_types.h:112
isf_SensorHandle_st::pSensorStaticConfig
const isf_SensorConfig_t * pSensorStaticConfig
Definition: isf_dsa_adapter.h:110
App1SensorData_t::rawAccelerometerData_Sub2
DATA_TYPE_SUB2 rawAccelerometerData_Sub2[DATA_FIFO_LEN_SUB2]
Definition: App1_types.h:163
isf_SubscriptionSettings_t::resultType
isf_SensorDataTypes_t resultType
The desired data type of the subscription.
Definition: isf_dsa_direct_types.h:24
subscriptionConfig_t::sampleRateOffset
uint16 sampleRateOffset
Definition: App1.c:334
DATA_FIFO_LEN_SUB11
#define DATA_FIFO_LEN_SUB11
Definition: App1_types.h:96
App1AppInstance_t::AccelerometerInfo_Sub5
SensorInfo_t AccelerometerInfo_Sub5
Definition: App1_types.h:235
isf.h
Main ISF header file. Contains code common to all ISF components.
App1AppSettings_t::AccelerometerSettings_Sub3
isf_SubscriptionSettings_t AccelerometerSettings_Sub3
Definition: App1_types.h:203
App1_Magnetometer9_DATA_READY_EVENT
#define App1_Magnetometer9_DATA_READY_EVENT
Definition: App1_types.h:135
isf_SensorHandle_st::adapterStatus
isf_dsa_AdapterStatus_t adapterStatus
Definition: isf_dsa_adapter.h:112
int32
signed long int int32
Definition: isf_types.h:74
uint16
unsigned short int uint16
Definition: isf_types.h:77
DSA_STATE_CONFIGURED_STOPPED
Definition: isf_dsa_adapter.h:59
DATA_FIFO_LEN_SUB13
#define DATA_FIFO_LEN_SUB13
Definition: App1_types.h:100
App1AppInstance_t::fifos
struct App1AppInstance_t::@2 fifos
App1_Accelerometer7_DATA_READY_EVENT
#define App1_Accelerometer7_DATA_READY_EVENT
Definition: App1_types.h:131
App1AppInstance_t::CustomDataFifo_Sub18
isf_fifo_t CustomDataFifo_Sub18
Definition: App1_types.h:271
App1AppInstance_t::AccelerometerDataFifo_Sub0
isf_fifo_t AccelerometerDataFifo_Sub0
Definition: App1_types.h:253
DSA_Custom_1
Definition: isf_sensor_configuration.h:23
isf_SubscriptionSettings_t::nSettingsToUse
uint8 nSettingsToUse
1 = current; 2=given; 3=best possible
Definition: isf_dsa_direct_types.h:27
isf_orientation_types.h
DATA_TYPE_SUB3
#define DATA_TYPE_SUB3
Definition: App1_types.h:81
isf_ci.h
API definitions, types, and macros for the Intelligent Sensing Framework (ISF) Command Interpreter (C...
pseudoSettings_t
Definition: App1.c:339
isf_SubscriptionSettings_t::nSamplePeriod
uint32 nSamplePeriod
Sample period in microseconds.
Definition: isf_dsa_direct_types.h:26
isf_ci_qr_update
ci_status_t isf_ci_qr_update(uint8 aAppId, int8 anumBytes, uint8 *apSrc)
This API updates the Quick-Read mailboxes.
Definition: ci_protocol_mbox.c:100
isf_SubscriptionSettings_t
Definition: isf_dsa_direct_types.h:22
isf_init.h
The isf_init.h file contains the task initialization attributes required for initialization of the fo...
App1_Accelerometer1_DATA_READY_EVENT
#define App1_Accelerometer1_DATA_READY_EVENT
Definition: App1_types.h:119
CI_CMD_READ_VERSION
Definition: isf_ci.h:71
App1AppInstance_t::MagnetometerDataFifo_Sub9
isf_fifo_t MagnetometerDataFifo_Sub9
Definition: App1_types.h:262
CTRL_STATE_MASK
#define CTRL_STATE_MASK
Control register mask/shift definitions for the application.
Definition: App1.c:284
DSA_FXLC95000_1
Definition: isf_sensor_configuration.h:26
GET_FIELD
#define GET_FIELD(name, val)
Definition: App1.c:281
App1AppSettings_t::AccelerometerSettings_Sub6
isf_SubscriptionSettings_t AccelerometerSettings_Sub6
Definition: App1_types.h:206
App1AppSettings_t::MagnetometerSettings_Sub8
isf_SubscriptionSettings_t MagnetometerSettings_Sub8
Definition: App1_types.h:208
ci_app_resp_packet_t
This structure enables an application to read from or write to the host.
Definition: isf_ci.h:221
isf_status_t
int32 isf_status_t
ISF return status type.
Definition: isf.h:76
App1_task
void App1_task(os_task_param_t task_init_data)
Definition: App1.c:378
DATA_TYPE_SUB16
#define DATA_TYPE_SUB16
Definition: App1_types.h:107
App1_Analog19_DATA_READY_EVENT
#define App1_Analog19_DATA_READY_EVENT
Definition: App1_types.h:155
App1AppSettings_t::GyrometerSettings_Sub10
isf_SubscriptionSettings_t GyrometerSettings_Sub10
Definition: App1_types.h:210
App1AppSettings_t
Definition: App1_types.h:198
App1_Pressure12_DATA_READY_EVENT
#define App1_Pressure12_DATA_READY_EVENT
Definition: App1_types.h:141
App1AppInstance_t::AccelerometerDataFifo_Sub6
isf_fifo_t AccelerometerDataFifo_Sub6
Definition: App1_types.h:259
App1AppSettings_t::PedometerSettings_Sub17
isf_SubscriptionSettings_t PedometerSettings_Sub17
Definition: App1_types.h:217
DATA_FIFO_LEN_SUB1
#define DATA_FIFO_LEN_SUB1
Definition: App1_types.h:76
App1_Exit
void App1_Exit()
Definition: App1_Functions.c:101
App1AppSettings_t::AltitudeSettings_Sub15
isf_SubscriptionSettings_t AltitudeSettings_Sub15
Definition: App1_types.h:215
isf_swap4byte
uint32 isf_swap4byte(uint32 n)
4 byte swapping method
Definition: isf_util.c:143
App1AppInstance_t::AccelerometerInfo_Sub1
SensorInfo_t AccelerometerInfo_Sub1
Definition: App1_types.h:231
App1AppInstance_t::AccelerometerDataFifo_Sub3
isf_fifo_t AccelerometerDataFifo_Sub3
Definition: App1_types.h:256
DATA_TYPE_SUB5
#define DATA_TYPE_SUB5
Definition: App1_types.h:85
DATA_TYPE_SUB6
#define DATA_TYPE_SUB6
Definition: App1_types.h:87
DATA_FIFO_LEN_SUB3
#define DATA_FIFO_LEN_SUB3
Definition: App1_types.h:80
App1AppSettings_t::GyrometerSettings_Sub11
isf_SubscriptionSettings_t GyrometerSettings_Sub11
Definition: App1_types.h:211
App1AppInstance_t::MagnetometerInfo_Sub8
SensorInfo_t MagnetometerInfo_Sub8
Definition: App1_types.h:238
App1_Accelerometer4_DATA_READY_EVENT
#define App1_Accelerometer4_DATA_READY_EVENT
Definition: App1_types.h:125
ci_host_cmd_packet_t
This structure contains host command information.
Definition: isf_ci.h:197
uint32
unsigned long int uint32
Definition: isf_types.h:78
App1SensorData_t::rawMagnetometerData_Sub9
DATA_TYPE_SUB9 rawMagnetometerData_Sub9[DATA_FIFO_LEN_SUB9]
Definition: App1_types.h:170
DATA_FIFO_LEN_SUB9
#define DATA_FIFO_LEN_SUB9
Definition: App1_types.h:92
fsl_Sensor_Custom_1_Functions.h
This is user's event module. Put your event handler code here.
App1AppSettings_t::CustomSettings_Sub18
isf_SubscriptionSettings_t CustomSettings_Sub18
Definition: App1_types.h:218
App1SensorData_t::rawPedometerData_Sub17
DATA_TYPE_SUB17 rawPedometerData_Sub17[DATA_FIFO_LEN_SUB17]
Definition: App1_types.h:178
DSA_FXLS8952_1
Definition: isf_sensor_configuration.h:30
DSA_MMA955x_1
Definition: isf_sensor_configuration.h:37
shutdown_sensor
int32 shutdown_sensor(isf_SensorHandle_t *pSensorAdapterHandle)
Definition: isf_dsa_direct.c:126
App1SensorData_t::rawTemperatureData_Sub13
DATA_TYPE_SUB13 rawTemperatureData_Sub13[DATA_FIFO_LEN_SUB13]
Definition: App1_types.h:174
App1AppInstance_t::OrientationDataFifo_Sub14
isf_fifo_t OrientationDataFifo_Sub14
Definition: App1_types.h:267
App1AppInstance_t::PedometerDataFifo_Sub16
isf_fifo_t PedometerDataFifo_Sub16
Definition: App1_types.h:269
CI_ERROR_NONE
Definition: isf_ci.h:123
DATA_FIFO_LEN_SUB4
#define DATA_FIFO_LEN_SUB4
Definition: App1_types.h:82
App1AppInstance_t::AnalogDataFifo_Sub19
isf_fifo_t AnalogDataFifo_Sub19
Definition: App1_types.h:272
DSA_MAG3110_1
Definition: isf_sensor_configuration.h:34
DSA_Analog_1
Definition: isf_sensor_configuration.h:33
App1_TASK_PRIORITY
#define App1_TASK_PRIORITY
Definition: App1.c:240
App1AppInstance_t::CustomInfo_Sub18
SensorInfo_t CustomInfo_Sub18
Definition: App1_types.h:248
DATA_TYPE_SUB14
#define DATA_TYPE_SUB14
Definition: App1_types.h:103
subscriptionConfig_t::sensorId
uint8 sensorId
Definition: App1.c:331
isf_sm_types.h
The isf_sm_types.h contains the collection of type definitions used in the Sensor Manager Interface a...
ci_host_cmd_packet_t::appId
uint8 appId
Definition: isf_ci.h:200
gSensorHandleList
isf_SensorHandle_t * gSensorHandleList[]
This is the external declaration of the DSA sensor handle list array containing the sensor adapters a...
Definition: isf_sensor_configuration.c:69
App1_types.h
ci_response_enum
ci_response_enum
These are the CI errors provided to the host.
Definition: isf_ci.h:119
isf_accelerometer_types.h
The isf_accelerometer_types.h file contains the ISF data type definitions for use with the ISF generi...
App1AppInstance_t::PedometerInfo_Sub17
SensorInfo_t PedometerInfo_Sub17
Definition: App1_types.h:247
isf_ci_stream_update_data
isf_status_t isf_ci_stream_update_data(uint8 aDataSetID, uint16 aLength, uint16 aOffset, uint8 *apSrc)
This API updates the data of a dataset.
Definition: ci_protocol_stream.c:449
CI_CMD_RESET_APP
Definition: isf_ci.h:89
DATA_FIFO_LEN_SUB2
#define DATA_FIFO_LEN_SUB2
Definition: App1_types.h:78
App1AppInstance_t::appId
uint8 appId
Definition: App1_types.h:225
App1SensorData_t::rawAltitudeData_Sub15
DATA_TYPE_SUB15 rawAltitudeData_Sub15[DATA_FIFO_LEN_SUB15]
Definition: App1_types.h:176
DSA_MPL3115_1
Definition: isf_sensor_configuration.h:39
App1SensorData_t::rawAccelerometerData_Sub3
DATA_TYPE_SUB3 rawAccelerometerData_Sub3[DATA_FIFO_LEN_SUB3]
Definition: App1_types.h:164
DATA_TYPE_SUB4
#define DATA_TYPE_SUB4
Definition: App1_types.h:83
DATA_TYPE_SUB9
#define DATA_TYPE_SUB9
Definition: App1_types.h:93
App1AppSettings_t::TemperatureSettings_Sub13
isf_SubscriptionSettings_t TemperatureSettings_Sub13
Definition: App1_types.h:213
CI_CMD_WRITE_CONFIG
Definition: isf_ci.h:77
OSA_TASK_DEFINE
OSA_TASK_DEFINE(App1, App1_TASK_STACK_SIZE)
DATA_TYPE_SUB12
#define DATA_TYPE_SUB12
Definition: App1_types.h:99
isf_fifo_el_traverse
isf_fifo_status_t isf_fifo_el_traverse(isf_fifo_t *pFifo, void **pSamplePtr)
Routine to traverse a fifo To initiate the traversal set pSamplePtr to NULL. The function will set th...
Definition: isf_fifo.c:259
App1AppInstance_t::PedometerInfo_Sub16
SensorInfo_t PedometerInfo_Sub16
Definition: App1_types.h:246
DATA_TYPE_SUB1
#define DATA_TYPE_SUB1
Definition: App1_types.h:77
subscriptionConfig_t::sensorResultType
isf_dsa_result_types_t sensorResultType
Definition: App1.c:333
App1_Magnetometer8_DATA_READY_EVENT
#define App1_Magnetometer8_DATA_READY_EVENT
Definition: App1_types.h:133
int8
signed char int8
Definition: isf_types.h:72
- © Freescale Semiconductor, Inc. 2016. All Rights Reserved.