Added support for the WNC M14A2A Cellular LTE Data Module.

Dependencies:   WNC14A2AInterface

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers spirit1.h Source File

spirit1.h

00001 /*
00002  * Copyright (c) 2012, STMicroelectronics.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the Institute nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  *
00029  * This file is part of the Contiki operating system.
00030  *
00031  */
00032 /*---------------------------------------------------------------------------*/
00033 #ifndef __SPIRIT_H__
00034 #define __SPIRIT_H__
00035 /*---------------------------------------------------------------------------*/
00036 #include "radio.h"
00037 #include "SPIRIT_Config.h"
00038 #include "spirit1-config.h"
00039 //#include "spirit1_appli.h"
00040 #include "spirit1-const.h"
00041 /*---------------------------------------------------------------------------*/   
00042 extern const struct radio_driver spirit_radio_driver;
00043 void spirit1_interrupt_callback(void);
00044 
00045 /* exported from spirit1appli.h */
00046 
00047 #include "radio_shield_config.h"
00048 #include "MCU_Interface.h"
00049 #include "SPIRIT_Config.h"
00050 // betzw - WAS: #include "SPIRIT1_Util.h"
00051 
00052 
00053 #if defined(X_NUCLEO_IDS01A3)
00054      #define USE_SPIRIT1_433MHz
00055 #elif defined(X_NUCLEO_IDS01A4)
00056          #define USE_SPIRIT1_868MHz
00057 #elif defined(X_NUCLEO_IDS01A5)
00058          #define USE_SPIRIT1_915MHz
00059 #else
00060 #error SPIRIT1 Nucleo Shield undefined or unsupported
00061 #endif
00062 
00063 /*  Uncomment the Link Layer features to be used */
00064 // #define USE_AUTO_ACK
00065 // #define USE_AUTO_ACK_PIGGYBACKING
00066 // #define USE_AUTO_RETRANSMISSION
00067 
00068 #if defined(USE_AUTO_ACK)&& defined(USE_AUTO_ACK_PIGGYBACKING)&& defined(USE_AUTO_RETRANSMISSION)
00069 #define USE_STack_PROTOCOL
00070 
00071 /* LLP configuration parameters */
00072 #define EN_AUTOACK                      S_ENABLE
00073 #define EN_PIGGYBACKING                 S_ENABLE
00074 #define MAX_RETRANSMISSIONS             PKT_N_RETX_2
00075 
00076 #else
00077 #define USE_BASIC_PROTOCOL
00078 
00079 #endif
00080 
00081 /*  Uncomment the system Operating mode */
00082 //#define USE_LOW_POWER_MODE
00083 
00084 #if defined (USE_LOW_POWER_MODE)
00085 #define LPM_ENABLE
00086 #define MCU_STOP_MODE
00087 //#define MCU_SLEEP_MODE
00088 //#define RF_STANDBY
00089 #endif
00090 
00091 
00092 /* Exported constants --------------------------------------------------------*/
00093 
00094 /*  Radio configuration parameters  */
00095 #define XTAL_OFFSET_PPM             0
00096 #define INFINITE_TIMEOUT            0.0
00097 
00098 #ifdef USE_SPIRIT1_433MHz
00099 #define BASE_FREQUENCY              433.0e6
00100 #endif
00101 
00102 #ifdef USE_SPIRIT1_868MHz
00103 #define BASE_FREQUENCY              868.0e6
00104 #endif
00105 
00106 #ifdef USE_SPIRIT1_915MHz
00107 //#define BASE_FREQUENCY              915.0e6
00108 #define BASE_FREQUENCY              902.0e6
00109 #endif
00110 
00111 
00112 /*  Addresses configuration parameters  */
00113 #define EN_FILT_MY_ADDRESS          S_DISABLE
00114 #define MY_ADDRESS                  0x24
00115 #define EN_FILT_MULTICAST_ADDRESS   S_DISABLE
00116 #define MULTICAST_ADDRESS           0xEE
00117 #define EN_FILT_BROADCAST_ADDRESS   S_DISABLE
00118 #define BROADCAST_ADDRESS           0xFF
00119 #define DESTINATION_ADDRESS         0x44
00120 #define EN_FILT_SOURCE_ADDRESS      S_DISABLE
00121 #define SOURCE_ADDR_MASK            0xf0
00122 #define SOURCE_ADDR_REF             0x37
00123 
00124 #define APPLI_CMD                       0x11
00125 #define NWK_CMD                         0x22
00126 #define LED_TOGGLE                      0xff
00127 #define ACK_OK                          0x01
00128 #define MAX_BUFFER_LEN                  96
00129 #define TIME_TO_EXIT_RX                 3000
00130 #define DELAY_RX_LED_TOGGLE             200
00131 #define DELAY_TX_LED_GLOW               1000
00132 #define LPM_WAKEUP_TIME                 100
00133 #define DATA_SEND_TIME                  30
00134 
00135 #define PREAMBLE_LENGTH             PKT_PREAMBLE_LENGTH_04BYTES
00136 #define SYNC_LENGTH                 PKT_SYNC_LENGTH_4BYTES
00137 #define CONTROL_LENGTH              PKT_CONTROL_LENGTH_0BYTES
00138 #define EN_ADDRESS                  S_DISABLE
00139 #define EN_FEC                      S_DISABLE
00140 #define CHANNEL_NUMBER              1 // betzw - WAS: 0
00141 #define LENGTH_TYPE                 PKT_LENGTH_VAR
00142 #define POWER_INDEX                 7
00143 #define RECEIVE_TIMEOUT             2000.0 /*change the value for required timeout period*/
00144 #define RSSI_THRESHOLD              -120
00145 
00146 
00147 
00148 #define POWER_DBM                   11.6
00149 #define CHANNEL_SPACE               100e3
00150 #define FREQ_DEVIATION              127e3
00151 #define BANDWIDTH                   540.0e3
00152 #define MODULATION_SELECT           GFSK_BT1
00153 #define DATARATE                    250000
00154 #define XTAL_OFFSET_PPM             0
00155 #define SYNC_WORD                   0x88888888
00156 #define LENGTH_WIDTH                8 // betzw - NOTE: only 255 bytes for payload!!!
00157 #define CRC_MODE                    PKT_CRC_MODE_16BITS_2
00158 #define EN_WHITENING                S_DISABLE
00159 #define INFINITE_TIMEOUT            0.0
00160 
00161 // extern volatile FlagStatus xRxDoneFlag, xTxDoneFlag;
00162 // extern volatile FlagStatus PushButtonStatusWakeup;
00163 extern uint16_t wakeupCounter;
00164 extern uint16_t dataSendCounter ;
00165 // extern volatile FlagStatus PushButtonStatusData, datasendFlag;
00166 
00167 typedef struct
00168 {
00169   uint8_t Cmdtag;
00170   uint8_t CmdType;
00171   uint8_t CmdLen;
00172   uint8_t Cmd;
00173   uint8_t DataLen;
00174   uint8_t* DataBuff;
00175 }AppliFrame_t;
00176 
00177 /*---------------------------------------------------------------------------*/
00178 #endif /* __SPIRIT_H__ */
00179 /*---------------------------------------------------------------------------*/