Appiko
S2LP_Types.h
Go to the documentation of this file.
1 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __S2LP_GENERICTYPES_H
31 #define __S2LP_GENERICTYPES_H
32 
33 
34 /* Includes ------------------------------------------------------------------*/
35 
36 /* Include all integer types definitions */
37 #include <stdint.h>
38 #include <stdio.h>
39 
40 
41 #ifdef __cplusplus
42  extern "C" {
43 #endif
44 
45 
67 typedef enum {
68  S_DISABLE = 0,
69  S_ENABLE = !S_DISABLE
71 
72 
76 typedef enum {
77  S_RESET = 0,
78  S_SET = !S_RESET
79 } SFlagStatus;
80 
81 
85 typedef enum {
86  S_FALSE = 0,
87  S_TRUE = !S_FALSE
88 } SBool;
89 
90 
94 typedef enum {
100  MC_STATE_RX =0x30,
102  MC_STATE_TX =0x5C,
104 } S2LPState;
105 
106 
117 typedef struct {
118  uint8_t XO_ON:1;
120  uint8_t ERROR_LOCK: 1;
121  uint8_t RX_FIFO_EMPTY: 1;
122  uint8_t TX_FIFO_FULL: 1;
123  uint8_t ANT_SELECT: 1;
124  uint8_t RCCAL_OK: 1;
125  uint8_t : 3;
126 }S2LPStatus;
127 
128 
149 extern volatile S2LPStatus g_xStatus;
150 
160 #define IS_SFUNCTIONAL_STATE(STATE) (STATE == S_DISABLE || STATE == S_ENABLE)
161 #define IS_SFLAG_STATUS(STATUS) (STATUS == S_RESET || STATUS == S_SET)
162 #define IS_SBOOL(STATUS) (STATUS == S_FALSE || STATUS == S_TRUE)
163 
164 #define S_ABS(a) ((a)>0?(a):-(a))
165 
176 #ifdef S2LP_USE_FULL_ASSERT
177 
184  #define s_assert_param(expr) ((expr) ? (void)0 : s_assert_failed((uint8_t *)__FILE__, __LINE__))
185  void s_assert_failed(uint8_t* file, uint32_t line);
186 #elif S2LP_USE_VCOM_ASSERT
187 
194  #define s_assert_param(expr) ((expr) ? (void)0 : s_assert_failed((uint8_t *)__FILE__, __LINE__,#expr))
195  void s_assert_failed(uint8_t* file, uint32_t line, char* expression);
196 #else
197  #define s_assert_param(expr) {}
198 #endif
199 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif
219 
220 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
SBool
boolean type enumeration.
Definition: S2LP_Types.h:85
S2LPState MC_STATE
Definition: S2LP_Types.h:119
uint8_t RX_FIFO_EMPTY
Definition: S2LP_Types.h:121
SFunctionalState
S2LP Functional state. Used to enable or disable a specific option.
Definition: S2LP_Types.h:67
uint8_t ERROR_LOCK
Definition: S2LP_Types.h:120
S2LP Status. This definition represents the single field of the S2LP status returned on each SPI tran...
Definition: S2LP_Types.h:117
SFlagStatus
S2LP Flag status. Used to control the state of a flag.
Definition: S2LP_Types.h:76
S2LPState
S2LP States enumeration.
Definition: S2LP_Types.h:94
volatile S2LPStatus g_xStatus
S2LP Status global variable. This global variable of S2LPStatus type is updated on every SPI transact...
Definition: S2LP_Types.c:82
uint8_t XO_ON
Definition: S2LP_Types.h:118
uint8_t RCCAL_OK
Definition: S2LP_Types.h:124
uint8_t TX_FIFO_FULL
Definition: S2LP_Types.h:122
uint8_t ANT_SELECT
Definition: S2LP_Types.h:123