Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fhss_config.h Source File

fhss_config.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2015-2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /**
00019  * \file fhss_config.h
00020  * \brief
00021  */
00022 
00023 #ifndef FHSS_CONFIG_H
00024 #define FHSS_CONFIG_H
00025 
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 /**
00032  * \brief Struct fhss_tuning_parameter defines FHSS tuning parameters.
00033  * All delays are given in microseconds.
00034  */
00035 typedef struct fhss_tuning_parameter
00036 {
00037     /** Delay between data pushed to PHY TX function and TX started (Contains CSMA-CA maximum random period). */
00038     uint32_t tx_processing_delay;
00039 
00040     /** Delay between TX done (by transmitter) and received data pushed to MAC (by receiver). */
00041     uint32_t rx_processing_delay;
00042 
00043     /** Delay between TX done (by transmitter) and Ack transmission started (by receiver) */
00044     uint32_t ack_processing_delay;
00045 } fhss_tuning_parameter_t;
00046 
00047 /**
00048  * \brief Struct fhss_configuration defines basic configuration of FHSS.
00049  */
00050 typedef struct fhss_configuration
00051 {
00052     /** Tuning parameters can be used to enhance synchronization accuracy*/
00053     fhss_tuning_parameter_t fhss_tuning_parameters;
00054 
00055     /** Maximum used interval for requesting synchronization info from FHSS parent device (seconds). */
00056     uint16_t fhss_max_synch_interval;
00057 
00058     /** Number of channel retries. */
00059     uint8_t fhss_number_of_channel_retries;
00060 
00061     /** Channel mask */
00062     uint32_t channel_mask[8];
00063 
00064 } fhss_configuration_t;
00065 
00066 /**
00067  * \brief Struct fhss_timer defines interface between FHSS and FHSS platform timer.
00068  * Application must implement FHSS timer driver which is then used by FHSS with this interface.
00069  */
00070 typedef struct fhss_timer
00071 {
00072     /** Start timeout (1us) */
00073     int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);
00074 
00075     /** Stop timeout */
00076     int (*fhss_timer_stop)(const fhss_api_t *fhss_api);
00077 
00078     /** Get remaining time of started timeout*/
00079     uint32_t (*fhss_get_remaining_slots)(const fhss_api_t *fhss_api);
00080 
00081     /** Get timestamp since initialization of driver. Overflow of 32-bit counter is allowed (1us) */
00082     uint32_t (*fhss_get_timestamp)(const fhss_api_t *fhss_api);
00083 
00084     /** Divide 1 microsecond resolution. E.g. to use 64us resolution, use fhss_resolution_divider = 64*/
00085     uint8_t fhss_resolution_divider;
00086 } fhss_timer_t;
00087 
00088 /**
00089  * \brief Struct fhss_synch_configuration defines the synchronization time configurations.
00090  * Border router application must define and set these configuration for FHSS network.
00091  */
00092 typedef struct fhss_synch_configuration
00093 {
00094     /** Number of broadcast channels. */
00095     uint8_t fhss_number_of_bc_channels;
00096 
00097     /** TX slots per channel. */
00098     uint8_t fhss_number_of_tx_slots;
00099 
00100     /** Length of superframe(microseconds) * Number of superframes defines the
00101         channel dwell time. E.g. 50000us * 8 -> Channel dwell time 400ms */
00102     uint16_t fhss_superframe_length;
00103 
00104     /** Number of superframes. */
00105     uint8_t fhss_number_of_superframes;
00106 } fhss_synch_configuration_t;
00107 
00108 
00109 /**
00110  * \brief Struct fhss_statistics defines the available FHSS statistics.
00111  */
00112 typedef struct fhss_statistics
00113 {
00114     /** FHSS synchronization drift compensation (us/channel). */
00115     int16_t fhss_drift_compensation;
00116 
00117     /** FHSS hop count. */
00118     uint8_t fhss_hop_count;
00119 
00120     /** FHSS synchronization interval (s). */
00121     uint16_t fhss_synch_interval;
00122 
00123     /** Average of 5 preceding synchronization fixes (us). Updated after every fifth synch fix. */
00124     int16_t fhss_prev_avg_synch_fix;
00125 
00126     /** FHSS synchronization lost counter. */
00127     uint32_t fhss_synch_lost;
00128 } fhss_statistics_t;
00129 
00130 /**
00131  * \brief Enumeration fhss_channel_mode_e defines the channel modes.
00132  */
00133 typedef enum fhss_channel_mode_e {
00134     SINGLE_CHANNEL,     //< Single channel
00135     FHSS,               //< Frequency hopping mode
00136 } fhss_channel_mode_e;
00137 
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141 
00142 #endif // FHSS_CONFIG_H