PingPong-ClickButtonToWork

Dependents:   Lora_SX1272_Coragem-dev-shared Lora_SX1272_serial

Embed: (wiki syntax)

« Back to documentation index

SX1272 Class Reference

SX1272 Class Reference

SX1272 Class. More...

#include <SX1272.h>

Public Member Functions

 SX1272 ()
 class constructor
uint8_t ON ()
 It puts the module ON.
void OFF ()
 It puts the module OFF.
byte readRegister (byte address)
 It reads an internal module register.
void writeRegister (byte address, byte data)
 It writes in an internal module register.
void clearFlags ()
 It clears the interruption flags.
uint8_t setLORA ()
 It sets the LoRa mode on.
uint8_t setFSK ()
 It sets the FSK mode on.
uint8_t getMode ()
 It gets the BW, SF and CR of the module.
int8_t setMode (uint8_t mode)
 It sets the BW, SF and CR of the module.
uint8_t getHeader ()
 It gets the header mode configured.
int8_t setHeaderON ()
 It sets explicit header mode.
int8_t setHeaderOFF ()
 It sets implicit header mode.
uint8_t getCRC ()
 It gets the CRC configured.
uint8_t setCRC_ON ()
 It sets CRC on.
uint8_t setCRC_OFF ()
 It sets CRC off.
boolean isSF (uint8_t spr)
 It is true if the SF selected exists.
int8_t getSF ()
 It gets the SF configured.
uint8_t setSF (uint8_t spr)
 It sets the SF.
boolean isBW (uint16_t band)
 It is true if the BW selected exists.
int8_t getBW ()
 It gets the BW configured.
int8_t setBW (uint16_t band)
 It sets the BW.
boolean isCR (uint8_t cod)
 It is true if the CR selected exists.
int8_t getCR ()
 It gets the CR configured.
int8_t setCR (uint8_t cod)
 It sets the CR.
boolean isChannel (uint32_t ch)
 It is true if the channel selected exists.
uint8_t getChannel ()
 It gets frequency channel the module is using.
int8_t setChannel (uint32_t ch)
 It sets frequency channel the module is using.
uint8_t getPower ()
 It gets the output power of the signal.
int8_t setPower (char p)
 It sets the output power of the signal.
int8_t setPowerNum (uint8_t pow)
 It sets the output power of the signal.
uint8_t getPreambleLength ()
 It gets the preamble length configured.
uint8_t setPreambleLength (uint16_t l)
 It sets the preamble length.
uint8_t getPayloadLength ()
 It gets the payload length of the last packet to send/receive.
int8_t setPacketLength ()
 It sets the packet length to send/receive.
int8_t setPacketLength (uint8_t l)
 It sets the packet length to send/receive.
uint8_t getNodeAddress ()
 It gets the node address of the mote.
int8_t setNodeAddress (uint8_t addr)
 It sets the node address of the mote.
int8_t getSNR ()
 It gets the SNR of the latest received packet.
uint8_t getRSSI ()
 It gets the current value of RSSI.
int16_t getRSSIpacket ()
 It gets the RSSI of the latest received packet.
uint8_t setRetries (uint8_t ret)
 It sets the total of retries when a packet is not correctly received.
uint8_t getMaxCurrent ()
 It gets the maximum current supply by the module.
int8_t setMaxCurrent (uint8_t rate)
 It sets the maximum current supply by the module.
uint8_t getRegs ()
 It gets the content of the main configuration registers.
uint8_t truncPayload (uint16_t length16)
 It sets the maximum number of bytes from a frame that fit in a packet structure.
uint8_t setACK ()
 It writes an ACK in FIFO to send it.
uint8_t receive ()
 It puts the module in reception mode.
uint8_t receivePacketMAXTimeout ()
 It receives a packet before MAX_TIMEOUT.
uint8_t receivePacketTimeout ()
 It receives a packet before a timeout.
uint8_t receivePacketTimeout (uint16_t wait)
 It receives a packet before a timeout.
uint8_t receivePacketMAXTimeoutACK ()
 It receives a packet before MAX_TIMEOUT and reply with an ACK.
uint8_t receivePacketTimeoutACK ()
 It receives a packet before a timeout and reply with an ACK.
uint8_t receivePacketTimeoutACK (uint16_t wait)
 It receives a packet before a timeout and reply with an ACK.
uint8_t receiveAll ()
 It puts the module in 'promiscuous' reception mode.
uint8_t receiveAll (uint16_t wait)
 It puts the module in 'promiscuous' reception mode with a timeout.
boolean availableData ()
 It checks if there is an available packet and its destination.
boolean availableData (uint16_t wait)
 It checks if there is an available packet and its destination before a timeout.
uint8_t setPacket (uint8_t dest, char *payload)
 It writes a packet in FIFO in order to send it.
uint8_t setPacket (uint8_t dest, uint8_t *payload)
 It writes a packet in FIFO in order to send it.
uint8_t getPacketMAXTimeout ()
 It reads a received packet from the FIFO, if it arrives before ending MAX_TIMEOUT time.
int8_t getPacket ()
 It reads a received packet from the FIFO, if it arrives before ending '_sendTime' time.
