armapi  v1.0
bĂȘta
Main and various

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 armLed_e armLed_t
 Constant to define the comportment of the LED. 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  armLed_e { ARM_LED_OFF, ARM_LED_OFF_RF, ARM_LED_ON_RF }
 Constant to define the comportment of the LED. 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 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 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...
 
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...
 

Detailed Description

Typedef Documentation

Constant to define the baudrate value.

typedef enum armError_e armError_t

Constant to define the errors.

typedef enum armLed_e armLed_t

Constant to define the comportment of the LED.

See also
armSetLed()
typedef enum armMode_e armMode_t

Constant to define the working mode.

See also
armSetMode()
typedef enum armType_e armType_t

Type of ARM.

See also
armInfo()

Enumeration Type Documentation

Constant to define the baudrate value.

Enumerator
ARM_BAUDRATE_NONE 

That is probably a error.

ARM_BAUDRATE_1200 

1200 bps.

ARM_BAUDRATE_2400 

2400 bps.

ARM_BAUDRATE_4800 

4800 bps.

ARM_BAUDRATE_9600 

9600 bps.

ARM_BAUDRATE_19200 

19200 bps.

ARM_BAUDRATE_38400 

38400 bps.

ARM_BAUDRATE_57600 

57600 bps.

ARM_BAUDRATE_115200 

115200 bps.

enum armError_e

Constant to define the errors.

Enumerator
ARM_ERR_NONE 

No error.

ARM_ERR_NO_SUPPORTED 

Functionality no supported by theARM.

ARM_ERR_PORT_OPEN 

Port Error, at the port opening.

ARM_ERR_PORT_CONFIG 

Port Error, at the port configuring.

ARM_ERR_PORT_READ 

Port Error, at the port reading.

ARM_ERR_PORT_WRITE 

Port Error, at the port writing.

ARM_ERR_PORT_WRITE_READ 

Port Error, at the port reading/writing.

ARM_ERR_PORT_CLOSE 

Port Error, at the port closing.

ARM_ERR_PARAM_OUT_OF_RANGE 

Error, one or more of parameters is out of range.

ARM_ERR_PARAM_INCOMPATIBLE 

Error, the parameters is incompatible between them.

ARM_ERR_ADDRESSING_NOT_ENABLE 

Error, the addressing is not enable.

Note
To fix this error, you can enable the addressing with armFskEnableAddressing() function.
ARM_ERR_WOR_ENABLE 

Error, the WOR mode is enable.

Note
To fix this error, you can disable the WOR mode with armFskSetWorMode() function.
ARM_ERR_ARM_GO_AT 

ARM commend Error, can't switch to AT commend.

ARM_ERR_ARM_BACK_AT 

ARM commend Error, can't quit AT commend.

ARM_ERR_ARM_CMD 

ARM commend Error, from AT commend.

ARM_ERR_ARM_GET_REG 

ARM commend Error, from get register.

ARM_ERR_ARM_SET_REG 

ARM commend Error, from set register.

enum armLed_e

Constant to define the comportment of the LED.

See also
armSetLed()
Enumerator
ARM_LED_OFF 

The LED is 'off' all the time.

ARM_LED_OFF_RF 

The LED is 'off' on RF activity and 'on' other time.

ARM_LED_ON_RF 

The LED is 'on' on RF activity and 'off' other time.

enum armMode_e

Constant to define the working mode.

See also
armSetMode()
Enumerator
ARM_MODE_FSK 

Mode for Fsk (local) radio.

ARM_MODE_SFX 

Mode for Sigfox network.

ARM_MODE_LORAWAN 

Mode for Lora network (LoRaWan).

enum armType_e

Type of ARM.

See also
armInfo()
Enumerator
ARM_TYPE_NONE 

No Arm type.

ARM_TYPE_N8_LP 

ARM Nano in 868MHz low power version (and Sigfox).

ARM_TYPE_N8_LD 

ARM Nano in 868MHz long distance version.

ARM_TYPE_N8_LW 

ARM Nano in 868MHz LoraWan version.

Function Documentation

armError_t armDeInit ( arm_t *  arm)

De-initialize the port.

Parameters
armPointer to your ARM structure.
Returns
Error available:
armError_t armEnableWakeUpUart ( arm_t *  arm,
bool  enable 
)

