General considerations

Waspmote libraries

Waspmote SX1272 files

WaspSX1272.h, WaspSX1272.cpp

It is mandatory to include the SX1272 library when using this module. The following line must be introduced at the beginning of the code:

#include <WaspSX1272.h>

Constructor

To start using the Waspmote SX1272 library, an object from class WaspSX1272 must be created. This object, called sx1272, is created inside the Waspmote SX1272 library and it is public to all libraries. It is used through the guide to show how the Waspmote SX1272 library works.

When creating this object, some variables are defined with a value by default.

API functions

Through the guide there are many examples of using parameters. In these examples, API functions are called to execute the commands, storing in their related variables the parameter value in each case.

Example of use:

{
sx1272.getPreambleLength(); // Gets the preamble length that is going to be send
}

Related variables:

sx1272._preamblelength → stores the preamble length

When returning from sx1272.getPreambleLength() the variable sx1272._preamblelength will be filled with the appropriate values.

Before calling the function, the related variable is created but it is empty.

All the functions return a flag to know if the function called was successful or not. Available values for this flag:

  • 0 : Success. The function was executed without errors and the variable was filled.

  • 1 : Error. The function was executed but an error occurred while executing.

  • 2 : Not executed. An error occurred before executing the function.

  • -1 : Function not allowed in this mode.

The main functions are listed here:

Basic functions

Configuration functions

Link information functions

Sending functions

Receiving functions

Additional functions

Getting temperature

It reads the module temperature in Celsius. Negative temperatures can be expected. It stores the information in the global _temp variable in Celsius.

Note: this feature has not a good accuracy because it requires internal calibration. Libelium recommends to use dedicated temperature sensor.

Example of use:

{
sx1272.getTemp(); // Gets the temperature of the module
}

Related variables:

sx1272._temp → stores the temperature of the module

SX1272 getting temperature example:

Getting maximum allowed current supply

It reads the current supply limit of the power amplifier. This value is set to 240 mA at the beginning of the configuration when the module is switched on. Parameter range: from 0x00 to 0x1B corresponding to a range from 45 to 240 mA.

Example of use:

{
sx1272.getMaxCurrent(); // Gets the maximum current supply
}

Related variables:

sx1272._maxCurrent → stores the maximum current supply of the module

SX1272 getting current supply example:

Waspmote reboot

When Waspmote is rebooted, the application code will start again, creating all the variables and objects from the beginning.

Last updated