Program Listing for File AInput12Module.h

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

#ifndef AINPUT12_MODULE_H_
#define AINPUT12_MODULE_H_

#include <stdint.h>

#include "EmodRet.hpp"

#ifdef __cplusplus
extern "C" {
#endif

#define AInput12Module_INPUT01 0x0001
#define AInput12Module_INPUT02 0x0002
#define AInput12Module_INPUT03 0x0004
#define AInput12Module_INPUT04 0x0008
#define AInput12Module_INPUT05 0x0010
#define AInput12Module_INPUT06 0x0020
#define AInput12Module_INPUT07 0x0040
#define AInput12Module_INPUT08 0x0080
#define AInput12Module_INPUT09 0x0100
#define AInput12Module_INPUT10 0x0200
#define AInput12Module_INPUT11 0x0400
#define AInput12Module_INPUT12 0x0800
#define AInput12Module_ALL_INPUT 0x07ff

#define AInput12Module_NUMBER_OF_AI_INPUTS 12

#define AInput12Module_MAX_ADC 10000

#define AInput12Module_CFG_VOLTAGE 0x00
#define AInput12Module_CFG_CURRENT 0x01

#define AInput12Module_MAX_VOLTAGE 10.0
#define AInput12Module_MAX_CURRENT 20.0

struct AInput12ModuleStruct;
typedef struct AInput12ModuleStruct AInput12Module_t;
typedef void (*AInput12ModuleCallback_Type)(const uint8_t* data, const uint16_t data_len, const uint8_t id_function, void* ctx);

AInput12Module_t* AInput12Module_create();
void AInput12Module_destroy(AInput12Module_t* module);

EmodRet AInput12Module_init(AInput12Module_t* module, const AInput12ModuleCallback_Type callback_func, void* callback_context);
EmodRet AInput12Module_init_v(AInput12Module_t* module, const AInput12ModuleCallback_Type callback_func, void* callback_context, uint8_t variant);

// AI methods
EmodRet AInput12Module_configSampleRate(AInput12Module_t* module, const uint32_t ms_period);
EmodRet AInput12Module_configInput(AInput12Module_t* module, const uint16_t input_mask);
EmodRet AInput12Module_getInputConfig(AInput12Module_t* module, uint16_t* config);
EmodRet AInput12Module_getAnalogInput(AInput12Module_t* module, const uint16_t input_number, float* data);
EmodRet AInput12Module_getAllAnalogInput(AInput12Module_t* module, float* data);

// Callback methods
EmodRet AInput12Module_configEventAtTimeInterval(AInput12Module_t* module, const uint16_t time_interval, const uint32_t event_mask);
EmodRet AInput12Module_configEventOnValueChange(AInput12Module_t* module, const uint32_t threshold, const uint32_t event_mask);
EmodRet AInput12Module_configEventWithinRange(AInput12Module_t* module, const uint32_t low_limit, const uint32_t high_limit, const uint32_t event_mask);
EmodRet AInput12Module_configEventOutOfRange(AInput12Module_t* module, const uint32_t low_limit, const uint32_t high_limit, const uint32_t event_mask);
EmodRet AInput12Module_resetEventConfiguration(AInput12Module_t* module);

uint16_t AInput12Module_voltageToSamples(float voltage);
uint16_t AInput12Module_currentToSamples(float current);
float AInput12Module_samplesToVoltage(uint16_t samples);
float AInput12Module_samplesToCurrent(uint16_t samples);

#ifdef __cplusplus
}
#endif

#endif  // AINPUT12_MODULE_H_