Appiko
S2LP_PacketHandler.h
Go to the documentation of this file.
1 
44 /* Define to prevent recursive inclusion -------------------------------------*/
45 #ifndef __S2LP_PKT_COMMON_H
46 #define __S2LP_PKT_COMMON_H
47 
48 /* Includes ------------------------------------------------------------------*/
49 
50 #include "S2LP_Regs.h"
51 #include "S2LP_Types.h"
52 
53 #ifdef __cplusplus
54  extern "C" {
55 #endif
56 
57 
80 typedef enum {
81  PKT_NO_CRC = 0x00,
87 } PktCrcMode;
88 
89 
93 typedef enum
94 {
95  NORMAL_TX_MODE = 0x00,
98  PN9_TX_MODE = 0x0C
99 } DirectTx;
100 
101 
105 typedef enum
106 {
107  NORMAL_RX_MODE = 0x00,
110 } DirectRx;
111 
112 
134 #define S2LPSetPreambleLengthByte(xPreambleLength) S2LPSetPreambleLength(4*xPreambleLength)
135 #define S2LPSetSyncLengthByte(cSyncLength) S2LPSetSyncLength(8*cSyncLength)
136 
137 #define IS_PREAMBLE_LEN(VAL) (VAL<=1024)
138 #define IS_SYNC_LEN(VAL) (VAL<=64)
139 
140 #define IS_PKT_LEN_FIELD_WID(LENGTH) ((LENGTH == PKT_LENGTH_FIELD_1BYTE) || \
141  (LENGTH == PKT_LENGTH_FIELD_2BYTE))
142 
143 
144 #define IS_PKT_CRC_MODE(MODE) ((MODE == PKT_NO_CRC) || \
145  (MODE == PKT_CRC_MODE_8BITS) || \
146  (MODE == PKT_CRC_MODE_16BITS_1) || \
147  (MODE == PKT_CRC_MODE_16BITS_2) || \
148  (MODE == PKT_CRC_MODE_24BITS))
149 
159 void S2LPSetPreambleLength(uint16_t cPreambleLength);
160 uint16_t S2LPGetPreambleLength(void);
161 void S2LPSetSyncLength(uint8_t cSyncLength);
162 uint8_t S2LPGetSyncLength(void);
163 void S2LPSetSyncWords(uint32_t lSyncWords, uint8_t xSyncLength);
164 void S2LPGetSyncWords(uint32_t* lSyncWords, uint8_t* cSyncLength);
166 void S2LPPacketHandlerFec(SFunctionalState xNewState);
169 uint8_t S2LPGetPacketFormat(void);
172 uint8_t S2LPGetReceivedSourceAddress(void);
173 uint8_t S2LPGetMyAddress(void);
174 uint8_t S2LPGetBroadcastAddress(void);
175 uint8_t S2LPGetMulticastAddress(void);
176 uint8_t S2LPGetRxSourceMask(void);
177 uint8_t S2LPGetRxSourceReferenceAddress(void);
178 void S2LPPacketHandlerSetTxMode(DirectTx xNewState);
179 void S2LPPacketHandlerSetRxMode(DirectRx xNewState);
187 void S2LPPacketHandlerSetCrcMode(PktCrcMode xPktCrcMode);
194 void S2LPSetDualSyncWords(uint32_t lSyncWords);
195 void S2LPGetDualSyncWords(uint32_t* lSyncWords);
196 void S2LPSetRxSourceMask(uint8_t address);
197 void S2LPSetRxSourceReferenceAddress(uint8_t address);
198 void S2LPSetBroadcastAddress(uint8_t address);
199 void S2LPSetMulticastAddress(uint8_t address);
200 void S2LPSetMyAddress(uint8_t address);
201 uint8_t S2LPGetMyAddress(void);
202 
203 
217 #ifdef __cplusplus
218 }
219 #endif
220 
221 #endif
222 
223 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
void S2LPPacketHandler3OutOf6(SFunctionalState xNewState)
Enable or Disable the 3o6 encoding.
uint8_t S2LPPacketHandlerGetTransmittedSeqNumber(void)
Returns the sequence number of the transmitted packet.
void S2LPPacketHandlerSetExtendedLenField(SFunctionalState xExtendedLenField)
Set the extended length field in case of variable length.
void S2LPPacketHandlerSwapPreamblePattern(SFunctionalState xEnableSwap)
Swap preamble pattern.
void S2LPPacketHandlerSetAutoPcktFilter(SFunctionalState xNewState)
Enable or Disable the auto packet filter mechanisms.
DirectTx S2LPPacketHandlerGetTxMode(void)
Return the DirectRF TX mode of S2LP.
void S2LPSetMyAddress(uint8_t address)
Set the MY_ADDRESS (source address that will be transmitted).
void S2LPPacketHandlerSetTxMode(DirectTx xNewState)
Set the TX mode of S2LP.
SFunctionalState
S2LP Functional state. Used to enable or disable a specific option.
Definition: S2LP_Types.h:67
void S2LPSetPreambleLength(uint16_t cPreambleLength)
Set the PREAMBLE field Length mode for S2LP packets.
void S2LPGetDualSyncWords(uint32_t *lSyncWords)
Get the secondary sync word.
uint8_t S2LPGetSyncLength(void)
Return the SYNC field Length for S2LP packets.
void S2LPSetDualSyncWords(uint32_t lSyncWords)
Set the secondary sync word.
void S2LPPacketHandlerSelectSecondarySync(SFunctionalState xSecondarySync)
Select the secondary sync mode. In TX if enabled: it will send the secondary sync word (from the PCKT...
uint8_t S2LPGetReceivedDestinationAddress(void)
Get the received destination address.
void S2LPSetSyncWords(uint32_t lSyncWords, uint8_t xSyncLength)
Set the SYNC_WORD.
void S2LPSetBroadcastAddress(uint8_t address)
Set the BROADCAST_ADDRESS set on the chip.
void S2LPGetSyncWords(uint32_t *lSyncWords, uint8_t *cSyncLength)
Get the SYNC_WORD.
uint16_t S2LPGetPreambleLength(void)
Return the PREAMBLE field Length mode for S2LP packets.
void S2LPPktCommonFilterOnCrc(SFunctionalState xNewState)
Enable or Disable the filtering on CRC.
void S2LPPacketHandlerManchester(SFunctionalState xNewState)
Enable or Disable the MANCHESTER encoding.
This file contains all the registers address and masks.
void S2LPPacketHandlerSetRxMode(DirectRx xNewState)
Set the DirectRF RX mode of S2LP.
DirectTx
Direct transmission mode enumeration for SPIRIT.
uint8_t S2LPGetMulticastAddress(void)
Get the MULTICAST_ADDRESS set on the chip.
void S2LPPacketHandlerWhitening(SFunctionalState xNewState)
Enable or Disable WHITENING for S2LP packets.
void S2LPSetMulticastAddress(uint8_t address)
Set the MULTICAST_ADDRESS set on the chip.
void S2LPPacketHandlerSwap4FSKSymbol(SFunctionalState xSwapSymbol)
Swap the 4FSK symbol mapping.
uint8_t S2LPGetRxSourceMask(void)
Get the SOURCE_MASK set on the chip.
uint8_t S2LPGetReceivedSourceAddress(void)
Get the received source address.
uint8_t S2LPGetMyAddress(void)
Get the MY_ADDRESS set on the chip.
DirectRx S2LPPacketHandlerGetRxMode(void)
Return the DirectRF RX mode of S2LP.
PktCrcMode S2LPPacketHandlerGetCrcMode(void)
Get the CRC mode.
PktCrcMode
CRC length in bytes enumeration.
uint8_t S2LPGetBroadcastAddress(void)
Get the BROADCAST_ADDRESS set on the chip.
void S2LPSetRxSourceMask(uint8_t address)
Set the SOURCE_MASK .
void S2LPPacketHandlerFec(SFunctionalState xNewState)
Enable or Disable the FEC encoding.
uint8_t S2LPGetRxSourceReferenceAddress(void)
Get the SOURCE_REFERENCE set on the chip.
void S2LPPacketHandlerSetSrcAddrFlt(SFunctionalState xNewState)
Set the source address filtering.
void S2LPPacketHandlerSetCrcMode(PktCrcMode xPktCrcMode)
Set the CRC mode.
uint8_t S2LPGetPacketFormat(void)
Get the packet format.
Header file for S2-LP types.
DirectRx
Direct receive mode enumeration for SPIRIT.
void S2LPSetRxSourceReferenceAddress(uint8_t address)
Set the SOURCE_REFERENCEK.
void S2LPPacketHandlerSetVariableLength(SFunctionalState xVarLen)
Set the variable length mode.
void S2LPPacketHandlerSwapFifoEndianess(SFunctionalState xEnableSwap)
Change the FIFO endianness .
void S2LPSetSyncLength(uint8_t cSyncLength)
Set the SYNC field Length for S2LP packets.
void S2LPPacketHandlerSetRxPersistentMode(SFunctionalState xNewState)
Set the RX persistent mode. The device will be ever in RX unles an abort command comes.