Fork of my original MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:43:14 2017 +0000
Revision:
0:a1734fe1ec4b
Initial commit

Who changed what in which revision?

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