int8_t getPacket (uint16_t wait)
 It receives and gets a packet from FIFO, if it arrives before ending 'wait' time.
uint8_t sendWithMAXTimeout ()
 It sends the packet stored in FIFO before ending MAX_TIMEOUT.
uint8_t sendWithTimeout ()
 It sends the packet stored in FIFO before ending _sendTime time.
uint8_t sendWithTimeout (uint16_t wait)
 It tries to send the packet stored in FIFO before ending 'wait' time.
uint8_t sendPacketMAXTimeout (uint8_t dest, char *payload)
 It tries to send the packet wich payload is a parameter before ending MAX_TIMEOUT.
uint8_t sendPacketMAXTimeout (uint8_t dest, uint8_t *payload, uint16_t length)
 It tries to send the packet wich payload is a parameter before ending MAX_TIMEOUT.
uint8_t sendPacketTimeout (uint8_t dest, char *payload)
 It sends the packet wich payload is a parameter before ending MAX_TIMEOUT.
uint8_t sendPacketTimeout (uint8_t dest, uint8_t *payload, uint16_t length)
 It sends the packet wich payload is a parameter before ending MAX_TIMEOUT.
uint8_t sendPacketTimeout (uint8_t dest, char *payload, uint16_t wait)
 It sends the packet wich payload is a parameter before ending 'wait' time.
uint8_t sendPacketTimeout (uint8_t dest, uint8_t *payload, uint16_t length, uint16_t wait)
 It sends the packet wich payload is a parameter before ending 'wait' time.
uint8_t sendPacketMAXTimeoutACK (uint8_t dest, char *payload)
 It sends the packet wich payload is a parameter before MAX_TIMEOUT, and replies with ACK.
uint8_t sendPacketMAXTimeoutACK (uint8_t dest, uint8_t *payload, uint16_t length)
 It sends the packet wich payload is a parameter before MAX_TIMEOUT, and replies with ACK.
uint8_t sendPacketTimeoutACK (uint8_t dest, char *payload)
 It sends the packet wich payload is a parameter before a timeout, and replies with ACK.
uint8_t sendPacketTimeoutACK (uint8_t dest, uint8_t *payload, uint16_t length)
 It sends the packet wich payload is a parameter before a timeout, and replies with ACK.
uint8_t sendPacketTimeoutACK (uint8_t dest, char *payload, uint16_t wait)
 It sends the packet wich payload is a parameter before 'wait' time, and replies with ACK.
uint8_t sendPacketTimeoutACK (uint8_t dest, uint8_t *payload, uint16_t length, uint16_t wait)
 It sends the packet wich payload is a parameter before 'wait' time, and replies with ACK.
int8_t setDestination (uint8_t dest)
 It sets the destination of a packet.
uint8_t setTimeout ()
 It sets the waiting time to send a packet.
uint8_t setPayload (char *payload)
 It sets the payload of the packet that is going to be sent.
uint8_t setPayload (uint8_t *payload)
 It sets the payload of the packet that is going to be sent.
uint8_t getACK ()
 If an ACK is received, it gets it and checks its content.
uint8_t getACK (uint16_t wait)
 It receives and gets an ACK from FIFO, if it arrives before ending 'wait' time.
uint8_t sendPacketMAXTimeoutACKRetries (uint8_t dest, char *payload)
 It sends a packet, waits to receive an ACK and updates the _retries value, before ending MAX_TIMEOUT time.
uint8_t sendPacketMAXTimeoutACKRetries (uint8_t dest, uint8_t *payload, uint16_t length)
 It sends a packet, waits to receive an ACK and updates the _retries value, before ending MAX_TIMEOUT time.
uint8_t sendPacketTimeoutACKRetries (uint8_t dest, char *payload)
 It sends a packet, waits to receive an ACK and updates the _retries value.
uint8_t sendPacketTimeoutACKRetries (uint8_t dest, uint8_t *payload, uint16_t length)
 It sends a packet, waits to receive an ACK and updates the _retries value.
uint8_t sendPacketTimeoutACKRetries (uint8_t dest, char *payload, uint16_t wait)
 It sends a packet, waits to receive an ACK and updates the _retries value, before ending 'wait' time.
uint8_t sendPacketTimeoutACKRetries (uint8_t dest, uint8_t *payload, uint16_t length, uint16_t wait)
 It sends a packet, waits to receive an ACK and updates the _retries value, before ending 'wait' time.
uint8_t getTemp ()
 It gets the internal temperature of the module.
void RxChainCalibration ()

Data Fields

uint8_t _bandwidth
 Variables /////////////////////////////////////////////////////////////.
uint8_t _codingRate
 Variable : coding rate configured in LoRa mode.
uint8_t _spreadingFactor
 Variable : spreading factor configured in LoRa mode.
uint32_t _channel
 Variable : frequency channel.
uint8_t _power
 Variable : output power.
int8_t _SNR
 Variable : SNR from the last packet received in LoRa mode.
int8_t _RSSI
 Variable : RSSI current value.
int16_t _RSSIpacket
 Variable : RSSI from the last packet received in LoRa mode.
