Program Listing for File DInput10Module.h

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

#ifndef DINPUT_MODULE_H_
#define DINPUT_MODULE_H_

#include <stdint.h>

#include "EmodRet.hpp"

#ifdef __cplusplus
extern "C" {
#endif

#define DInput10Module_INPUT01 0x0001
#define DInput10Module_INPUT02 0x0002
#define DInput10Module_INPUT03 0x0004
#define DInput10Module_INPUT04 0x0008
#define DInput10Module_INPUT05 0x0010
#define DInput10Module_INPUT06 0x0020
#define DInput10Module_INPUT07 0x0040
#define DInput10Module_INPUT08 0x0080
#define DInput10Module_INPUT09 0x0100
#define DInput10Module_INPUT10 0x0200
#define DInput10Module_ALL_INPUT 0x03ff

#define DInput10Module_NUMBER_OF_DI_INPUTS 10

#define DInput10Module_MODE_PRETRIGGER_TIME 0x00000000
#define DInput10Module_MODE_PULSE_COUNTER 0x00000001
#define DInput10Module_MODE_WIDTH_COUNTER 0x00000002

#define DInput10Module_idFunctionINPUTS 1
#define DInput10Module_idFunctionCOUNTER01 3
#define DInput10Module_idFunctionCOUNTER02 4
#define DInput10Module_idFunctionCOUNTER03 5
#define DInput10Module_idFunctionCOUNTER04 6
#define DInput10Module_idFunctionCOUNTER05 7
#define DInput10Module_idFunctionCOUNTER06 8
#define DInput10Module_idFunctionCOUNTER07 9
#define DInput10Module_idFunctionCOUNTER08 10
#define DInput10Module_idFunctionCOUNTER09 11
#define DInput10Module_idFunctionCOUNTER10 12

struct DInput10ModuleStruct;
typedef struct DInput10ModuleStruct DInput10Module_t;
typedef void (*DInput10ModuleCallback_Type)(const uint8_t* data, uint16_t datalen, uint8_t idFunction, void* ctx);

DInput10Module_t* DInput10Module_create();
void DInput10Module_destroy(DInput10Module_t* module);

EmodRet DInput10Module_init(DInput10Module_t* module, const DInput10ModuleCallback_Type callback, void* context);
EmodRet DInput10Module_init_v(DInput10Module_t* module, const DInput10ModuleCallback_Type callback, void* context, uint8_t variant);
EmodRet DInput10Module_getStatus(DInput10Module_t* module, const uint16_t input_number, uint8_t* status);
EmodRet DInput10Module_getAllStatus(DInput10Module_t* module, uint8_t status[DInput10Module_NUMBER_OF_DI_INPUTS]);
EmodRet DInput10Module_getPulseCount(DInput10Module_t* module, const uint16_t input_number, uint32_t* count);
EmodRet DInput10Module_getAllPulseCount(DInput10Module_t* module, uint32_t counts[DInput10Module_NUMBER_OF_DI_INPUTS]);
EmodRet DInput10Module_resetPulseCount(DInput10Module_t* module, uint16_t input_number);
EmodRet DInput10Module_resetAllPulseCount(DInput10Module_t* module);
EmodRet DInput10Module_getPulseWidth(DInput10Module_t* module, const uint16_t input_number, uint32_t* width);
EmodRet DInput10Module_getAllPulseWidth(DInput10Module_t* module, uint32_t widths[DInput10Module_NUMBER_OF_DI_INPUTS]);

// Callback methods
EmodRet DInput10Module_configEventAtTimeInterval(DInput10Module_t* module, const uint16_t time_interval);
EmodRet DInput10Module_switchToMode(DInput10Module_t* module, const uint16_t input_number, const uint32_t mode);
EmodRet DInput10Module_configEventOnNewData(DInput10Module_t* module);
EmodRet DInput10Module_configEventOnValueChange(DInput10Module_t* module, uint32_t threshold, uint32_t event_mask);
EmodRet DInput10Module_resetEventConfig(DInput10Module_t* module);

#ifdef __cplusplus
}
#endif

#endif  // RELAY_MODULE_H_