Appiko
Data Structures | Macros | Typedefs | Functions
S2LP_PktStack.h File Reference

Configuration and management of S2-LP STack packets. More...

#include "S2LP_Regs.h"
#include "S2LP_Types.h"
#include "S2LP_PacketHandler.h"

Go to the source code of this file.

Data Structures

struct  PktStackInit
 S2LP STack Packet Init structure definition. More...
 
struct  PktStackAddressesInit
 S2LP STack packet address structure definition. This structure allows users to specify the node/multicast/broadcast addresses and the correspondent filtering options. More...
 

Macros

#define S2LPPktStackSetPreambleLength(xPreambleLength)   S2LPSetPreambleLength(xPreambleLength)
 Sets the PREAMBLE Length mode for S2LP STack packets. More...
 
#define S2LPPktStackGetPreambleLength()   S2LPGetPreambleLength()
 Returns the PREAMBLE Length mode for S2LP STack packets. More...
 
#define S2LPPktStackSetSyncLength(xSyncLength)   S2LPSetSyncLength((PktSyncLength)xSyncLength)
 Sets the SYNC Length for S2LP STack packets. More...
 
#define S2LPPktStackGetSyncLength()   S2LPGetSyncLength()
 Returns the SYNC Length for S2LP STack packets. More...
 
#define S2LPPktStackFilterOnCrc(xNewState)   S2LPPktCommonFilterOnCrc(xNewState)
 Enables or Disables the CRC filtering. More...
 
#define S2LPPktStackWhitening(xNewState)   S2LPWhitening(xNewState)
 Enables or Disables WHITENING for S2LP STack packets. More...
 
#define S2LPPktStackFec(xNewState)   S2LPFec(xNewState)
 Enables or Disables FEC for S2LP STack packets. More...
 
#define S2LPPktStackSetSyncWords(lSyncWords, xSyncLength)   S2LPSetSyncWords(lSyncWords,xSyncLength)
 Sets multiple SYNC words for S2LP STack packets. More...
 

Typedefs

typedef PktCrcMode StackCrcMode
 CRC length in bytes enumeration.
 

Functions

void S2LPPktStackInit (PktStackInit *pxPktStackInit)
 Initialize the S2LP STack packet according to the specified parameters in the PktStackInit. More...
 
void S2LPPktStackGetInfo (PktStackInit *pxPktStackInit)
 Return the S2LP STack packet structure according to the specified parameters in the registers. More...
 
void S2LPPktStackAddressesInit (PktStackAddressesInit *pxPktStackAddresses)
 Initialize the S2LP STack packet addresses according to the specified parameters in the PktStackAddresses struct. More...
 
void S2LPPktStackGetAddressesInfo (PktStackAddressesInit *pxPktStackAddresses)
 Return the S2LP STack packet addresses structure according to the specified parameters in the registers. More...
 
void S2LPPktStackSetFormat (void)
 Configure the STack packet format for S2LP. More...
 
void S2LPPktStackSetPayloadLength (uint16_t nPayloadLength)
 Set the payload length for S2LP STack packets. Since the packet length depends from the address (always 2 for this packet format) and the control field size, this function reads the control length register content in order to determine the correct packet length to be written. More...
 
uint16_t S2LPPktStackGetPayloadLength (void)
 Return the payload length for S2LP STack packets. Since the packet length depends from the address and the control field size, this function reads the correspondent registers in order to determine the correct payload length to be returned. More...
 
void S2LPPktStackAckRequest (SFunctionalState xNewState)
 This function will set the NO_ACK bit or reset it. More...
 
void S2LPPktStackAutoAck (SFunctionalState xNewState)
 Se the AUTO_ACK bit on the receiver . More...
 
void S2LPPktStackNRetx (uint8_t nRetx)
 Set the number of retransmissions to be done in case of ACK loss. More...
 
void S2LPPktStackPiggybacking (SFunctionalState xNewState)
 Enable or Disable the piggybacking. More...
 
SFlagStatus S2LPPktStackGetTXAckRequest (void)
 Get the NO_ACK bit. More...
 
uint8_t S2LPPktStackGetNReTx (void)
 Returns the number of retransmission done on the transmitted packet. More...
 

Detailed Description

Author
LowPower RF BU - AMG
Version
1.2.1
Date
16-April-2018

This module can be used to manage the configuration of S2LP STack packets, and it is quite similar to the Basic packets one since the STack packets can be considered an extension of Basic. The user can obtain a packet configuration filling the structure PktStackInit, defining in it some general parameters for the S2-LP STack packet format. Another structure the user can fill is PktStackAddressesInit to define the addresses which will be used during the communication. Moreover, functions to set the payload length and the destination address are provided.

Example:

PktStackInit stackInit={
32, // preamble length in bits
32, // sync word length in bits
0x88888888, // sync word
S_ENABLE, // variable or fixed payload length
S_DISABLE, // extended length field width (used only for variable length)
PKT_NO_CRC, // CRC mode
S_DISABLE, // FEC
S_ENABLE // whitening
};
PktStackAddressesInit addressInit={
S_ENABLE, // enable/disable filtering on my address
0x34, // my address (address of the current node)
S_DISABLE, // enable/disable filtering on multicast address
0xEE, // multicast address
S_DISABLE, // enable/disable filtering on broadcast address
0xFF // broadcast address
};
...
S2LPPktStackInit(&stackInit);
...
S2LPPktStackSetPayloadLength(20);
S2LPPktStackSetDestinationAddress(0x44);
...

The module provides some other functions that can be used to modify or read only some configuration parameters.

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

THIS SOURCE CODE IS PROTECTED BY A LICENSE. FOR MORE INFORMATION PLEASE CAREFULLY READ THE LICENSE AGREEMENT FILE LOCATED IN THE ROOT DIRECTORY OF THIS FIRMWARE PACKAGE.

© COPYRIGHT 2015 STMicroelectronics

Definition in file S2LP_PktStack.h.