Program Listing for File DInput2Relay1Temp2Module.h

Return to documentation for file (doc/include/DInput2Relay1Temp2Module.h)

#ifndef DINPUT2RELAY1TEMP2_MODULE_H_
#define DINPUT2RELAY1TEMP2_MODULE_H_

#include <stdint.h>

#include "EmodRet.hpp"

#ifdef __cplusplus
extern "C" {
#endif

#define DInput2Relay1Temp2Module_NUMBER_OF_DI 2
#define DInput2Relay1Temp2Module_NUMBER_OF_RELAYS 1
#define DInput2Relay1Temp2Module_NUMBER_OF_TEMP 2

#define DInput2Relay1Temp2Module_ALL_DIGITAL_INPUT 0x0003
#define DInput2Relay1Temp2Module_ALL_TEMP_INPUT 0x03

// Identifiers
enum TempSensorID {
    kTempSensor1 = 0x01,
    kTempSensor2 = 0x02,
};

// Temperature Sensor Configurations
enum TempSensorConfig {
    kTwoWirePt100Sensor = 1,
    kThreeWirePt100Sensor = 2,
    kFourWirePt100Sensor = 3,
    kTwoWirePt1000Sensor = 4,
    kThreeWirePt1000Sensor = 5,
    kFourWirePt1000Sensor = 6
};

// Digital Input Function mode
enum DigitalInputFunctionMode {
    kPretriggerTime = 0x00000000,
    kPulseCounter = 0x00000001,
    kWidthCounter = 0x00000002,
};

struct DInput2Relay1Temp2ModuleStruct;
typedef struct DInput2Relay1Temp2ModuleStruct DInput2Relay1Temp2Module_t;
typedef void (*DInput2Relay1Temp2ModuleCallback_Type)(const uint8_t* data, const uint16_t data_len, const uint8_t id_function, void* ctx);

DInput2Relay1Temp2Module_t* DInput2Relay1Temp2Module_create();
void DInput2Relay1Temp2Module_destroy(DInput2Relay1Temp2Module_t* module);

EmodRet DInput2Relay1Temp2Module_init(DInput2Relay1Temp2Module_t* module, const DInput2Relay1Temp2ModuleCallback_Type callback, void* context);
EmodRet DInput2Relay1Temp2Module_init_v(DInput2Relay1Temp2Module_t* module, const DInput2Relay1Temp2ModuleCallback_Type callback, void* context,
                                        uint8_t variant);

// DI methods
EmodRet DInput2Relay1Temp2Module_getStatus(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask, uint8_t* status, bool* new_data);
EmodRet DInput2Relay1Temp2Module_getAllStatus(DInput2Relay1Temp2Module_t* module, uint8_t status[DInput2Relay1Temp2Module_NUMBER_OF_DI], bool* new_data);
EmodRet DInput2Relay1Temp2Module_switchToModeDI(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask, const DigitalInputFunctionMode mode);
EmodRet DInput2Relay1Temp2Module_setPulseFilterTime(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask, const uint32_t ms_time);
EmodRet DInput2Relay1Temp2Module_setAllPulseFilterTime(DInput2Relay1Temp2Module_t* module, const uint32_t ms_time);
EmodRet DInput2Relay1Temp2Module_getPulseFilterTime(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask, uint32_t* ms_time);
EmodRet DInput2Relay1Temp2Module_getAllPulseFilterTime(DInput2Relay1Temp2Module_t* module, uint32_t ms_times[DInput2Relay1Temp2Module_NUMBER_OF_DI]);
EmodRet DInput2Relay1Temp2Module_getPulseCount(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask, uint32_t* count);
EmodRet DInput2Relay1Temp2Module_getAllPulseCount(DInput2Relay1Temp2Module_t* module, uint32_t counts[DInput2Relay1Temp2Module_NUMBER_OF_DI]);
EmodRet DInput2Relay1Temp2Module_resetPulseCount(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask);
EmodRet DInput2Relay1Temp2Module_resetAllPulseCount(DInput2Relay1Temp2Module_t* module);
EmodRet DInput2Relay1Temp2Module_getPulseWidth(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask, uint32_t* width);
EmodRet DInput2Relay1Temp2Module_getAllPulseWidth(DInput2Relay1Temp2Module_t* module, uint32_t widths[DInput2Relay1Temp2Module_NUMBER_OF_DI]);

// Relays methods
EmodRet DInput2Relay1Temp2Module_configPulseWidth(DInput2Relay1Temp2Module_t* module, const uint16_t relay_mask, const uint32_t width_ms);
EmodRet DInput2Relay1Temp2Module_configAllPulseWidth(DInput2Relay1Temp2Module_t* module, const uint32_t width_ms);
EmodRet DInput2Relay1Temp2Module_activate(DInput2Relay1Temp2Module_t* module, const uint16_t relay_mask);
EmodRet DInput2Relay1Temp2Module_deactivate(DInput2Relay1Temp2Module_t* module, const uint16_t relay_mask);
EmodRet DInput2Relay1Temp2Module_activateAll(DInput2Relay1Temp2Module_t* module);
EmodRet DInput2Relay1Temp2Module_deactivateAll(DInput2Relay1Temp2Module_t* module);
EmodRet DInput2Relay1Temp2Module_getRelayStatus(DInput2Relay1Temp2Module_t* module, const uint16_t relay_mask, uint8_t* status);
EmodRet DInput2Relay1Temp2Module_getAllRelayStatus(DInput2Relay1Temp2Module_t* module, uint8_t* status);

// Temperature sensor methods
EmodRet DInput2Relay1Temp2Module_configTempSensor(DInput2Relay1Temp2Module_t* module, const TempSensorID sensor_id, const TempSensorConfig config);
EmodRet DInput2Relay1Temp2Module_configAllTempSensor(DInput2Relay1Temp2Module_t* module, const TempSensorConfig config);
EmodRet DInput2Relay1Temp2Module_getTempSensorConfig(DInput2Relay1Temp2Module_t* module, const TempSensorID sensor_id, TempSensorConfig* temp_sensor_config);
EmodRet DInput2Relay1Temp2Module_getTempSensor(DInput2Relay1Temp2Module_t* module, const TempSensorID sensor_id, int16_t* value);
EmodRet DInput2Relay1Temp2Module_getAllTempSensor(DInput2Relay1Temp2Module_t* module, int16_t data[DInput2Relay1Temp2Module_NUMBER_OF_TEMP]);

// DI Callback methods
EmodRet DInput2Relay1Temp2Module_switchToModeDI(DInput2Relay1Temp2Module_t* module, const uint16_t input_mask, const DigitalInputFunctionMode mode);
EmodRet DInput2Relay1Temp2Module_configEventAtTimeIntervalDI(DInput2Relay1Temp2Module_t* module, const uint32_t time_interval);
EmodRet DInput2Relay1Temp2Module_configEventOnNewDataDI(DInput2Relay1Temp2Module_t* module);
EmodRet DInput2Relay1Temp2Module_configEventOnValueChangeDI(DInput2Relay1Temp2Module_t* module, const uint32_t threshold,
                                                            uint16_t event_mask = DInput2Relay1Temp2Module_ALL_DIGITAL_INPUT);
EmodRet DInput2Relay1Temp2Module_configEventAtTimeIntervalTemp(DInput2Relay1Temp2Module_t* module, const uint32_t time_interval,
                                                               const uint32_t event_mask = DInput2Relay1Temp2Module_ALL_TEMP_INPUT);
EmodRet DInput2Relay1Temp2Module_configEventOnValueChangeTemp(DInput2Relay1Temp2Module_t* module, const uint32_t threshold,
                                                              const uint32_t event_mask = DInput2Relay1Temp2Module_ALL_TEMP_INPUT);
EmodRet DInput2Relay1Temp2Module_configEventWithinRangeTemp(DInput2Relay1Temp2Module_t* module, const uint32_t low_limit, const uint32_t high_limit,
                                                            const uint32_t event_mask = DInput2Relay1Temp2Module_ALL_TEMP_INPUT);
EmodRet DInput2Relay1Temp2Module_configEventOutOfRangeTemp(DInput2Relay1Temp2Module_t* module, const uint32_t low_limit, const uint32_t high_limit,
                                                           const uint32_t event_mask = DInput2Relay1Temp2Module_ALL_TEMP_INPUT);
EmodRet DInput2Relay1Temp2Module_resetEventConfig(DInput2Relay1Temp2Module_t* module);

#ifdef __cplusplus
}
#endif

#endif  // DINPUT2RELAY1TEMP2_MODULE_H_