Home | History | Annotate | Download | only in mllite
      1 /*
      2  $License:
      3    Copyright 2011 InvenSense, Inc.
      4 
      5  Licensed under the Apache License, Version 2.0 (the "License");
      6  you may not use this file except in compliance with the License.
      7  You may obtain a copy of the License at
      8 
      9  http://www.apache.org/licenses/LICENSE-2.0
     10 
     11  Unless required by applicable law or agreed to in writing, software
     12  distributed under the License is distributed on an "AS IS" BASIS,
     13  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  See the License for the specific language governing permissions and
     15  limitations under the License.
     16   $
     17  */
     18 /*******************************************************************************
     19  *
     20  * $Id: mlstates.h 5629 2011-06-11 03:13:08Z mcaramello $
     21  *
     22  *******************************************************************************/
     23 
     24 #ifndef INV_STATES_H__
     25 #define INV_STATES_H__
     26 
     27 #include "mltypes.h"
     28 #ifdef INV_INCLUDE_LEGACY_HEADERS
     29 #include "mlstates_legacy.h"
     30 #endif
     31 
     32 #ifdef __cplusplus
     33 extern "C" {
     34 #endif
     35 
     36 /* See inv_state_transition for the transition mask */
     37 #define INV_STATE_SERIAL_CLOSED      (0)
     38 #define INV_STATE_SERIAL_OPENED      (1)
     39 #define INV_STATE_DMP_OPENED         (2)
     40 #define INV_STATE_DMP_STARTED        (3)
     41 #define INV_STATE_DMP_STOPPED        (INV_STATE_DMP_OPENED)
     42 #define INV_STATE_DMP_CLOSED         (INV_STATE_SERIAL_OPENED)
     43 
     44 #define INV_STATE_NAME(x)            (#x)
     45 
     46     typedef inv_error_t(*state_change_callback_t) (unsigned char newState);
     47 
     48     char *inv_state_name(unsigned char x);
     49     inv_error_t inv_state_transition(unsigned char newState);
     50     unsigned char inv_get_state(void);
     51     inv_error_t inv_register_state_callback(state_change_callback_t callback);
     52     inv_error_t inv_unregister_state_callback(state_change_callback_t callback);
     53     inv_error_t inv_run_state_callbacks(unsigned char newState);
     54 
     55 #ifdef __cplusplus
     56 }
     57 #endif
     58 #endif                          // INV_STATES_H__
     59