Program Listing for File AInput12Module.h

Return to documentation for file (/home/asunye/wd/dev/emod_docs/emod_controller/build_x86/install/include/AInput12Module.h)

#ifndef AINPUT12_MODULE_H_
#define AINPUT12_MODULE_H_

#include "EmodRet.hpp"

#ifdef __cplusplus
extern "C" {
#endif

static const uint16_t AInput12Module_INPUT01 = 0x0001;
static const uint16_t AInput12Module_INPUT02 = 0x0002;
static const uint16_t AInput12Module_INPUT03 = 0x0004;
static const uint16_t AInput12Module_INPUT04 = 0x0008;
static const uint16_t AInput12Module_INPUT05 = 0x0010;
static const uint16_t AInput12Module_INPUT06 = 0x0020;
static const uint16_t AInput12Module_INPUT07 = 0x0040;
static const uint16_t AInput12Module_INPUT08 = 0x0080;
static const uint16_t AInput12Module_INPUT09 = 0x0100;
static const uint16_t AInput12Module_INPUT10 = 0x0200;
static const uint16_t AInput12Module_INPUT11 = 0x0400;
static const uint16_t AInput12Module_INPUT12 = 0x0800;
static const uint16_t AInput12Module_ALL_INPUT = 0x07ff;

static const uint8_t AInput12Module_NUMBER_OF_AI_INPUTS = 12;

static const uint16_t AInput12Module_MAX_ADC = 10000;

static const uint8_t AInput12Module_CFG_VOLTAGE = 0x00;
static const uint8_t AInput12Module_CFG_CURRENT = 0x01;

static constexpr float AInput12Module_MAX_VOLTAGE  = 10.0;
static constexpr float 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 *air);

EmodRet AInput12Module_init(AInput12Module_t *air, const AInput12ModuleCallback_Type* callback_func, void* callback_context);

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

// Callback methods
EmodRet AInput12Module_configEventAtTimeInterval(AInput12Module_t *air, const uint16_t time_interval, const uint32_t event_mask);
EmodRet AInput12Module_configEventOnValueChange(AInput12Module_t *air, const uint32_t threshold, const uint32_t event_mask);
EmodRet AInput12Module_configEventWithinRange(AInput12Module_t *air, const uint32_t low_limit, const uint32_t high_limit, const uint32_t event_mask);
EmodRet AInput12Module_configEventOutOfRange(AInput12Module_t *air, const uint32_t low_limit, const uint32_t high_limit, const uint32_t event_mask);
EmodRet AInput12Module_resetEventConfiguration(AInput12Module_t *air);
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_