myDatalogEasy IoT Base Library

Description

Basic library for the myDatalogEasy IoT hardware platform.

Overview

Abstract:
Supported rapidM2M hardware platforms:
  • rapidM2M EasyIoT:
    • Firmware: 01v027 and higher
If you use this library in your IoT app, you should specify the minimum required version of the firmware under "required HW & FW" in the project settings.

DLO

EasyIoT_RS485_Init(rs485, baudrate, mode, funcidx)

Initialises the specified RS485 interface

rs485 : TEasyIoTRS485port - Number of the RS485 interface
baudrate : s32 - Baud rate to be used. Observe the valid limits for the device being used.
mode : s32 - bitmask
Stopbits
RS485_1_STOPBIT = 0b000000001 - 1 stop bit
RS485_2_STOPBIT = 0b000000010 - 2 stop bits
Parity
RS485_PARITY_NONE = 0b000000000 - no parity
RS485_PARITY_ODD = 0b000000100 - uneven parity
RS485_PARITY_EVEN = 0b000001000 - even parity
Databits
RS485_7_DATABIT = 0b000000000 - 7 data bits
RS485_8_DATABIT = 0b000010000 - 8 data bits
Duplex mode
RS485_HALF_DUPLEX = 0b000000000 - half duplex mode
RS485_FULL_DUPLEX = 0b100000000 - full duplex mode
only usable with the not isolated interface
Termination resistor
RS485_120_OHM_NONE = 0b0000000000000000 - no load resistance
RS485_120_OHM_ACT = 0b0000001000000000 - 120 Ohm load resistance
only usable with the not isolated interface
The constants can also be combined using the "or" conjunction.
funcidx : s32 - Index of the public function for the RS485 character receipt

Type of the function (see TEasyIoT_RS485_Callback):
public func( const data{}, len);
returns : Terror
OK - if successful
ERROR_FEATURE_LOCKED - if the specified interface on the device is not released
< OK - if another error occurs
TEasyIoT_RS485_Callback(
public func(const data{}, len);
Function to be provided by the device logic developer, that is called when characters are received via the RS485 interface (registered with EasyIoT_RS485_Init() ).
data{} : u8 - Array that contains the received data
len : s32 - Number of received bytes
EasyIoT_RS485_Close(rs485)

Closes the specified RS485 interface

rs485 : TEasyIoTRS485port - Number of the RS485 interface
returns : Terror
OK - if successful
ERROR_FEATURE_LOCKED - if the specified interface on the device is not released
< OK - if another error occurs
EasyIoT_RS485_Write(rs485, const data{}, len)

Sends data via the specified RS485 interface

rs485 : TEasyIoTRS485port - Number of the RS485 interface
data{} : u8 - Array that contains the data to be sent
len : s32 - Number of bytes to be sent
returns : Terror
>=0 - Number of processed bytes, if successful
If the number of processed bytes deviates from the passed number of bytes to be sent, the EasyIoT_RS485_Write() function must be called again. However, now only the data that could not be processed in the previous function call needs to be passed here.
ERROR_FEATURE_LOCKED - if the specified interface on the device is not released
< OK - if another error occurs
EasyIoT_RS485_Setbuf(rs485, rxbuf{}, rxlen, txbuf{}, txlen)

Provides the firmware with one buffer for sending and one for receiving characters via the RS485 interface from the RAM area reserved for the Device Logic. When this function is called, the system switches from the 256 byte buffers integrated in the firmware to the transferred buffers.

If necessary, this function may need to be called before the initialisation of the RS485 interface via the EasyIoT_RS485_Init() function.
The buffers "rxbuf" and "txbuf" must be valid during the entire use by the firmware (i.e. they must be defined as a global or static variable).
rs485 : TEasyIoTRS485port - Number of the RS485 interface
rxbuf{} : u8 - Static byte array that should be used as a buffer to receive characters via the R485 interface
rxlen : s32 - Size of the receiving buffer in byte
If the function is called up again and the size is set to "0" during the process, then the system switches back to the integrated buffer (256 bytes). The transferred static byte array can then be used by the device logic again.
txbuf{} : u8 - Static byte array that should be used as a buffer to send characters via the RS485 interface
txlen : s32 - Size of the sending buffer in byte
If the function is called up again and the size is set to "0" during the process, then the system switches back to the integrated buffer (256 bytes). The transferred static byte array can then be used by the device logic again.
returns : Terror
OK - if successful
< OK - if an error occurs
TEasyIoTRS485port

RS485 interface to use

EASYIOT_RS485_NOT_ISOLATED = 0 - not isolated interface
EASYIOT_RS485_ISOLATED = 1 - add-on isolated interface connected on the RS232 interface

On this page

myDatalogEasy IoT Base Library