Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: DISCO_IOT-wifi_client
Fork of stm-spirit1-rf-driver by
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 /* General Remarks: 00096 * Two SPSGRF modules will only communicate when both are having same frequency , same channel number, 00097 * same modulation scheme, same data rate, etc. 00098 * For example, the SPSGRF-915 module supports frequencies 902 to 928 MHz. User can select any frequency 00099 * between this band. 00100 */ 00101 #define XTAL_OFFSET_PPM 0 00102 #define INFINITE_TIMEOUT 0.0 00103 00104 #ifdef USE_SPIRIT1_433MHz 00105 #define BASE_FREQUENCY 433.0e6 00106 #endif 00107 00108 #ifdef USE_SPIRIT1_868MHz 00109 #define BASE_FREQUENCY 868.0e6 00110 #endif 00111 00112 #ifdef USE_SPIRIT1_915MHz 00113 #define BASE_FREQUENCY 915.0e6 00114 #endif 00115 00116 00117 /* Addresses configuration parameters */ 00118 #define EN_FILT_MY_ADDRESS S_DISABLE 00119 #define MY_ADDRESS 0x24 00120 #define EN_FILT_MULTICAST_ADDRESS S_DISABLE 00121 #define MULTICAST_ADDRESS 0xEE 00122 #define EN_FILT_BROADCAST_ADDRESS S_DISABLE 00123 #define BROADCAST_ADDRESS 0xFF 00124 #define DESTINATION_ADDRESS 0x44 00125 #define EN_FILT_SOURCE_ADDRESS S_DISABLE 00126 #define SOURCE_ADDR_MASK 0xf0 00127 #define SOURCE_ADDR_REF 0x37 00128 00129 #define APPLI_CMD 0x11 00130 #define NWK_CMD 0x22 00131 #define LED_TOGGLE 0xff 00132 #define ACK_OK 0x01 00133 #define MAX_BUFFER_LEN 96 00134 #define TIME_TO_EXIT_RX 3000 00135 #define DELAY_RX_LED_TOGGLE 200 00136 #define DELAY_TX_LED_GLOW 1000 00137 #define LPM_WAKEUP_TIME 100 00138 #define DATA_SEND_TIME 30 00139 00140 #define PREAMBLE_LENGTH PKT_PREAMBLE_LENGTH_04BYTES 00141 #define SYNC_LENGTH PKT_SYNC_LENGTH_4BYTES 00142 #define CONTROL_LENGTH PKT_CONTROL_LENGTH_0BYTES 00143 #define EN_ADDRESS S_DISABLE 00144 #define EN_FEC S_DISABLE 00145 #define CHANNEL_NUMBER 1 // betzw - WAS: 0 00146 #define LENGTH_TYPE PKT_LENGTH_VAR 00147 #define POWER_INDEX 7 00148 #define RECEIVE_TIMEOUT 2000.0 /*change the value for required timeout period*/ 00149 #define RSSI_THRESHOLD -120 00150 00151 00152 00153 #define POWER_DBM 11.6 00154 #define CHANNEL_SPACE 100e3 00155 #define FREQ_DEVIATION 127e3 00156 #define BANDWIDTH 540.0e3 00157 #define MODULATION_SELECT GFSK_BT1 00158 #define DATARATE 250000 00159 #define XTAL_OFFSET_PPM 0 00160 #define SYNC_WORD 0x88888888 00161 #define LENGTH_WIDTH 8 // betzw - NOTE: only 255 bytes for payload!!! 00162 #define CRC_MODE PKT_CRC_MODE_16BITS_2 00163 #define EN_WHITENING S_DISABLE 00164 #define INFINITE_TIMEOUT 0.0 00165 00166 // extern volatile FlagStatus xRxDoneFlag, xTxDoneFlag; 00167 // extern volatile FlagStatus PushButtonStatusWakeup; 00168 extern uint16_t wakeupCounter; 00169 extern uint16_t dataSendCounter ; 00170 // extern volatile FlagStatus PushButtonStatusData, datasendFlag; 00171 00172 typedef struct 00173 { 00174 uint8_t Cmdtag; 00175 uint8_t CmdType; 00176 uint8_t CmdLen; 00177 uint8_t Cmd; 00178 uint8_t DataLen; 00179 uint8_t* DataBuff; 00180 }AppliFrame_t; 00181 00182 /*---------------------------------------------------------------------------*/ 00183 #endif /* __SPIRIT_H__ */ 00184 /*---------------------------------------------------------------------------*/
Generated on Tue Jul 12 2022 14:16:15 by
 1.7.2
 1.7.2 
    