uint16_t _preamblelength
 Variable : preamble length sent/received.
uint16_t _payloadlength
 Variable : payload length sent/received.
uint8_t _nodeAddress
 Variable : node address.
uint8_t _header
 Variable : implicit or explicit header in LoRa mode.
uint8_t _hreceived
 Variable : header received while waiting a packet to arrive.
uint8_t _CRC
 Variable : presence or absence of CRC calculation.
uint8_t _destination
 Variable : packet destination.
uint8_t _packetNumber
 Variable : packet number.
uint8_t _reception
 Variable : indicates if received packet is correct or incorrect.
uint8_t _retries
 Variable : number of current retry.
uint8_t _maxRetries
 Variable : maximum number of retries.
uint8_t _maxCurrent
 Variable : maximum current supply.
uint8_t _modem
 Variable : indicates FSK or LoRa 'modem'.
pack packet_sent
 Variable : array with all the information about a sent packet.
pack packet_received
 Variable : array with all the information about a received packet.
pack ACK
 Variable : array with all the information about a sent/received ack.
int _temp
 Variable : temperature module.
uint16_t _sendTime
 Variable : current timeout to send a packet.

Detailed Description

SX1272 Class.

SX1272 Class defines all the variables and functions used to manage SX1272 modules.

Definition at line 433 of file SX1272.h.


Constructor & Destructor Documentation

SX1272 (  )

class constructor

It does nothing

Parameters:
void
Returns:
void

Definition at line 123 of file SX1272.cpp.


Member Function Documentation

boolean availableData (  )

It checks if there is an available packet and its destination.

Returns:
'true' on success, 'false' otherwise

Definition at line 4346 of file SX1272.cpp.

boolean availableData ( uint16_t  wait )

It checks if there is an available packet and its destination before a timeout.

Parameters:
uint16_twait : time to wait while there is no a valid header received.
Returns:
'true' on success, 'false' otherwise

Definition at line 4358 of file SX1272.cpp.

void clearFlags (  )

It clears the interruption flags.

Parameters:
void
Returns:
void

Definition at line 560 of file SX1272.cpp.

uint8_t getACK (  )

If an ACK is received, it gets it and checks its content.

Returns:
'0' on success, '1' otherwise

Definition at line 6133 of file SX1272.cpp.

uint8_t getACK ( uint16_t  wait )

It receives and gets an ACK from FIFO, if it arrives before ending 'wait' time.

Parameters:
uint16_twait : time to wait while there is no an ACK received.
Returns:
'0' on success, '1' otherwise

Definition at line 6147 of file SX1272.cpp.

int8_t getBW (  )

It gets the BW configured.

It stores in global '_bandwidth' variable the BW selected in the configuration

Returns:
'0' on success, '1' otherwise

Definition at line 2085 of file SX1272.cpp.

uint8_t getChannel (  )

It gets frequency channel the module is using.

It stores in global '_channel' variable the frequency channel

Returns:
'0' on success, '1' otherwise

Definition at line 2645 of file SX1272.cpp.

int8_t getCR (  )

It gets the CR configured.

It stores in global '_codingRate' variable the CR selected in the configuration

Returns:
'0' on success, '1' otherwise

Definition at line 2388 of file SX1272.cpp.

uint8_t getCRC (  )

It gets the CRC configured.

It stores in global '_CRC' variable '1' enabling CRC generation on payload, or '0' disabling the CRC.

Returns:
'0' on success, '1' otherwise

Definition at line 1448 of file SX1272.cpp.

uint8_t getHeader (  )

It gets the header mode configured.

It stores in global '_header' variable '0' when header is sent (explicit header mode) or '1' when is not sent (implicit header mode).

Returns:
'0' on success, '1' otherwise

Definition at line 1236 of file SX1272.cpp.

uint8_t getMaxCurrent (  )

It gets the maximum current supply by the module.

Returns:
'0' on success, '1' otherwise

Definition at line 3613 of file SX1272.cpp.

uint8_t getMode (  )

It gets the BW, SF and CR of the module.

It stores in global '_bandwidth' variable the BW It stores in global '_codingRate' variable the CR It stores in global '_spreadingFactor' variable the SF

Returns:
'0' on success, '1' otherwise

Definition at line 716 of file SX1272.cpp.

uint8_t getNodeAddress (  )

It gets the node address of the mote.

It stores in global '_nodeAddress' variable the node address

Returns:
'0' on success, '1' otherwise

Definition at line 3270 of file SX1272.cpp.

int8_t getPacket (  )

It reads a received packet from the FIFO, if it arrives before ending '_sendTime' time.

Returns:
'0' on success, '1' otherwise

Definition at line 4554 of file SX1272.cpp.

int8_t getPacket ( uint16_t  wait )

It receives and gets a packet from FIFO, if it arrives before ending 'wait' time.

Parameters:
uint16_twait : time to wait while there is no a complete packet received.
Returns:
'0' on success, '1' otherwise

Definition at line 4572 of file SX1272.cpp.

uint8_t getPacketMAXTimeout (  )

It reads a received packet from the FIFO, if it arrives before ending MAX_TIMEOUT time.

