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

Configuration and management of S2-LP Basic 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  PktBasicInit
 S2LP Basic Packet Init structure definition. More...
 
struct  PktBasicAddressesInit
 S2LP Basic packet address structure definition. This structure allows users to specify the node/multicast/broadcast addresses and the correspondent filtering options. More...
 

Macros

#define S2LPPktBasicSetPreambleLength(xPreambleLength)   S2LPSetPreambleLength(xPreambleLength)
 Sets the PREAMBLE field length for S2LP Basic packets. More...
 
#define S2LPPktBasicGetPreambleLength()   S2LPGetPreambleLength()
 Returns the PREAMBLE field length mode for S2LP Basic packets. More...
 
#define S2LPPktBasicSetSyncLength(xSyncLength)   S2LPSetSyncLength((PktSyncLength)xSyncLength)
 Sets the SYNC field length for S2LP Basic packets. More...
 
#define S2LPPktBasicGetSyncLength()   S2LPGetSyncLength()
 Returns the SYNC field length for S2LP Basic packets. More...
 
#define S2LPPktBasicFilterOnCrc(xNewState)   S2LPPktCommonFilterOnCrc(xNewState)
 Enables or Disables the CRC filtering. More...
 
#define S2LPPktBasicWhitening(xNewState)   S2LPWhitening(xNewState)
 Enables or Disables WHITENING for S2LP packets. More...
 
#define S2LPPktBasicFec(xNewState)   S2LPFec(xNewState)
 Enables or Disables FEC for S2LP Basic packets. More...
 
#define S2LPPktBasicSetSyncWords(lSyncWords, xSyncLength)   S2LPSetSyncWords(lSyncWords, xSyncLength)
 Sets multiple SYNC words for S2LP Basic packets. More...
 

Typedefs

typedef PktCrcMode BasicCrcMode
 CRC length in bytes enumeration.
 

Functions

void S2LPPktBasicInit (PktBasicInit *pxPktBasicInit)
 Initialize the S2LP Basic packet according to the specified parameters in the PktBasicInit struct. Notice that this function sets the autofiltering option on CRC if it is set to any value different from BASIC_NO_CRC. More...
 
void S2LPPktBasicGetInfo (PktBasicInit *pxPktBasicInit)
 Return the S2LP Basic packet structure according to the specified parameters in the registers. More...
 
void S2LPPktBasicAddressesInit (PktBasicAddressesInit *pxPktBasicAddresses)
 Initialize the S2LP Basic packet addresses according to the specified parameters in the PktBasicAddressesInit struct. More...
 
void S2LPPktBasicGetAddressesInfo (PktBasicAddressesInit *pxPktBasicAddresses)
 Return the S2LP Basic packet addresses structure according to the specified parameters in the registers. More...
 
void S2LPPktBasicSetFormat (void)
 Configure the Basic packet format as packet used by S2LP. More...
 
void S2LPPktBasicAddressField (SFunctionalState xAddressField)
 Set the address length for S2LP Basic packets. More...
 
SFunctionalState S2LPPktBasicGetAddressField (void)
 Specify if the Address field for S2LP Basic packets is enabled or disabled. More...
 
void S2LPPktBasicSetPayloadLength (uint16_t nPayloadLength)
 Set the payload length for S2LP Basic 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 packet length to be written. More...
 
uint16_t S2LPPktBasicGetPayloadLength (void)
 Return the payload length for S2LP Basic 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...
 
uint16_t S2LPPktBasicGetReceivedPktLength (void)
 Return the packet length field of the received 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 Basic packets. The user can obtain a packet configuration filling the structure PktBasicInit, defining in it some general parameters for the S2-LP Basic packet format. Another structure the user can fill is PktBasicAddressesInit 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:

PktBasicInit basicInit={
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_ENABLE, // address field
S_DISABLE, // FEC
S_ENABLE // whitening
};
PktBasicAddressesInit 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
};
...
S2LPPktBasicInit(&basicInit);
...
S2LPPktBasicSetPayloadLength(20);
S2LPPktBasicSetDestinationAddress(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 2016 STMicroelectronics

Definition in file S2LP_PktBasic.h.