armapi  v1.0
bĂȘta
arm.h File Reference
#include <stdbool.h>
#include "armconfig.h"
#include "armconst.h"
#include "armport.h"

Go to the source code of this file.

Macros

#define ARM_FSK_BROADCAST   255
 Constant to define the broadcast value. More...
 
#define ARM_FSK_POWER_AUTO   (-127)
 Constant to define the auto power value. More...
 
#define ARM_LW_UNCONFIRMED(val)   ((-1)*(val))
 Macro to set unconfirmed frame. More...
 
#define ARM_LW_IS_UNCONFIRMED(val)   ((val)<=0)
 Macro to know if the frame is unconfirmed or not. More...
 

Typedefs

typedef enum armError_e armError_t
 Constant to define the errors. More...
 
typedef enum armBaudrate_e armBaudrate_t
 Constant to define the baudrate value. More...
 
typedef enum armFskWor_e armFskWor_t
 Constant to define the WOR mode 'Wake On Radio'. More...
 
typedef enum armLed_e armLed_t
 Constant to define the comportment of the LED. More...
 
typedef enum armFskLbtAfa_e armFskLbtAfa_t
 Constant to define the LBT&AFA mode 'Listen before talk' and 'Adaptive Frequency Agility'. More...
 
typedef enum armMode_e armMode_t
 Constant to define the working mode. More...
 
typedef enum armType_e armType_t
 Type of ARM. More...
 

Enumerations

enum  armError_e {
  ARM_ERR_NONE, ARM_ERR_NO_SUPPORTED, ARM_ERR_PORT_OPEN, ARM_ERR_PORT_CONFIG,
  ARM_ERR_PORT_READ, ARM_ERR_PORT_WRITE, ARM_ERR_PORT_WRITE_READ, ARM_ERR_PORT_CLOSE,
  ARM_ERR_PARAM_OUT_OF_RANGE, ARM_ERR_PARAM_INCOMPATIBLE, ARM_ERR_ADDRESSING_NOT_ENABLE, ARM_ERR_WOR_ENABLE,
  ARM_ERR_ARM_GO_AT, ARM_ERR_ARM_BACK_AT, ARM_ERR_ARM_CMD, ARM_ERR_ARM_GET_REG,
  ARM_ERR_ARM_SET_REG
}
 Constant to define the errors. More...
 
enum  armBaudrate_e {
  ARM_BAUDRATE_NONE = 0, ARM_BAUDRATE_1200 = 1200, ARM_BAUDRATE_2400 = 2400, ARM_BAUDRATE_4800 = 4800,
  ARM_BAUDRATE_9600 = 9600, ARM_BAUDRATE_19200 = 19200, ARM_BAUDRATE_38400 = 38400, ARM_BAUDRATE_57600 = 57600,
  ARM_BAUDRATE_115200 = 115200
}
 Constant to define the baudrate value. More...
 
enum  armFskWor_e { ARM_FSK_WOR_DISABLE, ARM_FSK_WOR_LP, ARM_FSK_WOR_CS, ARM_FSK_WOR_PQT }
 Constant to define the WOR mode 'Wake On Radio'. More...
 
enum  armLed_e { ARM_LED_OFF, ARM_LED_OFF_RF, ARM_LED_ON_RF }
 Constant to define the comportment of the LED. More...
 
enum  armFskLbtAfa_e { ARM_FSK_LBTAFA_DISABLE, ARM_FSK_LBTAFA_LBT, ARM_FSK_LBTAFA_AFA, ARM_FSK_LBTAFA_LBTAFA }
 Constant to define the LBT&AFA mode 'Listen before talk' and 'Adaptive Frequency Agility'. More...
 
enum  armMode_e { ARM_MODE_FSK, ARM_MODE_SFX, ARM_MODE_LORAWAN }
 Constant to define the working mode. More...
 