Returns:
'0' on success, '1' otherwise

Definition at line 4542 of file SX1272.cpp.

uint8_t getPayloadLength (  )

It gets the payload length of the last packet to send/receive.

It stores in global '_payloadlength' variable the payload length of the last packet to send/receive.

Returns:
'0' on success, '1' otherwise

Definition at line 3145 of file SX1272.cpp.

uint8_t getPower (  )

It gets the output power of the signal.

It stores in global '_power' variable the output power of the signal

Returns:
'0' on success, '1' otherwise

Definition at line 2787 of file SX1272.cpp.

uint8_t getPreambleLength (  )

It gets the preamble length configured.

It stores in global '_preamblelength' variable the preamble length

Returns:
'0' on success, '1' otherwise

Definition at line 3037 of file SX1272.cpp.

uint8_t getRegs (  )

It gets the content of the main configuration registers.

It stores in global '_bandwidth' variable the BW. It stores in global '_codingRate' variable the CR. It stores in global '_spreadingFactor' variable the SF. It stores in global '_power' variable the output power of the signal. It stores in global '_channel' variable the frequency channel. It stores in global '_CRC' variable '1' enabling CRC generation on payload, or '0' disabling the CRC. It stores in global '_header' variable '0' when header is sent (explicit header mode) or '1' when is not sent (implicit header mode). It stores in global '_preamblelength' variable the preamble length. It stores in global '_payloadlength' variable the payload length of the last packet to send/receive. It stores in global '_nodeAddress' variable the node address. It stores in global '_temp' variable the module temperature.

Returns:
'0' on success, '1' otherwise

Definition at line 3712 of file SX1272.cpp.

uint8_t getRSSI (  )

It gets the current value of RSSI.

It stores in global '_RSSI' variable the current value of RSSI

Returns:
'0' on success, '1' otherwise

LoRa mode

FSK mode

Definition at line 3440 of file SX1272.cpp.

int16_t getRSSIpacket (  )

It gets the RSSI of the latest received packet.

It stores in global '_RSSIpacket' variable the RSSI of the latest packet received.

Returns:
'0' on success, '1' otherwise

Definition at line 3506 of file SX1272.cpp.

int8_t getSF (  )

It gets the SF configured.

It stores in global '_spreadingFactor' variable the current value of SF

Returns:
'0' on success, '1' otherwise

Definition at line 1740 of file SX1272.cpp.

int8_t getSNR (  )

It gets the SNR of the latest received packet.

It stores in global '_SNR' variable the SNR

Returns:
'0' on success, '1' otherwise

Definition at line 3387 of file SX1272.cpp.

uint8_t getTemp (  )

It gets the internal temperature of the module.

It stores in global '_temp' variable the module temperature.

Returns:
'0' on success, '1' otherwise

Definition at line 6471 of file SX1272.cpp.

boolean isBW ( uint16_t  band )

It is true if the BW selected exists.

Parameters:
uint16_tband : bandwidth value to check.
Returns:
'true' on success, 'false' otherwise

Definition at line 2028 of file SX1272.cpp.

boolean isChannel ( uint32_t  ch )

It is true if the channel selected exists.

Parameters:
uint32_tch : frequency channel value to check.
Returns:
'true' on success, 'false' otherwise

Definition at line 2578 of file SX1272.cpp.

boolean isCR ( uint8_t  cod )

It is true if the CR selected exists.

Parameters:
uint8_tcod : the coding rate value to check.
Returns:
'true' on success, 'false' otherwise

Definition at line 2354 of file SX1272.cpp.

boolean isSF ( uint8_t  spr )

It is true if the SF selected exists.

Parameters:
uint8_tspr : spreading factor value to check.
Returns:
'true' on success, 'false' otherwise

Definition at line 1703 of file SX1272.cpp.

void OFF (  )

It puts the module OFF.

Parameters:
void
Returns:
void

Definition at line 471 of file SX1272.cpp.

uint8_t ON (  )

It puts the module ON.

Parameters:
void
Returns:
uint8_t setLORA state

Definition at line 214 of file SX1272.cpp.

byte readRegister ( byte  address )

It reads an internal module register.

Parameters:
byteaddress : address register to read from.
Returns:
the content of the register.

Definition at line 497 of file SX1272.cpp.

uint8_t receive (  )

It puts the module in reception mode.

Returns:
'0' on success, '1' otherwise

Definition at line 3971 of file SX1272.cpp.

uint8_t receiveAll (  )

It puts the module in 'promiscuous' reception mode.

Returns:
'0' on success, '1' otherwise

Definition at line 4300 of file SX1272.cpp.

uint8_t receiveAll ( uint16_t  wait )

It puts the module in 'promiscuous' reception mode with a timeout.

Parameters:
uint16_twait : time to wait to receive something.
Returns:
'0' on success, '1' otherwise

Definition at line 4312 of file SX1272.cpp.

uint8_t receivePacketMAXTimeout (  )

It receives a packet before MAX_TIMEOUT.

Returns:
'0' on success, '1' otherwise

Definition at line 4041 of file SX1272.cpp.

uint8_t receivePacketMAXTimeoutACK (  )

It receives a packet before MAX_TIMEOUT and reply with an ACK.

Returns:
'0' on success, '1' otherwise

Definition at line 4192 of file SX1272.cpp.

uint8_t receivePacketTimeout (  )

It receives a packet before a timeout.

Returns:
'0' on success, '1' otherwise

Definition at line 4053 of file SX1272.cpp.

uint8_t receivePacketTimeout ( uint16_t  wait )

It receives a packet before a timeout.

Parameters:
uint16_twait : time to wait to receive something.
Returns:
'0' on success, '1' otherwise

Definition at line 4072 of file SX1272.cpp.

uint8_t receivePacketTimeoutACK (  )

It receives a packet before a timeout and reply with an ACK.

Returns:
'0' on success, '1' otherwise

Definition at line 4204 of file SX1272.cpp.

uint8_t receivePacketTimeoutACK ( uint16_t  wait )

It receives a packet before a timeout and reply with an ACK.

Parameters:
uint16_twait : time to wait to receive something.
Returns:
'0' on success, '1' otherwise

Definition at line 4219 of file SX1272.cpp.

void RxChainCalibration (  )

Performs the Rx chain calibration for LF and HF bands

Remarks:
Must be called just after the reset so all registers are at their default values

Definition at line 181 of file SX1272.cpp.

uint8_t sendPacketMAXTimeout ( uint8_t  dest,
char *  payload 
)

It tries to send the packet wich payload is a parameter before ending MAX_TIMEOUT.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5737 of file SX1272.cpp.

uint8_t sendPacketMAXTimeout ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length 
)

It tries to send the packet wich payload is a parameter before ending MAX_TIMEOUT.

Parameters:
uint8_tdest : packet destination.
uint8_t*payload : packet payload.
uint16_tlength : payload buffer length.
Returns:
'0' on success, '1' otherwise

Definition at line 5749 of file SX1272.cpp.

uint8_t sendPacketMAXTimeoutACK ( uint8_t  dest,
char *  payload 
)

It sends the packet wich payload is a parameter before MAX_TIMEOUT, and replies with ACK.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5878 of file SX1272.cpp.

uint8_t sendPacketMAXTimeoutACK ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length 
)

It sends the packet wich payload is a parameter before MAX_TIMEOUT, and replies with ACK.

Parameters:
uint8_tdest : packet destination.
uint8_tpayload: packet payload.
uint16_tlength : payload buffer length.
Returns:
'0' on success, '1' otherwise

Definition at line 5890 of file SX1272.cpp.

uint8_t sendPacketMAXTimeoutACKRetries ( uint8_t  dest,
char *  payload 
)

It sends a packet, waits to receive an ACK and updates the _retries value, before ending MAX_TIMEOUT time.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 6334 of file SX1272.cpp.

uint8_t sendPacketMAXTimeoutACKRetries ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length 
)

It sends a packet, waits to receive an ACK and updates the _retries value, before ending MAX_TIMEOUT time.

Parameters:
uint8_tdest : packet destination.
uint8_t*payload : packet payload.
uint16_tlength : payload buffer length.
Returns:
'0' on success, '1' otherwise

Definition at line 6346 of file SX1272.cpp.

uint8_t sendPacketTimeout ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length,
uint16_t  wait 
)

It sends the packet wich payload is a parameter before ending 'wait' time.

Parameters:
uint8_tdest : packet destination.
uint8_t*payload : packet payload.
uint16_tlength : payload buffer length.
uint16_twait : time to wait.
Returns:
'0' on success, '1' otherwise

Definition at line 5845 of file SX1272.cpp.

uint8_t sendPacketTimeout ( uint8_t  dest,
char *  payload 
)

It sends the packet wich payload is a parameter before ending MAX_TIMEOUT.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5761 of file SX1272.cpp.

uint8_t sendPacketTimeout ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length 
)

It sends the packet wich payload is a parameter before ending MAX_TIMEOUT.

Parameters:
uint8_tdest : packet destination.
uint8_t*payload: packet payload.
uint16_tlength : payload buffer length.
Returns:
'0' on success, '1' otherwise

Definition at line 5788 of file SX1272.cpp.

uint8_t sendPacketTimeout ( uint8_t  dest,
char *  payload,
uint16_t  wait 
)

It sends the packet wich payload is a parameter before ending 'wait' time.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
uint16_twait : time to wait.
Returns:
'0' on success, '1' otherwise

Definition at line 5821 of file SX1272.cpp.

uint8_t sendPacketTimeoutACK ( uint8_t  dest,
char *  payload 
)

It sends the packet wich payload is a parameter before a timeout, and replies with ACK.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5903 of file SX1272.cpp.

uint8_t sendPacketTimeoutACK ( uint8_t  dest,
char *  payload,
uint16_t  wait 
)

It sends the packet wich payload is a parameter before 'wait' time, and replies with ACK.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
uint16_twait : time to wait to send the packet.
Returns:
'0' on success, '1' otherwise

Definition at line 6021 of file SX1272.cpp.

uint8_t sendPacketTimeoutACK ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length,
uint16_t  wait 
)

