wifi test
Dependencies: X_NUCLEO_IKS01A2 mbed-http
easy-connect/stm-spirit1-rf-driver/source/libs/spirit1/SPIRIT1_Library/Inc/SPIRIT_PktMbus.h@0:24d3eb812fd4, 2018-09-05 (annotated)
- Committer:
- JMF
- Date:
- Wed Sep 05 14:28:24 2018 +0000
- Revision:
- 0:24d3eb812fd4
Initial commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| JMF | 0:24d3eb812fd4 | 1 | /** |
| JMF | 0:24d3eb812fd4 | 2 | ****************************************************************************** |
| JMF | 0:24d3eb812fd4 | 3 | * @file SPIRIT_PktMbus.h |
| JMF | 0:24d3eb812fd4 | 4 | * @author VMA division - AMS |
| JMF | 0:24d3eb812fd4 | 5 | * @version 3.2.2 |
| JMF | 0:24d3eb812fd4 | 6 | * @date 08-July-2015 |
| JMF | 0:24d3eb812fd4 | 7 | * @brief Configuration and management of SPIRIT MBUS packets. |
| JMF | 0:24d3eb812fd4 | 8 | * |
| JMF | 0:24d3eb812fd4 | 9 | * @details |
| JMF | 0:24d3eb812fd4 | 10 | * |
| JMF | 0:24d3eb812fd4 | 11 | * This module can be used to manage the configuration of Spirit MBUS |
| JMF | 0:24d3eb812fd4 | 12 | * packets. |
| JMF | 0:24d3eb812fd4 | 13 | * The user can obtain a packet configuration filling the structure |
| JMF | 0:24d3eb812fd4 | 14 | * <i>@ref PktMbusInit</i>, defining in it some general parameters |
| JMF | 0:24d3eb812fd4 | 15 | * for the Spirit MBUS packet format. |
| JMF | 0:24d3eb812fd4 | 16 | * Since the MBUS protocol is a standard, the configuration of a MBUS |
| JMF | 0:24d3eb812fd4 | 17 | * packet is very simple to do. |
| JMF | 0:24d3eb812fd4 | 18 | * |
| JMF | 0:24d3eb812fd4 | 19 | * <b>Example:</b> |
| JMF | 0:24d3eb812fd4 | 20 | * @code |
| JMF | 0:24d3eb812fd4 | 21 | * |
| JMF | 0:24d3eb812fd4 | 22 | * PktMbusInit mbusInit={ |
| JMF | 0:24d3eb812fd4 | 23 | * MBUS_SUBMODE_S1_S2_LONG_HEADER, // MBUS submode selection |
| JMF | 0:24d3eb812fd4 | 24 | * 36, // added "01" chips on preamble |
| JMF | 0:24d3eb812fd4 | 25 | * 16 // postamble length in "01" chips |
| JMF | 0:24d3eb812fd4 | 26 | * }; |
| JMF | 0:24d3eb812fd4 | 27 | * |
| JMF | 0:24d3eb812fd4 | 28 | * ... |
| JMF | 0:24d3eb812fd4 | 29 | * |
| JMF | 0:24d3eb812fd4 | 30 | * SpiritPktMbusInit(&mbusInit); |
| JMF | 0:24d3eb812fd4 | 31 | * |
| JMF | 0:24d3eb812fd4 | 32 | * ... |
| JMF | 0:24d3eb812fd4 | 33 | * |
| JMF | 0:24d3eb812fd4 | 34 | * @endcode |
| JMF | 0:24d3eb812fd4 | 35 | * |
| JMF | 0:24d3eb812fd4 | 36 | * The module provides some other functions that can be used to modify |
| JMF | 0:24d3eb812fd4 | 37 | * or read only some configuration parameters. |
| JMF | 0:24d3eb812fd4 | 38 | * |
| JMF | 0:24d3eb812fd4 | 39 | * |
| JMF | 0:24d3eb812fd4 | 40 | * @attention |
| JMF | 0:24d3eb812fd4 | 41 | * |
| JMF | 0:24d3eb812fd4 | 42 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
| JMF | 0:24d3eb812fd4 | 43 | * |
| JMF | 0:24d3eb812fd4 | 44 | * Redistribution and use in source and binary forms, with or without modification, |
| JMF | 0:24d3eb812fd4 | 45 | * are permitted provided that the following conditions are met: |
| JMF | 0:24d3eb812fd4 | 46 | * 1. Redistributions of source code must retain the above copyright notice, |
| JMF | 0:24d3eb812fd4 | 47 | * this list of conditions and the following disclaimer. |
| JMF | 0:24d3eb812fd4 | 48 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| JMF | 0:24d3eb812fd4 | 49 | * this list of conditions and the following disclaimer in the documentation |
| JMF | 0:24d3eb812fd4 | 50 | * and/or other materials provided with the distribution. |
| JMF | 0:24d3eb812fd4 | 51 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
| JMF | 0:24d3eb812fd4 | 52 | * may be used to endorse or promote products derived from this software |
| JMF | 0:24d3eb812fd4 | 53 | * without specific prior written permission. |
| JMF | 0:24d3eb812fd4 | 54 | * |
| JMF | 0:24d3eb812fd4 | 55 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| JMF | 0:24d3eb812fd4 | 56 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| JMF | 0:24d3eb812fd4 | 57 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| JMF | 0:24d3eb812fd4 | 58 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| JMF | 0:24d3eb812fd4 | 59 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| JMF | 0:24d3eb812fd4 | 60 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| JMF | 0:24d3eb812fd4 | 61 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| JMF | 0:24d3eb812fd4 | 62 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| JMF | 0:24d3eb812fd4 | 63 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| JMF | 0:24d3eb812fd4 | 64 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| JMF | 0:24d3eb812fd4 | 65 | * |
| JMF | 0:24d3eb812fd4 | 66 | ****************************************************************************** |
| JMF | 0:24d3eb812fd4 | 67 | */ |
| JMF | 0:24d3eb812fd4 | 68 | |
| JMF | 0:24d3eb812fd4 | 69 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| JMF | 0:24d3eb812fd4 | 70 | #ifndef __SPIRIT_PACKET_MBUS_H |
| JMF | 0:24d3eb812fd4 | 71 | #define __SPIRIT_PACKET_MBUS_H |
| JMF | 0:24d3eb812fd4 | 72 | |
| JMF | 0:24d3eb812fd4 | 73 | |
| JMF | 0:24d3eb812fd4 | 74 | |
| JMF | 0:24d3eb812fd4 | 75 | /* Includes ------------------------------------------------------------------*/ |
| JMF | 0:24d3eb812fd4 | 76 | |
| JMF | 0:24d3eb812fd4 | 77 | #include "SPIRIT_Regs.h" |
| JMF | 0:24d3eb812fd4 | 78 | #include "SPIRIT_Types.h" |
| JMF | 0:24d3eb812fd4 | 79 | #include "SPIRIT_PktCommon.h" |
| JMF | 0:24d3eb812fd4 | 80 | |
| JMF | 0:24d3eb812fd4 | 81 | #ifdef __cplusplus |
| JMF | 0:24d3eb812fd4 | 82 | extern "C" { |
| JMF | 0:24d3eb812fd4 | 83 | #endif |
| JMF | 0:24d3eb812fd4 | 84 | |
| JMF | 0:24d3eb812fd4 | 85 | |
| JMF | 0:24d3eb812fd4 | 86 | |
| JMF | 0:24d3eb812fd4 | 87 | /** |
| JMF | 0:24d3eb812fd4 | 88 | * @addtogroup SPIRIT_Libraries |
| JMF | 0:24d3eb812fd4 | 89 | * @{ |
| JMF | 0:24d3eb812fd4 | 90 | */ |
| JMF | 0:24d3eb812fd4 | 91 | |
| JMF | 0:24d3eb812fd4 | 92 | |
| JMF | 0:24d3eb812fd4 | 93 | /** |
| JMF | 0:24d3eb812fd4 | 94 | * @defgroup SPIRIT_PktMbus Pkt MBUS |
| JMF | 0:24d3eb812fd4 | 95 | * @brief Configuration and management of SPIRIT MBUS packets. |
| JMF | 0:24d3eb812fd4 | 96 | * @details See the file <i>@ref SPIRIT_PktMbus.h</i> for more details. |
| JMF | 0:24d3eb812fd4 | 97 | * @{ |
| JMF | 0:24d3eb812fd4 | 98 | */ |
| JMF | 0:24d3eb812fd4 | 99 | |
| JMF | 0:24d3eb812fd4 | 100 | /** |
| JMF | 0:24d3eb812fd4 | 101 | * @defgroup PktMbus_Exported_Types Pkt MBUS Exported Types |
| JMF | 0:24d3eb812fd4 | 102 | * @{ |
| JMF | 0:24d3eb812fd4 | 103 | */ |
| JMF | 0:24d3eb812fd4 | 104 | |
| JMF | 0:24d3eb812fd4 | 105 | |
| JMF | 0:24d3eb812fd4 | 106 | |
| JMF | 0:24d3eb812fd4 | 107 | /** |
| JMF | 0:24d3eb812fd4 | 108 | * @brief MBUS submode enumeration. |
| JMF | 0:24d3eb812fd4 | 109 | */ |
| JMF | 0:24d3eb812fd4 | 110 | |
| JMF | 0:24d3eb812fd4 | 111 | typedef enum |
| JMF | 0:24d3eb812fd4 | 112 | { |
| JMF | 0:24d3eb812fd4 | 113 | MBUS_SUBMODE_S1_S2_LONG_HEADER = MBUS_CTRL_MBUS_SUBMODE_S1_S2L, /*!< MBUS submode S1, S2 (long header) - Header length = mbus_prmbl_ctrl + 279 (in "01" bit pairs) , Sync word = 0x7696 (length 18 bits) */ |
| JMF | 0:24d3eb812fd4 | 114 | MBUS_SUBMODE_S1_M_S2_T2_OTHER_TO_METER = MBUS_CTRL_MBUS_SUBMODE_S2_S1M_T2_OTHER, /*!< MBUS submode S1-m, S2, T2 (other to meter) - Header length = mbus_prmbl_ctrl + 15 (in "01" bit pairs) , Sync word = 0x7696 (length 18 bits)*/ |
| JMF | 0:24d3eb812fd4 | 115 | MBUS_SUBMODE_T1_T2_METER_TO_OTHER = MBUS_CTRL_MBUS_SUBMODE_T1_T2_METER, /*!< MBUS submode T1, T2 (meter to other) - Header length = mbus_prmbl_ctrl + 19 (in "01" bit pairs) , Sync word = 0x3D (length 10 bits)*/ |
| JMF | 0:24d3eb812fd4 | 116 | MBUS_SUBMODE_R2_SHORT_HEADER = MBUS_CTRL_MBUS_SUBMODE_R2, /*!< MBUS submode R2, short header - Header length = mbus_prmbl_ctrl + 39 (in "01" bit pairs) , Sync word = 0x7696 (length 18 bits)*/ |
| JMF | 0:24d3eb812fd4 | 117 | |
| JMF | 0:24d3eb812fd4 | 118 | }MbusSubmode; |
| JMF | 0:24d3eb812fd4 | 119 | |
| JMF | 0:24d3eb812fd4 | 120 | #define IS_MBUS_SUBMODE(MODE) (((MODE) == MBUS_SUBMODE_S1_S2_LONG_HEADER) || \ |
| JMF | 0:24d3eb812fd4 | 121 | ((MODE) == MBUS_SUBMODE_S1_M_S2_T2_OTHER_TO_METER) || \ |
| JMF | 0:24d3eb812fd4 | 122 | ((MODE) == MBUS_SUBMODE_T1_T2_METER_TO_OTHER) || \ |
| JMF | 0:24d3eb812fd4 | 123 | ((MODE) == MBUS_SUBMODE_R2_SHORT_HEADER)) |
| JMF | 0:24d3eb812fd4 | 124 | |
| JMF | 0:24d3eb812fd4 | 125 | |
| JMF | 0:24d3eb812fd4 | 126 | /** |
| JMF | 0:24d3eb812fd4 | 127 | * @brief SPIRIT MBUS Packet Init structure definition |
| JMF | 0:24d3eb812fd4 | 128 | */ |
| JMF | 0:24d3eb812fd4 | 129 | typedef struct |
| JMF | 0:24d3eb812fd4 | 130 | { |
| JMF | 0:24d3eb812fd4 | 131 | MbusSubmode xMbusSubmode; /*!< Specifies the SUBMODE to be configured. |
| JMF | 0:24d3eb812fd4 | 132 | This parameter can be a value of @ref MbusSubmode */ |
| JMF | 0:24d3eb812fd4 | 133 | |
| JMF | 0:24d3eb812fd4 | 134 | uint8_t cPreambleLength; /*!< Specifies the PREAMBLE length. |
| JMF | 0:24d3eb812fd4 | 135 | This parameter can be any value between 0 and 255 chip sequence '01' */ |
| JMF | 0:24d3eb812fd4 | 136 | |
| JMF | 0:24d3eb812fd4 | 137 | uint8_t cPostambleLength; /*!< Specifies the POSTAMBLE length. |
| JMF | 0:24d3eb812fd4 | 138 | This parameter can be any value between 0 and 255 chip sequence '01' */ |
| JMF | 0:24d3eb812fd4 | 139 | |
| JMF | 0:24d3eb812fd4 | 140 | }PktMbusInit; |
| JMF | 0:24d3eb812fd4 | 141 | |
| JMF | 0:24d3eb812fd4 | 142 | /** |
| JMF | 0:24d3eb812fd4 | 143 | *@} |
| JMF | 0:24d3eb812fd4 | 144 | */ |
| JMF | 0:24d3eb812fd4 | 145 | |
| JMF | 0:24d3eb812fd4 | 146 | |
| JMF | 0:24d3eb812fd4 | 147 | /** |
| JMF | 0:24d3eb812fd4 | 148 | * @defgroup PktMbus_Exported_Constants Pkt MBUS Exported Constants |
| JMF | 0:24d3eb812fd4 | 149 | * @{ |
| JMF | 0:24d3eb812fd4 | 150 | */ |
| JMF | 0:24d3eb812fd4 | 151 | |
| JMF | 0:24d3eb812fd4 | 152 | |
| JMF | 0:24d3eb812fd4 | 153 | /** |
| JMF | 0:24d3eb812fd4 | 154 | *@} |
| JMF | 0:24d3eb812fd4 | 155 | */ |
| JMF | 0:24d3eb812fd4 | 156 | |
| JMF | 0:24d3eb812fd4 | 157 | |
| JMF | 0:24d3eb812fd4 | 158 | /** |
| JMF | 0:24d3eb812fd4 | 159 | * @defgroup PktMbus_Exported_Macros Pkt MBUS Exported Macros |
| JMF | 0:24d3eb812fd4 | 160 | * @{ |
| JMF | 0:24d3eb812fd4 | 161 | */ |
| JMF | 0:24d3eb812fd4 | 162 | |
| JMF | 0:24d3eb812fd4 | 163 | |
| JMF | 0:24d3eb812fd4 | 164 | /** |
| JMF | 0:24d3eb812fd4 | 165 | *@} |
| JMF | 0:24d3eb812fd4 | 166 | */ |
| JMF | 0:24d3eb812fd4 | 167 | |
| JMF | 0:24d3eb812fd4 | 168 | |
| JMF | 0:24d3eb812fd4 | 169 | /** |
| JMF | 0:24d3eb812fd4 | 170 | * @defgroup PktMbus_Exported_Functions Pkt MBUS Exported Functions |
| JMF | 0:24d3eb812fd4 | 171 | * @{ |
| JMF | 0:24d3eb812fd4 | 172 | */ |
| JMF | 0:24d3eb812fd4 | 173 | void SpiritPktMbusInit(PktMbusInit* pxPktMbusInit); |
| JMF | 0:24d3eb812fd4 | 174 | void SpiritPktMbusGetInfo(PktMbusInit* pxPktMbusInit); |
| JMF | 0:24d3eb812fd4 | 175 | void SpiritPktMbusSetFormat(void); |
| JMF | 0:24d3eb812fd4 | 176 | void SpiritPktMbusSetPreamble(uint8_t cPreamble); |
| JMF | 0:24d3eb812fd4 | 177 | uint8_t SpiritPktMbusGetPreamble(void); |
| JMF | 0:24d3eb812fd4 | 178 | void SpiritPktMbusSetPostamble(uint8_t cPostamble); |
| JMF | 0:24d3eb812fd4 | 179 | uint8_t SpiritPktMbusGetPostamble(void); |
| JMF | 0:24d3eb812fd4 | 180 | void SpiritPktMbusSetSubmode(MbusSubmode xMbusSubmode); |
| JMF | 0:24d3eb812fd4 | 181 | MbusSubmode SpiritPktMbusGetSubmode(void); |
| JMF | 0:24d3eb812fd4 | 182 | void SpiritPktMbusSetPayloadLength(uint16_t nPayloadLength); |
| JMF | 0:24d3eb812fd4 | 183 | uint16_t SpiritPktMbusGetPayloadLength(void); |
| JMF | 0:24d3eb812fd4 | 184 | |
| JMF | 0:24d3eb812fd4 | 185 | |
| JMF | 0:24d3eb812fd4 | 186 | /** |
| JMF | 0:24d3eb812fd4 | 187 | *@} |
| JMF | 0:24d3eb812fd4 | 188 | */ |
| JMF | 0:24d3eb812fd4 | 189 | |
| JMF | 0:24d3eb812fd4 | 190 | /** |
| JMF | 0:24d3eb812fd4 | 191 | *@} |
| JMF | 0:24d3eb812fd4 | 192 | */ |
| JMF | 0:24d3eb812fd4 | 193 | |
| JMF | 0:24d3eb812fd4 | 194 | |
| JMF | 0:24d3eb812fd4 | 195 | /** |
| JMF | 0:24d3eb812fd4 | 196 | *@} |
| JMF | 0:24d3eb812fd4 | 197 | */ |
| JMF | 0:24d3eb812fd4 | 198 | |
| JMF | 0:24d3eb812fd4 | 199 | |
| JMF | 0:24d3eb812fd4 | 200 | #ifdef __cplusplus |
| JMF | 0:24d3eb812fd4 | 201 | } |
| JMF | 0:24d3eb812fd4 | 202 | #endif |
| JMF | 0:24d3eb812fd4 | 203 | |
| JMF | 0:24d3eb812fd4 | 204 | #endif |
| JMF | 0:24d3eb812fd4 | 205 | |
| JMF | 0:24d3eb812fd4 | 206 | /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/ |