Enable/Disable the Wake Up Uart.

Warning
The Wake Up Uart don't supporter the serially baudrate upper than 38400 bps. This function set the baudrate at 38400bps if necessary.

This function is supported by:

  • ARM_N8_LP, ARM Nano in 868Mhz Low Power (and Sigfox).
  • ARM_N8_LD, ARM Nano in 868MHz Long Distance.
Parameters
armPointer to your ARM structure.
enabletrue to enable Wake Up Uart false to disable.
Returns
Error available:
Note
The Wake Up Uart can be disable by armFskSetWorMode().
You need to call armUpdateConfig() for update the parameters in you ARM.
After call armUpdateConfig() functions, the ARM go to sleep:
  • If the ARMPORT_WITH_nSLEEP is not defined.
  • If ARMPORT_WITH_nSLEEP is defined and sleep is enable (see armSleep()).
See also
armIsEnableWakeUpUart()
armFskSetWorMode()
armSleep()
armLed_t armGetLed ( arm_t *  arm)

Get the LED behavior.

Note
In the case where this function in not supported by your ARM the returned value is unfeasible.

This function is supported by:

  • ARM_N8_LP, ARM Nano in 868Mhz Low Power (and Sigfox).
  • ARM_N8_LD, ARM Nano in 868MHz Long Distance.
  • ARM_N8_LW, ARM Nano 868MHz in Lora Wan.
Parameters
armPointer to your ARM structure.
Returns
The behavior of the LED:
See also
armSetLed()
armMode_t armGetMode ( arm_t *  arm)

Get the mode.

Parameters
armPointer to your ARM structure.
Returns
The Mode:
See also
armSetMode()
void armGetSerial ( arm_t *  arm,
armPortBaudrate_t baud,
armPortDatabits_t databits,
armPortParity_t parity,
armPortStopbit_t stopbit 
)

Get the serial port configuration.

Note
If you don't went get a parameter you can give the NULL value.
In the case where this function in not supported by your ARM the value of parameters is no modified.

This function is supported by:

  • ARM_N8_LP, ARM Nano in 868Mhz Low Power (and Sigfox).
  • ARM_N8_LD, ARM Nano in 868MHz Long Distance.
Parameters
armPointer to your ARM structure.
baudIf the pointer is valid, the baud is set. If ARMPORT_BAUDRATE_NONE is set, there is probably a error.
databitsIf the pointer is valid, the databits is set.
parityIf the pointer is valid, the parity is set.
stopbitIf the pointer is valid, the stopbit is set.
See also
armSetSerial()
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.

Note
If you don't went get a parameter you can give the NULL value.
Parameters
armPointer to your ARM structure.
armTypeIf the pointer is valid, The ARM type is set. The possible values is:
revIf the pointer is valid, the firmware version is copied. This parameter must be a string buffer capacity equal or more of 16 bytes.
snIf the pointer is valid, the serial number is set. This parameter is the ID Sigfox in the case where the ARM support the Sigfox Network.
rfFreqIf the pointer is valid, the work frequency of your ARM is set.
rfPowerIf the pointer is valid, the max power supported by your ARM is set.
Returns
Error available:
armError_t armInit ( arm_t *  arm,
void *  port 
)

Initialize the structure, port and ARM.

This function must be call before call other function depend of the arm_t structure.

Parameters
armPointer to your ARM structure.
portPointer to something which mean you serial port.
Returns
Error available:
bool armIsEnableWakeUpUart ( arm_t *  arm)

Get if Wake Up Uart is enable.

Note
In the case where this function in not supported by your ARM the returned value is unfeasible.

This function is supported by:

  • ARM_N8_LP, ARM Nano in 868Mhz Low Power (and Sigfox).
  • ARM_N8_LD, ARM Nano in 868MHz Long Distance.
Parameters
armPointer to your ARM structure.
Returns
true if the Wake Up Uart is enable or false if disable.
See also
armEnableWakeUpUart()
armError_t armReboot ( arm_t *  arm)

Reboot the ARM.

Parameters
armPointer to your ARM structure.
Returns
Error available:
int armReceive ( arm_t *  arm,
void *  buf,
size_t  nbyte,
int  timeout 
)