It sends the packet wich payload is a parameter before 'wait' time, and replies with ACK.

Parameters:
uint8_tdest : packet destination.
uint8_tpayload: packet payload.
uint16_tlength : payload buffer length.
uint16_twait : time to wait to send the packet.
Returns:
'0' on success, '1' otherwise

Definition at line 6079 of file SX1272.cpp.

uint8_t sendPacketTimeoutACK ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length 
)

It sends the packet wich payload is a parameter before a timeout, and replies with ACK.

Parameters:
uint8_tdest : packet destination.
uint8_tpayload: packet payload.
uint16_tlength : payload buffer length.
Returns:
'0' on success, '1' otherwise

Definition at line 5961 of file SX1272.cpp.

uint8_t sendPacketTimeoutACKRetries ( uint8_t  dest,
char *  payload 
)

It sends a packet, waits to receive an ACK and updates the _retries value.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 6358 of file SX1272.cpp.

uint8_t sendPacketTimeoutACKRetries ( uint8_t  dest,
char *  payload,
uint16_t  wait 
)

It sends a packet, waits to receive an ACK and updates the _retries value, before ending 'wait' time.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
uint16_twait : time to wait while trying to send the packet.
Returns:
'0' on success, '1' otherwise

Definition at line 6415 of file SX1272.cpp.

uint8_t sendPacketTimeoutACKRetries ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length,
uint16_t  wait 
)

It sends a packet, waits to receive an ACK and updates the _retries value, before ending 'wait' time.

Parameters:
uint8_tdest : packet destination.
uint8_t*payload : packet payload.
uint16_tlength : payload buffer length.
uint16_twait : time to wait while trying to send the packet.
Returns:
'0' on success, '1' otherwise

Definition at line 6443 of file SX1272.cpp.

uint8_t sendPacketTimeoutACKRetries ( uint8_t  dest,
uint8_t *  payload,
uint16_t  length 
)

It sends a packet, waits to receive an ACK and updates the _retries value.

Parameters:
uint8_tdest : packet destination.
uint8_t*payload : packet payload.
uint16_tlength : payload buffer length.
Returns:
'0' on success, '1' otherwise

Definition at line 6386 of file SX1272.cpp.

uint8_t sendWithMAXTimeout (  )

It sends the packet stored in FIFO before ending MAX_TIMEOUT.

Returns:
'0' on success, '1' otherwise

Definition at line 5608 of file SX1272.cpp.

uint8_t sendWithTimeout ( uint16_t  wait )

It tries to send the packet stored in FIFO before ending 'wait' time.

Parameters:
uint16_twait : time to wait to send the packet.
Returns:
'0' on success, '1' otherwise

Definition at line 5633 of file SX1272.cpp.

uint8_t sendWithTimeout (  )

It sends the packet stored in FIFO before ending _sendTime time.

Returns:
'0' on success, '1' otherwise

Definition at line 5620 of file SX1272.cpp.

uint8_t setACK (  )

It writes an ACK in FIFO to send it.

Returns:
'0' on success, '1' otherwise

Definition at line 3872 of file SX1272.cpp.

int8_t setBW ( uint16_t  band )

It sets the BW.

It stores in global '_bandwidth' variable the BW selected in the configuration

Parameters:
uint16_tband : bandwidth value to set in the configuration.
Returns:
'0' on success, '1' otherwise

Definition at line 2148 of file SX1272.cpp.

int8_t setChannel ( uint32_t  ch )

It sets frequency channel the module is using.

It stores in global '_channel' variable the frequency channel

Parameters:
uint32_tch : frequency channel value to set in the configuration.
Returns:
'0' on success, '1' otherwise

Definition at line 2691 of file SX1272.cpp.

int8_t setCR ( uint8_t  cod )

It sets the CR.

It stores in global '_codingRate' variable the CR selected in the configuration

Parameters:
uint8_tcod : coding rate value to set in the configuration.
Returns:
'0' on success, '1' otherwise

Definition at line 2447 of file SX1272.cpp.

uint8_t setCRC_OFF (  )

It sets CRC off.

It stores in global '_CRC' variable '0' when success

Returns:
'0' on success, '1' otherwise

Definition at line 1623 of file SX1272.cpp.

uint8_t setCRC_ON (  )

It sets CRC on.

It stores in global '_CRC' variable '1' when success

Returns:
'0' on success, '1' otherwise

Definition at line 1537 of file SX1272.cpp.

int8_t setDestination ( uint8_t  dest )

It sets the destination of a packet.

Parameters:
uint8_tdest : value to set as destination address.
Returns:
'0' on success, '1' otherwise

Definition at line 4819 of file SX1272.cpp.

uint8_t setFSK (  )

It sets the FSK mode on.

It stores in global '_FSK' variable '1' when success

Returns:
'0' on success, '1' otherwise

Definition at line 660 of file SX1272.cpp.

int8_t setHeaderOFF (  )

It sets implicit header mode.

It stores in global '_header' variable '0' when success

Returns:
'0' on success, '1' otherwise

Definition at line 1379 of file SX1272.cpp.

int8_t setHeaderON (  )

