Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LoRaPHYAU915.h Source File

LoRaPHYAU915.h

Go to the documentation of this file.
00001 /**
00002  *  @file LoRaPHYAU915.h
00003  *
00004  *  @brief Implements LoRaPHY for Australian 915 MHz band
00005  *
00006  *  \code
00007  *   ______                              _
00008  *  / _____)             _              | |
00009  * ( (____  _____ ____ _| |_ _____  ____| |__
00010  *  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
00011  *  _____) ) ____| | | || |_| ____( (___| | | |
00012  * (______/|_____)_|_|_| \__)_____)\____)_| |_|
00013  *   (C)2013 Semtech
00014  *  ___ _____ _   ___ _  _____ ___  ___  ___ ___
00015  * / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
00016  * \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
00017  * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
00018  * embedded.connectivity.solutions===============
00019  *
00020  * \endcode
00021  *
00022  *
00023  * License: Revised BSD License, see LICENSE.TXT file include in the project
00024  *
00025  * Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
00026  *
00027  * Copyright (c) 2017, Arm Limited and affiliates.
00028  * SPDX-License-Identifier: BSD-3-Clause
00029  *
00030  */
00031 
00032 #ifndef MBED_OS_LORAPHY_AU915_H_
00033 
00034 #define MBED_OS_LORAPHY_AU915_H_
00035 
00036 #if !(DOXYGEN_ONLY)
00037 
00038 #include "LoRaPHY.h"
00039 
00040 // Definitions
00041 /*!
00042  * LoRaMac maximum number of channels
00043  */
00044 #define AU915_MAX_NB_CHANNELS                       72
00045 
00046 /*!
00047  * LoRaMac maximum number of bands
00048  */
00049 #define AU915_MAX_NB_BANDS                          1
00050 
00051 #define AU915_CHANNEL_MASK_SIZE                    5
00052 
00053 class LoRaPHYAU915 : public LoRaPHY {
00054 
00055 public:
00056 
00057     LoRaPHYAU915();
00058     virtual ~LoRaPHYAU915();
00059 
00060     virtual bool rx_config(rx_config_params_t  *config);
00061 
00062     virtual bool tx_config(tx_config_params_t *config, int8_t *txPower,
00063                            lorawan_time_t *txTimeOnAir);
00064 
00065     virtual uint8_t link_ADR_request(adr_req_params_t *params,
00066                                      int8_t *drOut, int8_t *txPowOut,
00067                                      uint8_t *nbRepOut,
00068                                      uint8_t *nbBytesParsed);
00069 
00070     virtual uint8_t accept_rx_param_setup_req(rx_param_setup_req_t *params);
00071 
00072     virtual int8_t get_alternate_DR(uint8_t nb_trials);
00073 
00074     virtual lorawan_status_t set_next_channel(channel_selection_params_t *next_chan_params,
00075                                               uint8_t *channel, lorawan_time_t *time,
00076                                               lorawan_time_t *aggregate_timeoff);
00077 
00078     virtual uint8_t apply_DR_offset(int8_t dr, int8_t dr_offset);
00079 
00080 private:
00081 
00082     /**
00083      * Sets the intersection of source and destination channel masks
00084      * into the destination.
00085      */
00086     void intersect_channel_mask(const uint16_t *source, uint16_t *destination,
00087                                 uint8_t size);
00088 
00089     /**
00090      * Fills channel mask array based upon the provided FSB mask
00091      */
00092     void fill_channel_mask_with_fsb(const uint16_t *expectation,
00093                                     const uint16_t *fsb_mask,
00094                                     uint16_t *channel_mask, uint8_t size);
00095 
00096     /**
00097      * Fills channel mask array with a given value
00098      */
00099     void fill_channel_mask_with_value(uint16_t *channel_mask,
00100                                       uint16_t value, uint8_t size);
00101 
00102 private:
00103 
00104     /*!
00105      * LoRaMAC channels
00106      */
00107     channel_params_t channels[AU915_MAX_NB_CHANNELS];
00108 
00109     /*!
00110      * LoRaMac bands
00111      */
00112     band_t  bands[AU915_MAX_NB_BANDS];
00113 
00114     /*!
00115      * LoRaMac channel mask
00116      */
00117     uint16_t channel_mask[AU915_CHANNEL_MASK_SIZE];
00118 
00119     /*!
00120      * Previously used channel mask
00121      */
00122     uint16_t current_channel_mask[AU915_CHANNEL_MASK_SIZE];
00123 
00124     /*!
00125      * LoRaMac channels default mask
00126      */
00127     uint16_t default_channel_mask[AU915_CHANNEL_MASK_SIZE];
00128 };
00129 
00130 #endif /* DOXYGEN_ONLY*/
00131 #endif /* MBED_OS_LORAPHY_AU915_H_ */
00132