Easily add all supported connectivity methods to your mbed OS project

Dependencies:   type-yd-driver

Committer:
MACRUM
Date:
Wed Jul 12 10:52:58 2017 +0000
Revision:
0:615f90842ce8
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:615f90842ce8 1 /**
MACRUM 0:615f90842ce8 2 ******************************************************************************
MACRUM 0:615f90842ce8 3 * @file SPIRIT_General.h
MACRUM 0:615f90842ce8 4 * @author VMA division - AMS
MACRUM 0:615f90842ce8 5 * @version 3.2.2
MACRUM 0:615f90842ce8 6 * @date 08-July-2015
MACRUM 0:615f90842ce8 7 * @brief Configuration and management of SPIRIT General functionalities.
MACRUM 0:615f90842ce8 8 * @details
MACRUM 0:615f90842ce8 9 *
MACRUM 0:615f90842ce8 10 * @attention
MACRUM 0:615f90842ce8 11 *
MACRUM 0:615f90842ce8 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
MACRUM 0:615f90842ce8 13 *
MACRUM 0:615f90842ce8 14 * Redistribution and use in source and binary forms, with or without modification,
MACRUM 0:615f90842ce8 15 * are permitted provided that the following conditions are met:
MACRUM 0:615f90842ce8 16 * 1. Redistributions of source code must retain the above copyright notice,
MACRUM 0:615f90842ce8 17 * this list of conditions and the following disclaimer.
MACRUM 0:615f90842ce8 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
MACRUM 0:615f90842ce8 19 * this list of conditions and the following disclaimer in the documentation
MACRUM 0:615f90842ce8 20 * and/or other materials provided with the distribution.
MACRUM 0:615f90842ce8 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
MACRUM 0:615f90842ce8 22 * may be used to endorse or promote products derived from this software
MACRUM 0:615f90842ce8 23 * without specific prior written permission.
MACRUM 0:615f90842ce8 24 *
MACRUM 0:615f90842ce8 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
MACRUM 0:615f90842ce8 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
MACRUM 0:615f90842ce8 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
MACRUM 0:615f90842ce8 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
MACRUM 0:615f90842ce8 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
MACRUM 0:615f90842ce8 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
MACRUM 0:615f90842ce8 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
MACRUM 0:615f90842ce8 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
MACRUM 0:615f90842ce8 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
MACRUM 0:615f90842ce8 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MACRUM 0:615f90842ce8 35 *
MACRUM 0:615f90842ce8 36 ******************************************************************************
MACRUM 0:615f90842ce8 37 */
MACRUM 0:615f90842ce8 38
MACRUM 0:615f90842ce8 39 /* Define to prevent recursive inclusion -------------------------------------*/
MACRUM 0:615f90842ce8 40 #ifndef __SPIRIT_GENERAL_H
MACRUM 0:615f90842ce8 41 #define __SPIRIT_GENERAL_H
MACRUM 0:615f90842ce8 42
MACRUM 0:615f90842ce8 43
MACRUM 0:615f90842ce8 44 /* Includes ------------------------------------------------------------------*/
MACRUM 0:615f90842ce8 45
MACRUM 0:615f90842ce8 46 #include "SPIRIT_Regs.h"
MACRUM 0:615f90842ce8 47 #include "SPIRIT_Types.h"
MACRUM 0:615f90842ce8 48
MACRUM 0:615f90842ce8 49
MACRUM 0:615f90842ce8 50 #ifdef __cplusplus
MACRUM 0:615f90842ce8 51 extern "C" {
MACRUM 0:615f90842ce8 52 #endif
MACRUM 0:615f90842ce8 53
MACRUM 0:615f90842ce8 54 /**
MACRUM 0:615f90842ce8 55 * @addtogroup SPIRIT_Libraries
MACRUM 0:615f90842ce8 56 * @{
MACRUM 0:615f90842ce8 57 */
MACRUM 0:615f90842ce8 58
MACRUM 0:615f90842ce8 59
MACRUM 0:615f90842ce8 60 /**
MACRUM 0:615f90842ce8 61 * @defgroup SPIRIT_General General
MACRUM 0:615f90842ce8 62 * @brief Configuration and management of SPIRIT General functionalities.
MACRUM 0:615f90842ce8 63 * @details See the file <i>@ref SPIRIT_General.h</i> for more details.
MACRUM 0:615f90842ce8 64 * @{
MACRUM 0:615f90842ce8 65 */
MACRUM 0:615f90842ce8 66
MACRUM 0:615f90842ce8 67 /**
MACRUM 0:615f90842ce8 68 * @defgroup General_Exported_Types General Exported Types
MACRUM 0:615f90842ce8 69 * @{
MACRUM 0:615f90842ce8 70 */
MACRUM 0:615f90842ce8 71
MACRUM 0:615f90842ce8 72
MACRUM 0:615f90842ce8 73 /**
MACRUM 0:615f90842ce8 74 * @brief SPIRIT ModeExtRef enumeration
MACRUM 0:615f90842ce8 75 */
MACRUM 0:615f90842ce8 76
MACRUM 0:615f90842ce8 77 typedef enum
MACRUM 0:615f90842ce8 78 {
MACRUM 0:615f90842ce8 79 MODE_EXT_XO = 0,
MACRUM 0:615f90842ce8 80 MODE_EXT_XIN = !MODE_EXT_XO
MACRUM 0:615f90842ce8 81 } ModeExtRef;
MACRUM 0:615f90842ce8 82
MACRUM 0:615f90842ce8 83 #define IS_MODE_EXT(MODE) (MODE == MODE_EXT_XO || \
MACRUM 0:615f90842ce8 84 MODE == MODE_EXT_XIN)
MACRUM 0:615f90842ce8 85
MACRUM 0:615f90842ce8 86
MACRUM 0:615f90842ce8 87 /**
MACRUM 0:615f90842ce8 88 * @brief SPIRIT BatteryLevel enumeration
MACRUM 0:615f90842ce8 89 */
MACRUM 0:615f90842ce8 90
MACRUM 0:615f90842ce8 91 typedef enum
MACRUM 0:615f90842ce8 92 {
MACRUM 0:615f90842ce8 93 BLD_LVL_2_7_V = 0,
MACRUM 0:615f90842ce8 94 BLD_LVL_2_5_V = 1,
MACRUM 0:615f90842ce8 95 BLD_LVL_2_3_V = 2,
MACRUM 0:615f90842ce8 96 BLD_LVL_2_1_V = 3
MACRUM 0:615f90842ce8 97 } BatteryLevel;
MACRUM 0:615f90842ce8 98
MACRUM 0:615f90842ce8 99 #define IS_BLD_LVL(MODE) (MODE == BLD_LVL_2_7_V || \
MACRUM 0:615f90842ce8 100 MODE == BLD_LVL_2_5_V || \
MACRUM 0:615f90842ce8 101 MODE == BLD_LVL_2_3_V || \
MACRUM 0:615f90842ce8 102 MODE == BLD_LVL_2_1_V)
MACRUM 0:615f90842ce8 103
MACRUM 0:615f90842ce8 104
MACRUM 0:615f90842ce8 105 /**
MACRUM 0:615f90842ce8 106 * @brief SPIRIT GmConf enumeration
MACRUM 0:615f90842ce8 107 */
MACRUM 0:615f90842ce8 108
MACRUM 0:615f90842ce8 109 typedef enum
MACRUM 0:615f90842ce8 110 {
MACRUM 0:615f90842ce8 111 GM_SU_13_2 = 0,
MACRUM 0:615f90842ce8 112 GM_SU_18_2,
MACRUM 0:615f90842ce8 113 GM_SU_21_5,
MACRUM 0:615f90842ce8 114 GM_SU_25_6,
MACRUM 0:615f90842ce8 115 GM_SU_28_8,
MACRUM 0:615f90842ce8 116 GM_SU_33_9,
MACRUM 0:615f90842ce8 117 GM_SU_38_5,
MACRUM 0:615f90842ce8 118 GM_SU_43_0
MACRUM 0:615f90842ce8 119 } GmConf;
MACRUM 0:615f90842ce8 120
MACRUM 0:615f90842ce8 121 #define IS_GM_CONF(MODE) (MODE == GM_SU_13_2 || \
MACRUM 0:615f90842ce8 122 MODE == GM_SU_18_2 || \
MACRUM 0:615f90842ce8 123 MODE == GM_SU_21_5 || \
MACRUM 0:615f90842ce8 124 MODE == GM_SU_25_6 || \
MACRUM 0:615f90842ce8 125 MODE == GM_SU_28_8 || \
MACRUM 0:615f90842ce8 126 MODE == GM_SU_33_9 || \
MACRUM 0:615f90842ce8 127 MODE == GM_SU_38_5 || \
MACRUM 0:615f90842ce8 128 MODE == GM_SU_43_0)
MACRUM 0:615f90842ce8 129
MACRUM 0:615f90842ce8 130
MACRUM 0:615f90842ce8 131 /**
MACRUM 0:615f90842ce8 132 * @brief SPIRIT packet type enumeration
MACRUM 0:615f90842ce8 133 */
MACRUM 0:615f90842ce8 134
MACRUM 0:615f90842ce8 135 typedef enum
MACRUM 0:615f90842ce8 136 {
MACRUM 0:615f90842ce8 137 PKT_BASIC = 0x00,
MACRUM 0:615f90842ce8 138 PKT_MBUS = 0x02,
MACRUM 0:615f90842ce8 139 PKT_STACK
MACRUM 0:615f90842ce8 140
MACRUM 0:615f90842ce8 141 } PacketType;
MACRUM 0:615f90842ce8 142
MACRUM 0:615f90842ce8 143 #define IS_PKT_TYPE(TYPE) (TYPE == PKT_BASIC || \
MACRUM 0:615f90842ce8 144 TYPE == PKT_MBUS || \
MACRUM 0:615f90842ce8 145 TYPE == PKT_STACK || \
MACRUM 0:615f90842ce8 146 )
MACRUM 0:615f90842ce8 147
MACRUM 0:615f90842ce8 148
MACRUM 0:615f90842ce8 149 /**
MACRUM 0:615f90842ce8 150 * @brief SPIRIT version type enumeration
MACRUM 0:615f90842ce8 151 */
MACRUM 0:615f90842ce8 152
MACRUM 0:615f90842ce8 153 typedef enum
MACRUM 0:615f90842ce8 154 {
MACRUM 0:615f90842ce8 155 SPIRIT_VERSION_2_1 = 0x01, /* Deprecated */
MACRUM 0:615f90842ce8 156 SPIRIT_VERSION_3_0, /* The only version of SPIRIT1 */
MACRUM 0:615f90842ce8 157 } SpiritVersion;
MACRUM 0:615f90842ce8 158
MACRUM 0:615f90842ce8 159
MACRUM 0:615f90842ce8 160 /**
MACRUM 0:615f90842ce8 161 * @}
MACRUM 0:615f90842ce8 162 */
MACRUM 0:615f90842ce8 163
MACRUM 0:615f90842ce8 164
MACRUM 0:615f90842ce8 165 /**
MACRUM 0:615f90842ce8 166 * @defgroup General_Exported_Constants General Exported Constants
MACRUM 0:615f90842ce8 167 * @{
MACRUM 0:615f90842ce8 168 */
MACRUM 0:615f90842ce8 169
MACRUM 0:615f90842ce8 170
MACRUM 0:615f90842ce8 171 /**
MACRUM 0:615f90842ce8 172 * @}
MACRUM 0:615f90842ce8 173 */
MACRUM 0:615f90842ce8 174
MACRUM 0:615f90842ce8 175
MACRUM 0:615f90842ce8 176 /**
MACRUM 0:615f90842ce8 177 * @defgroup General_Exported_Macros General Exported Macros
MACRUM 0:615f90842ce8 178 * @{
MACRUM 0:615f90842ce8 179 */
MACRUM 0:615f90842ce8 180 #define SpiritGeneralLibraryVersion() "Spirit1_Libraries_v.3.2.0"
MACRUM 0:615f90842ce8 181
MACRUM 0:615f90842ce8 182
MACRUM 0:615f90842ce8 183 /**
MACRUM 0:615f90842ce8 184 * @}
MACRUM 0:615f90842ce8 185 */
MACRUM 0:615f90842ce8 186
MACRUM 0:615f90842ce8 187
MACRUM 0:615f90842ce8 188 /**
MACRUM 0:615f90842ce8 189 * @defgroup General_Exported_Functions General Exported Functions
MACRUM 0:615f90842ce8 190 * @{
MACRUM 0:615f90842ce8 191 */
MACRUM 0:615f90842ce8 192
MACRUM 0:615f90842ce8 193
MACRUM 0:615f90842ce8 194 void SpiritGeneralBatteryLevel(SpiritFunctionalState xNewState);
MACRUM 0:615f90842ce8 195 void SpiritGeneralSetBatteryLevel(BatteryLevel xBatteryLevel);
MACRUM 0:615f90842ce8 196 BatteryLevel SpiritGeneralGetBatteryLevel(void);
MACRUM 0:615f90842ce8 197 void SpiritGeneralBrownOut(SpiritFunctionalState xNewState);
MACRUM 0:615f90842ce8 198 void SpiritGeneralHighPwr(SpiritFunctionalState xNewState);
MACRUM 0:615f90842ce8 199 void SpiritGeneralSetExtRef(ModeExtRef xExtMode);
MACRUM 0:615f90842ce8 200 ModeExtRef SpiritGeneralGetExtRef(void);
MACRUM 0:615f90842ce8 201 void SpiritGeneralSetXoGm(GmConf xGm);
MACRUM 0:615f90842ce8 202 GmConf SpiritGeneralGetXoGm(void);
MACRUM 0:615f90842ce8 203 PacketType SpiritGeneralGetPktType(void);
MACRUM 0:615f90842ce8 204 uint16_t SpiritGeneralGetDevicePartNumber(void);
MACRUM 0:615f90842ce8 205 uint8_t SpiritGeneralGetSpiritVersion(void);
MACRUM 0:615f90842ce8 206
MACRUM 0:615f90842ce8 207 /**
MACRUM 0:615f90842ce8 208 * @}
MACRUM 0:615f90842ce8 209 */
MACRUM 0:615f90842ce8 210
MACRUM 0:615f90842ce8 211 /**
MACRUM 0:615f90842ce8 212 * @}
MACRUM 0:615f90842ce8 213 */
MACRUM 0:615f90842ce8 214
MACRUM 0:615f90842ce8 215
MACRUM 0:615f90842ce8 216 /**
MACRUM 0:615f90842ce8 217 * @}
MACRUM 0:615f90842ce8 218 */
MACRUM 0:615f90842ce8 219
MACRUM 0:615f90842ce8 220
MACRUM 0:615f90842ce8 221 #ifdef __cplusplus
MACRUM 0:615f90842ce8 222 }
MACRUM 0:615f90842ce8 223 #endif
MACRUM 0:615f90842ce8 224
MACRUM 0:615f90842ce8 225 #endif
MACRUM 0:615f90842ce8 226
MACRUM 0:615f90842ce8 227 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/