Version of easy-connect with the u-blox cellular platforms C027 and C030 added.

Dependents:   HelloMQTT

Embed: (wiki syntax)

« Back to documentation index

SPIRIT_Csma.h File Reference

SPIRIT_Csma.h File Reference

Configuration and management of SPIRIT CSMA. More...

Go to the source code of this file.

Data Structures

struct  CsmaInit
 SPIRIT CSMA Init structure definition. More...

Enumerations

enum  CcaPeriod { TBIT_TIME_64 = CSMA_CCA_PERIOD_64TBIT, TBIT_TIME_128 = CSMA_CCA_PERIOD_128TBIT, TBIT_TIME_256 = CSMA_CCA_PERIOD_256TBIT, TBIT_TIME_512 = CSMA_CCA_PERIOD_512TBIT }
 

Multiplier for Tcca time enumeration (Tcca = Multiplier*Tbit).

More...
enum  CsmaLength {
  TCCA_TIME_0 = 0x00, TCCA_TIME_1 = 0x10, TCCA_TIME_2 = 0x20, TCCA_TIME_3 = 0x30,
  TCCA_TIME_4 = 0x40, TCCA_TIME_5 = 0x50, TCCA_TIME_6 = 0x60, TCCA_TIME_7 = 0x70,
  TCCA_TIME_8 = 0x80, TCCA_TIME_9 = 0x90, TCCA_TIME_10 = 0xA0, TCCA_TIME_11 = 0xB0,
  TCCA_TIME_12 = 0xC0, TCCA_TIME_13 = 0xD0, TCCA_TIME_14 = 0xE0, TCCA_TIME_15 = 0xF0
}
 

Multiplier of Tcca time enumeration to obtain Tlisten (Tlisten = [1...15]*Tcca).

More...

Functions

void SpiritCsmaInit (CsmaInit *pxCsmaInit)
 Initializes the SPIRIT CSMA according to the specified parameters in the CsmaInit.
void SpiritCsmaGetInfo (CsmaInit *pxCsmaInit)
 Returns the fitted structure CsmaInit starting from the registers values.
void SpiritCsma (SpiritFunctionalState xNewState)
 Enables or Disables the CSMA.
SpiritFunctionalState SpiritCsmaGetCsma (void)
 Gets the CSMA mode.
void SpiritCsmaPersistentMode (SpiritFunctionalState xNewState)
 Enables or Disables the persistent CSMA mode.
SpiritFunctionalState SpiritCsmaGetPersistentMode (void)
 Gets the persistent CSMA mode.
void SpiritCsmaSeedReloadMode (SpiritFunctionalState xNewState)
 Enables or Disables the seed reload mode (if enabled it reloads the back-off generator seed using the value written in the BU_COUNTER_SEED register).
SpiritFunctionalState SpiritCsmaGetSeedReloadMode (void)
 Gets the seed reload mode.
void SpiritCsmaSetBuCounterSeed (uint16_t nBuCounterSeed)
 Sets the BU counter seed (BU_COUNTER_SEED register).
uint16_t SpiritCsmaGetBuCounterSeed (void)
 Returns the BU counter seed (BU_COUNTER_SEED register).
void SpiritCsmaSetBuPrescaler (uint8_t cBuPrescaler)
 Sets the BU prescaler.
uint8_t SpiritCsmaGetBuPrescaler (void)
 Returns the BU prescaler.
void SpiritCsmaSetCcaPeriod (CcaPeriod xMultiplierTbit)
 Sets the CCA period.
CcaPeriod SpiritCsmaGetCcaPeriod (void)
 Returns the CCA period.
void SpiritCsmaSetCcaLength (CsmaLength xCcaLength)
 Sets the CCA length.
uint8_t SpiritCsmaGetCcaLength (void)
 Returns the CCA length.
void SpiritCsmaSetMaxNumberBackoff (uint8_t cMaxNb)
 Sets the max number of back-off.
uint8_t SpiritCsmaGetMaxNumberBackoff (void)
 Returns the max number of back-off.

Detailed Description

Configuration and management of SPIRIT CSMA.

Author:
VMA division - AMS
Version:
3.2.2
Date:
08-July-2015

The Spirit CSMA feature, when configured and enabled, is transparent for the user. It means the user has only to call the SpiritCsmaInit() function on a filled structure and then enable the CSMA policy using the SpiritCsma() function.

Example:

 CsmaInit csmaInit={
   S_DISABLE,         // persistent mode
   TBIT_TIME_64 ,      // Tbit time
   TCCA_TIME_3 ,       // Tcca time
   5,                 // max number of backoffs
   0xFA21,            // BU counter seed
   32                 // CU prescaler
 };

 ...

 SpiritCsmaInit(&csmaInit);
 SpiritCsma(S_ENABLE);
Note:
The CS status depends of the RSSI threshold set. Please see the Spirit_Qi module for details.
Attention:

© COPYRIGHT(c) 2015 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file SPIRIT_Csma.h.