Receive data from ARM.

This function is exit when the timeout is achieved from the last receive data or if the nbyte is achieved.

Warning
You can use your method to read data from ARM (for example: in interruption method), but you don't must influence on the behavior of serial port when armInit(), armReboot(), armInfo(), armLwIds() or armUpdateConfig() is call.
Parameters
armPointer to your ARM structure.
bufThe buffer.
nbyteThe size of buffer.
timeoutThe timeout.
Returns
The number of data read. -1 if error from the serial port.
See also
armSend()
int armSend ( arm_t *  arm,
const void *  buf,
size_t  nbyte 
)

Send data to ARM.

  • In the case or the infinity mode is enable, this function send the data.
  • In the case or the infinity mode is disable, the packet mode is enable, this function send the data to the ARM, 120 byte by 120 byte and wait the necessary time to send the data on the radio.
Warning
You can use your method to write data to ARM (for example: in interruption method), but you don't must influence on the behavior of serial port when armInit(), armReboot(), armInfo(), armLwIds() or armUpdateConfig() is call.
Parameters
armPointer to your ARM structure.
bufThe buffer.
nbyteThe number of data to send.
Returns
The number of data write. -1 if error from the serial port.
See also
armReceive()
armFskEnableInfinityMode()
Todo:
Finish implementation and add doc to explained the wait time between send data.
void armSetLed ( arm_t *  arm,
armLed_t  led 
)

Set the LED behavior.

Note
In the case where this function in not supported by your ARM this functions in ignored.

This function is supported by:

  • ARM_N8_LP, ARM Nano in 868Mhz Low Power (and Sigfox).
  • ARM_N8_LD, ARM Nano in 868MHz Long Distance.
  • ARM_N8_LW, ARM Nano in 868MHz Lora Wan.
Parameters
armPointer to your ARM structure.
ledThe behavior of the LED:
Note
You need to call armUpdateConfig() to update the parameters in you ARM.
See also
armGetLed()
armError_t armSetMode ( arm_t *  arm,
armMode_t  mode 
)

Set the mode.

Parameters
armPointer to your ARM structure.
modeThe mode, the possible value:
Returns
Error available:
Note
You need to call armUpdateConfig() to update the parameters in you ARM.
See also
armGetMode()
armError_t armSetSerial ( arm_t *  arm,
armPortBaudrate_t  baud,
armPortDatabits_t  databits,
armPortParity_t  parity,
armPortStopbit_t  stopbit 
)

Setup serial port configuration.

Warning
In the case or the port don't support one of below parameters, this function don't return error. But, the error ARM_ERR_PORT_CONFIG will return to next call armUpdateConfig().

This function is supported by:

  • ARM_N8_LP, ARM Nano in 868Mhz Low Power (and Sigfox).
  • ARM_N8_LD, ARM Nano in 868MHz Long Distance.
Parameters
armPointer to your ARM structure.
baudThe serial baudrate.
databitsThe number of data bits:
parityThe type of parity:
stopbitThe number of stop bits:
Returns
Error available:
Note
You need to call armUpdateConfig() to update the parameters in you ARM.
See also
armGetSerial()
armEnableWakeUpUart()
void armSleep ( arm_t *  arm,
bool  sleep 
)

Enable/Disable sleep with pin.

This function is supported by:

  • ARM_N8_LP, ARM Nano in 868Mhz Low Power (and Sigfox).
  • ARM_N8_LD, ARM Nano in 868MHz Long Distance.
  • ARM_N8_LW, ARM Nano in 868MHz Lora Wan.
Parameters
armPointer to your ARM structure.
sleeptrue to enable sleep false to disable.
Note
This function is defined only if ARMPORT_WITH_nSLEEP is defined.
The sleep must be disable if the Wake Up Uart is disable and you want call armSend(), armReceive(), armInfo(), armLwIds() or armUpdateConfig()
armError_t armUpdateConfig ( arm_t *  arm)

Update the configuration in ARM.

None of parameters/modes previously configured, is no set in your ARM. This function send/set the necessary registers to apply the previously configuration and reconfigure the port if necessary.

Parameters
armPointer to your ARM structure.
Returns
Error available: