Program Listing for File AInput7Relay2Module.h

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

#ifndef AINPUT7RELAY2_MODULE_H_
#define AINPUT7RELAY2_MODULE_H_

#include <stdint.h>

#include "EmodRet.hpp"

#ifdef __cplusplus
extern "C" {
#endif

#define AInput7Relay2Module_INPUT01 0x0001
#define AInput7Relay2Module_INPUT02 0x0002
#define AInput7Relay2Module_INPUT03 0x0004
#define AInput7Relay2Module_INPUT04 0x0008
#define AInput7Relay2Module_INPUT05 0x0010
#define AInput7Relay2Module_INPUT06 0x0020
#define AInput7Relay2Module_INPUT07 0x0040
#define AInput7Relay2Module_ALL_INPUT 0x007f

#define AInput7Relay2Module_RELAY1 0x01
#define AInput7Relay2Module_RELAY2 0x02
#define AInput7Relay2Module_ALL_RELAY 0x03

#define AInput7Relay2Module_NUMBER_OF_AI_INPUTS 7
#define AInput7Relay2Module_NUMBER_OF_RELAYS 2

#define AInput7Relay2Module_idFunctionINPUT01 5
#define AInput7Relay2Module_idFunctionINPUT02 6
#define AInput7Relay2Module_idFunctionINPUT03 7
#define AInput7Relay2Module_idFunctionINPUT04 8
#define AInput7Relay2Module_idFunctionINPUT05 9
#define AInput7Relay2Module_idFunctionINPUT06 10
#define AInput7Relay2Module_idFunctionINPUT07 11

#define AInput7Relay2Module_MAX_ADC 10000

#define AInput7Relay2Module_CFG_VOLTAGE 0x00
#define AInput7Relay2Module_CFG_CURRENT 0x01

#define AInput7Relay2Module_MAX_VOLTAGE 10.0
#define AInput7Relay2Module_MAX_CURRENT 20.0

struct AInput7Relay2ModuleStruct;
typedef struct AInput7Relay2ModuleStruct AInput7Relay2Module_t;
typedef void (*AInput7Relay2ModuleCallback_Type)(const uint8_t* data, const uint16_t data_len, const uint8_t id_function, void* ctx);

AInput7Relay2Module_t* AInput7Relay2Module_create();
void AInput7Relay2Module_destroy(AInput7Relay2Module_t* module);

EmodRet AInput7Relay2Module_init(AInput7Relay2Module_t* module, const AInput7Relay2ModuleCallback_Type callback_func, void* callback_context);
EmodRet AInput7Relay2Module_init_v(AInput7Relay2Module_t* module, const AInput7Relay2ModuleCallback_Type callback_func, void* callback_context,
                                   uint8_t variant);

// AI methods
EmodRet AInput7Relay2Module_configSampleRate(AInput7Relay2Module_t* module, const uint32_t ms_period);
EmodRet AInput7Relay2Module_configInput(AInput7Relay2Module_t* module, const uint16_t input_mask);
EmodRet AInput7Relay2Module_getInputConfig(AInput7Relay2Module_t* module, uint16_t* config);
EmodRet AInput7Relay2Module_getAnalogInput(AInput7Relay2Module_t* module, const uint16_t input_number, float* data);
EmodRet AInput7Relay2Module_getAllAnalogInput(AInput7Relay2Module_t* module, float data[AInput7Relay2Module_NUMBER_OF_AI_INPUTS]);

// Relays methods
EmodRet AInput7Relay2Module_configPulseWidth(AInput7Relay2Module_t* module, const uint8_t relay_mask, const uint32_t width_ms);
EmodRet AInput7Relay2Module_activate(AInput7Relay2Module_t* module, const uint8_t relay_mask);
EmodRet AInput7Relay2Module_deactivate(AInput7Relay2Module_t* module, const uint8_t relay_mask);
EmodRet AInput7Relay2Module_activateAll(AInput7Relay2Module_t* module);
EmodRet AInput7Relay2Module_deactivateAll(AInput7Relay2Module_t* module);
EmodRet AInput7Relay2Module_getRelayStatus(AInput7Relay2Module_t* module, const uint8_t relay_mask, uint8_t* status);
EmodRet AInput7Relay2Module_getAllRelayStatus(AInput7Relay2Module_t* module, uint8_t* status);

// Callback methods
EmodRet AInput7Relay2Module_configEventAtTimeInterval(AInput7Relay2Module_t* module, const uint16_t time_interval, const uint32_t event_mask);
EmodRet AInput7Relay2Module_configEventOnValueChange(AInput7Relay2Module_t* module, const uint32_t threshold, const uint32_t event_mask);
EmodRet AInput7Relay2Module_configEventWithinRange(AInput7Relay2Module_t* module, const uint32_t low_limit, const uint32_t high_limit,
                                                   const uint32_t event_mask);
EmodRet AInput7Relay2Module_configEventOutOfRange(AInput7Relay2Module_t* module, const uint32_t low_limit, const uint32_t high_limit,
                                                  const uint32_t event_mask);
EmodRet AInput7Relay2Module_resetEventConfiguration(AInput7Relay2Module_t* module);

// Support methods
uint16_t AInput7Relay2Module_voltageToSamples(AInput7Relay2Module_t* module, float voltage);
uint16_t AInput7Relay2Module_currentToSamples(AInput7Relay2Module_t* module, float current);
float AInput7Relay2Module_samplesToVoltage(AInput7Relay2Module_t* module, uint16_t samples);
float AInput7Relay2Module_samplesToCurrent(AInput7Relay2Module_t* module, uint16_t samples);

#ifdef __cplusplus
}
#endif

#endif  // AINPUT7RELAY2_MODULE_H_