enum  armType_e { ARM_TYPE_NONE = 0x01, ARM_TYPE_N8_LP = 0x02, ARM_TYPE_N8_LD = 0x04, ARM_TYPE_N8_LW = 0x08 }
 Type of ARM. More...
 

Functions

armError_t armInit (arm_t *arm, void *port)
 Initialize the structure, port and ARM. More...
 
armError_t armDeInit (arm_t *arm)
 De-initialize the port. More...
 
armError_t armReboot (arm_t *arm)
 Reboot the ARM. More...
 
armError_t armInfo (arm_t *arm, armType_t *armType, uint8_t *rev, uint64_t *sn, uint16_t *rfFreq, uint8_t *rfPower)
 Get information about the ARM. More...
 
armError_t armSetMode (arm_t *arm, armMode_t mode)
 Set the mode. More...
 
armMode_t armGetMode (arm_t *arm)
 Get the mode. More...
 
armError_t armSfxEnableDownlink (arm_t *arm, bool enable)
 Enable/Disable the Sigfox downlink. More...
 
bool armSfxIsEnableDownlink (arm_t *arm)
 Get if the Sigfox downlink is enable. More...
 
int8_t armFskMaxPower (uint16_t radioChannel, armBaudrate_t radioBaud)
 Get The maximal possible power. More...
 
armError_t armFskSetRadio (arm_t *arm, uint16_t channel, armBaudrate_t baud, int8_t power)
 Setup the Fsk (local) radio configuration. More...
 
void armFskGetRadio (arm_t *arm, uint16_t *channel, armBaudrate_t *baud, int8_t *power)
 Get the fsk (local) radio configuration. More...
 
armError_t armFskSetRemoteAdd (arm_t *arm, uint8_t add)
 Set the radio remote address. More...
 
uint8_t armFskGetRemoteAdd (arm_t *arm)
 Get the remote address. More...
 
armError_t armFskSetLocalAdd (arm_t *arm, uint8_t add)
 Set the radio local address. More...
 
uint8_t armFskGetLocalAdd (arm_t *arm)
 Get the local address. More...
 
void armFskEnableAddressing (arm_t *arm, bool enable)
 Enable/Disable Addressing. More...
 
bool armFskIsEnableAddressing (arm_t *arm)
 Get enable Addressing. More...
 
void armFskEnableCrc (arm_t *arm, bool enable)
 Enable/Disable CRC. More...
 
bool armFskIsEnableCrc (arm_t *arm)
 Get enable CRC. More...
 
armError_t armFskEnableInfinityMode (arm_t *arm, bool enable)
 Enable/Disable Infinity mode. More...
 
bool armFskIsEnableInfinityMode (arm_t *arm)
 Get enable Infinity mode. More...
 
void armFskEnableWhitening (arm_t *arm, bool enable)
 Enable/Disable Whitening. More...
 
bool armFskIsEnableWhitening (arm_t *arm)
 Get enable Whitening. More...
 
armError_t armSetSerial (arm_t *arm, armPortBaudrate_t baud, armPortDatabits_t databits, armPortParity_t parity, armPortStopbit_t stopbit)
 Setup serial port configuration. More...
 
void armGetSerial (arm_t *arm, armPortBaudrate_t *baud, armPortDatabits_t *databits, armPortParity_t *parity, armPortStopbit_t *stopbit)
 Get the serial port configuration. More...
 
armError_t armFskSetWorMode (arm_t *arm, armFskWor_t mode, uint16_t periodTime, uint16_t postTime, int8_t rssiLevel, bool filterLongPreamble)
 Enable/Disable and configure the wake on radio mode. More...
 
void armFskGetWorMode (arm_t *arm, armFskWor_t *mode, uint16_t *periodTime, uint16_t *postTime, int8_t *rssiLevel, bool *filterLongPreamble)
 Get the wake on radio mode configuration. More...
 
armError_t armEnableWakeUpUart (arm_t *arm, bool enable)
 Enable/Disable the Wake Up Uart. More...
 