It sets explicit header mode.

It stores in global '_header' variable '1' when success

Returns:
'0' on success, '1' otherwise

Definition at line 1300 of file SX1272.cpp.

uint8_t setLORA (  )

It sets the LoRa mode on.

It stores in global '_LORA' variable '1' when success

Returns:
'0' on success, '1' otherwise

Definition at line 594 of file SX1272.cpp.

int8_t setMaxCurrent ( uint8_t  rate )

It sets the maximum current supply by the module.

It stores in global '_maxCurrent' variable the maximum current supply.

Parameters:
uint8_trate : maximum current supply.
Returns:
'0' on success, '1' otherwise

Definition at line 3663 of file SX1272.cpp.

int8_t setMode ( uint8_t  mode )

It sets the BW, SF and CR of the module.

It stores in global '_bandwidth' variable the BW It stores in global '_codingRate' variable the CR It stores in global '_spreadingFactor' variable the SF

Parameters:
uint8_tmode : there is a mode number to different values of the configured parameters with this function.
Returns:
'0' on success, '1' otherwise

Definition at line 792 of file SX1272.cpp.

int8_t setNodeAddress ( uint8_t  addr )

It sets the node address of the mote.

It stores in global '_nodeAddress' variable the node address

Parameters:
uint8_taddr : address value to set as node address.
Returns:
'0' on success, '1' otherwise

Definition at line 3316 of file SX1272.cpp.

uint8_t setPacket ( uint8_t  dest,
uint8_t *  payload 
)

It writes a packet in FIFO in order to send it.

Parameters:
uint8_tdest : packet destination.
uint8_t*payload: packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5448 of file SX1272.cpp.

uint8_t setPacket ( uint8_t  dest,
char *  payload 
)

It writes a packet in FIFO in order to send it.

Parameters:
uint8_tdest : packet destination.
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5295 of file SX1272.cpp.

int8_t setPacketLength ( uint8_t  l )

It sets the packet length to send/receive.

It stores in global '_payloadlength' variable the payload length of the last packet to send/receive.

Parameters:
uint8_tl : payload length to set in the configuration.
Returns:
'0' on success, '1' otherwise

Definition at line 3211 of file SX1272.cpp.

int8_t setPacketLength (  )

It sets the packet length to send/receive.

It stores in global '_payloadlength' variable the payload length of the last packet to send/receive.

Returns:
'0' on success, '1' otherwise

Definition at line 3186 of file SX1272.cpp.

uint8_t setPayload ( char *  payload )

It sets the payload of the packet that is going to be sent.

Parameters:
char*payload : packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5213 of file SX1272.cpp.

uint8_t setPayload ( uint8_t *  payload )

It sets the payload of the packet that is going to be sent.

Parameters:
uint8_tpayload: packet payload.
Returns:
'0' on success, '1' otherwise

Definition at line 5260 of file SX1272.cpp.

int8_t setPower ( char  p )

It sets the output power of the signal.

It stores in global '_power' variable the output power of the signal

Parameters:
charp : 'M', 'H' or 'L' if you want Maximum, High or Low output power signal.
Returns:
'0' on success, '1' otherwise

Definition at line 2828 of file SX1272.cpp.

int8_t setPowerNum ( uint8_t  pow )

It sets the output power of the signal.

It stores in global '_power' variable the output power of the signal

Parameters:
uint8_tpow : value to set as output power.
Returns:
'0' on success, '1' otherwise

Definition at line 2964 of file SX1272.cpp.

uint8_t setPreambleLength ( uint16_t  l )

It sets the preamble length.

It stores in global '_preamblelength' variable the preamble length

Parameters:
uint16_tl : preamble length to set in the configuration.
Returns:
'0' on success, '1' otherwise

Definition at line 3091 of file SX1272.cpp.

uint8_t setRetries ( uint8_t  ret )

It sets the total of retries when a packet is not correctly received.

It stores in global '_maxRetries' variable the number of retries.

Parameters:
uint8_tret : number of retries.
Returns:
'0' on success, '1' otherwise

Definition at line 3570 of file SX1272.cpp.

uint8_t setSF ( uint8_t  spr )

It sets the SF.

It stores in global '_spreadingFactor' variable the current value of SF

Parameters:
uint8_tspr : spreading factor value to set in the configuration.
Returns:
'0' on success, '1' otherwise

Definition at line 1788 of file SX1272.cpp.

uint8_t setTimeout (  )

It sets the waiting time to send a packet.

It stores in global '_sendTime' variable the time for each mode.

Returns:
'0' on success, '1' otherwise

Definition at line 4858 of file SX1272.cpp.

uint8_t truncPayload ( uint16_t  length16 )

It sets the maximum number of bytes from a frame that fit in a packet structure.

It stores in global '_payloadlength' variable the maximum number of bytes.

Parameters:
uint16_tlength16 : total frame length.
Returns:
'0' on success, '1' otherwise

Definition at line 3840 of file SX1272.cpp.

void writeRegister ( byte  address,
byte  data 
)

It writes in an internal module register.

Parameters:
byteaddress : address register to write in.
bytedata : value to write in the register.

