ISSDK  1.7
IoT Sensing Software Development Kit
status.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without modification,
8  * are permitted (subject to the limitations in the disclaimer below) provided
9  * that the following conditions are met:
10  *
11  * o Redistributions of source code must retain the above copyright notice, this list
12  * of conditions and the following disclaimer.
13  *
14  * o Redistributions in binary form must reproduce the above copyright notice, this
15  * list of conditions and the following disclaimer in the documentation and/or
16  * other materials provided with the distribution.
17  *
18  * o Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef SENSOR_FUSION_STATUS_H_
36 #define SENSOR_FUSION_STATUS_H_
37 
38 
39 /*! \file status.h
40  \brief Application-specific status subsystem
41 
42  Applications may change how they choose to display status information.
43  The default implementation here uses LEDs on NXP Freedom boards.
44  You may swap out implementations as long as the "Required" methods and states
45  are retained.
46 */
47 /// StatusSubsystem() provides an object-like interface for communicating status to the user
48 typedef struct StatusSubsystem {
49  // Required internal states
50  fusion_status_t previous; ///< Previous status state - fusion_status_t is defined in sensor_fusion.h
51  fusion_status_t status; ///< Current status
52  fusion_status_t next; ///< Pending status change
53  // Required methods
54  ssSetStatus_t *set; ///< change status immediately - no delay
55  ssSetStatus_t *queue; ///< queue status change for next regular interval
56  ssUpdateStatus_t *update; ///< make pending status active/visible
57  ssUpdateStatus_t *test ; ///< unit test which simply increments to next state
58  // application-specific internal variables
59  uint8_t toggle; ///< This implementation can change LED color and have either solid/toggle
61 
62 /// initializeStatusSubsystem() should be called once at startup to initialize the
63 /// data structure and to put hardware into the proper state for communicating status.
65  StatusSubsystem *pStatus ///< pointer to the status subsystem
66 );
67 
68 #endif /* SENSOR_FUSION_STATUS_H_ */
void() ssUpdateStatus_t(struct StatusSubsystem *pStatus)
fusion_status_t previous
Previous status state - fusion_status_t is defined in sensor_fusion.h.
Definition: status.h:50
void initializeStatusSubsystem(StatusSubsystem *pStatus)
Definition: status.c:191
struct StatusSubsystem StatusSubsystem
StatusSubsystem() provides an object-like interface for communicating status to the user...
StatusSubsystem() provides an object-like interface for communicating status to the user...
Definition: status.h:48
ssUpdateStatus_t * update
make pending status active/visible
Definition: status.h:56
uint8_t toggle
This implementation can change LED color and have either solid/toggle.
Definition: status.h:59
fusion_status_t status
Current status.
Definition: status.h:51
ssSetStatus_t * queue
queue status change for next regular interval
Definition: status.h:55
ssUpdateStatus_t * test
unit test which simply increments to next state
Definition: status.h:57
fusion_status_t
Application-specific serial communications system.
void() ssSetStatus_t(struct StatusSubsystem *pStatus, fusion_status_t status)
fusion_status_t next
Pending status change.
Definition: status.h:52