Initialization

Before starting to use a module, it needs to be initialized. During this process, Waspmote's SPI bus has to be opened to communicate with the module, and the LoRa module's switch has to be set on.

This module does not save the configuration. So, the network settings as the mode or the channel MUST be configured every time it is switched on.

Setting on

It initializes all the global variables, opens the SPI bus and switches the LoRa module on.

When setting on, the module always has the configuration by default shown in the next table:

Global variable

Description

Initial value

modem

activated mode

LORA

bandwidth

bandwidth to use in LoRa mode

BW_125

codingRate

coding rate to use in LoRa mode

CR_5

spreadingFactor

spreading factor to use in LoRa mode

SF_7

channel

transmission frequency channel

CH_12_900

header

specifies if header is enabled

HEADER_ON

CRC

specifies if CRC is enabled

CRC_OFF

power

power transmission level

15

Also, there are other global variables initialized when this function is called, shown in the following table:

Global variable

Description

Initial value

packetNumber

packet number to send

0

reception

specifies if packet is correctly received

CORRECT_PACKET

retries

number of the current retrying that is being executed in the protocol

0

maxRetries

maximum number of retries permitted in each case

3

Example of use:

{
sx1272.ON(); // Opens the SPI and switches the SX1272 module ON
}

Setting off

It closes the SPI and switches the SX1272 module off.

Example of use:

{
sx1272.OFF(); // Closes the SPI and switches the SX1272 module off
}