Definition at line 530 of file SX1272.cpp.


Field Documentation

uint8_t _bandwidth

Variables /////////////////////////////////////////////////////////////.

Variable : bandwidth configured in LoRa mode. bandwidth = 00 --> BW = 125KHz bandwidth = 01 --> BW = 250KHz bandwidth = 10 --> BW = 500KHz

Definition at line 1212 of file SX1272.h.

uint32_t _channel

Variable : frequency channel.

channel = 0xD84CCC --> CH = 10_868, 865.20MHz channel = 0xD86000 --> CH = 11_868, 865.50MHz channel = 0xD87333 --> CH = 12_868, 865.80MHz channel = 0xD88666 --> CH = 13_868, 866.10MHz channel = 0xD89999 --> CH = 14_868, 866.40MHz channel = 0xD8ACCC --> CH = 15_868, 866.70MHz channel = 0xD8C000 --> CH = 16_868, 867.00MHz channel = 0xE1C51E --> CH = 00_900, 903.08MHz channel = 0xE24F5C --> CH = 01_900, 905.24MHz channel = 0xE2D999 --> CH = 02_900, 907.40MHz channel = 0xE363D7 --> CH = 03_900, 909.56MHz channel = 0xE3EE14 --> CH = 04_900, 911.72MHz channel = 0xE47851 --> CH = 05_900, 913.88MHz channel = 0xE5028F --> CH = 06_900, 916.04MHz channel = 0xE58CCC --> CH = 07_900, 918.20MHz channel = 0xE6170A --> CH = 08_900, 920.36MHz channel = 0xE6A147 --> CH = 09_900, 922.52MHz channel = 0xE72B85 --> CH = 10_900, 924.68MHz channel = 0xE7B5C2 --> CH = 11_900, 926.84MHz

Definition at line 1257 of file SX1272.h.

uint8_t _codingRate

Variable : coding rate configured in LoRa mode.

codingRate = 001 --> CR = 4/5 codingRate = 010 --> CR = 4/6 codingRate = 011 --> CR = 4/7 codingRate = 100 --> CR = 4/8

Definition at line 1221 of file SX1272.h.

uint8_t _CRC

Variable : presence or absence of CRC calculation.

Definition at line 1317 of file SX1272.h.

uint8_t _destination

Variable : packet destination.

Definition at line 1323 of file SX1272.h.

uint8_t _header

Variable : implicit or explicit header in LoRa mode.

Definition at line 1305 of file SX1272.h.

uint8_t _hreceived

Variable : header received while waiting a packet to arrive.

Definition at line 1311 of file SX1272.h.

uint8_t _maxCurrent

Variable : maximum current supply.

Definition at line 1353 of file SX1272.h.

uint8_t _maxRetries

Variable : maximum number of retries.

Definition at line 1347 of file SX1272.h.

uint8_t _modem

Variable : indicates FSK or LoRa 'modem'.

Definition at line 1359 of file SX1272.h.

uint8_t _nodeAddress

Variable : node address.

Definition at line 1299 of file SX1272.h.

uint8_t _packetNumber

Variable : packet number.

Definition at line 1329 of file SX1272.h.

uint16_t _payloadlength

Variable : payload length sent/received.

Definition at line 1293 of file SX1272.h.

uint8_t _power

Variable : output power.

Definition at line 1263 of file SX1272.h.

uint16_t _preamblelength

Variable : preamble length sent/received.

Definition at line 1287 of file SX1272.h.

uint8_t _reception

Variable : indicates if received packet is correct or incorrect.

Definition at line 1335 of file SX1272.h.

uint8_t _retries

Variable : number of current retry.

Definition at line 1341 of file SX1272.h.

int8_t _RSSI

Variable : RSSI current value.

Definition at line 1275 of file SX1272.h.

int16_t _RSSIpacket

Variable : RSSI from the last packet received in LoRa mode.

Definition at line 1281 of file SX1272.h.

uint16_t _sendTime

Variable : current timeout to send a packet.

Definition at line 1389 of file SX1272.h.

int8_t _SNR

Variable : SNR from the last packet received in LoRa mode.

Definition at line 1269 of file SX1272.h.

Variable : spreading factor configured in LoRa mode.

spreadingFactor = 6 --> SF = 6, 64 chips/symbol spreadingFactor = 7 --> SF = 7, 128 chips/symbol spreadingFactor = 8 --> SF = 8, 256 chips/symbol spreadingFactor = 9 --> SF = 9, 512 chips/symbol spreadingFactor = 10 --> SF = 10, 1024 chips/symbol spreadingFactor = 11 --> SF = 11, 2048 chips/symbol spreadingFactor = 12 --> SF = 12, 4096 chips/symbol

Definition at line 1233 of file SX1272.h.

int _temp

Variable : temperature module.

Definition at line 1383 of file SX1272.h.

Variable : array with all the information about a sent/received ack.

Definition at line 1377 of file SX1272.h.

Variable : array with all the information about a received packet.

Definition at line 1371 of file SX1272.h.

Variable : array with all the information about a sent packet.

Definition at line 1365 of file SX1272.h.