bool armIsEnableWakeUpUart (arm_t *arm)
 Get if Wake Up Uart is enable. More...
 
void armSleep (arm_t *arm, bool sleep)
 Enable/Disable sleep with pin. More...
 
armError_t armFskSetLbtAfaMode (arm_t *arm, armFskLbtAfa_t mode, int8_t rssiLevel, uint16_t nSamples, uint16_t channel2)
 Enable/Disable and configure the Lbt&Afa mode. More...
 
void armFskGetLbtAfaMode (arm_t *arm, armFskLbtAfa_t *mode, int8_t *rssiLevel, uint16_t *nSamples, uint16_t *channel2)
 Get the wake up on mode configuration. More...
 
armError_t armLwSetRadio (arm_t *arm, uint8_t txChannel, uint8_t power, uint8_t txSf, uint8_t rx2Sf, uint8_t rx2Channel)
 Setup the LoraWan radio configuration. More...
 
void armLwGetRadio (arm_t *arm, uint8_t *txChannel, uint8_t *power, uint8_t *txSf, uint8_t *rx2Sf, uint8_t *rx2Channel)
 Get the LoraWan radio configuration. More...
 
armError_t armLwSetConfirmedFrame (arm_t *arm, int8_t nbFrame)
 Enable/Disable and set the confirmed frame. More...
 
int8_t armLwGetConfirmedFrame (arm_t *arm)
 Get the setup of confirmed frame. More...
 
void armLwSetPortField (arm_t *arm, uint8_t port)
 Set the port field. More...
 
uint8_t armLwGetPortField (arm_t *arm)
 Get the port field. More...
 
void armLwEnableOtaa (arm_t *arm, bool enable)
 Enable/Disable Over The Air Activation. More...
 
bool armLwIsEnableOtaa (arm_t *arm)
 Get if Over The Air Activation is enable. More...
 
void armLwEnableRxWindows (arm_t *arm, bool enable)
 Enable/Disable Rx windows. More...
 
bool armLwIsEnableRxWindows (arm_t *arm)
 Get if Rx windows is enable. More...
 
void armLwEnableTxAdaptiveSpeed (arm_t *arm, bool enable)
 Enable/Disable Tx Adaptive Speed. More...
 
bool armLwIsEnableTxAdaptiveSpeed (arm_t *arm)
 Get if Tx Adaptive Speed is enable. More...
 
void armLwEnableDutyCycle (arm_t *arm, bool enable)
 Enable/Disable Duty Cycle. More...
 
bool armLwIsEnableDutyCycle (arm_t *arm)
 Get if Duty Cycle is enable. More...
 
void armLwEnableTxAdaptiveChannel (arm_t *arm, bool enable)
 Enable/Disable Tx Adaptive Channel. More...
 
bool armLwIsEnableTxAdaptiveChannel (arm_t *arm)
 Get if Tx Adaptive Channel is enable. More...
 
void armLwEnableRx2Adaptive (arm_t *arm, bool enable)
 Enable/Disable Rx2 windows Adaptive. More...
 
bool armLwIsEnableRx2Adaptive (arm_t *arm)
 Get if Rx2 windows Adaptive is enable. More...
 
armError_t armLwIds (arm_t *arm, uint32_t *devAddr, uint64_t *devEui, uint64_t *appEui, uint128_t *appKey, uint128_t *nwkSKey, uint128_t *appSKey)
 Get the IDs. More...
 
void armSetLed (arm_t *arm, armLed_t led)
 Set the LED behavior. More...
 
armLed_t armGetLed (arm_t *arm)
 Get the LED behavior. More...
 
armError_t armUpdateConfig (arm_t *arm)
 Update the configuration in ARM. More...
 
int armSend (arm_t *arm, const void *buf, size_t nbyte)
 Send data to ARM. More...
 
int armReceive (arm_t *arm, void *buf, size_t nbyte, int timeout)
 Receive data from ARM. More...