Documentation
¶
Index ¶
- Constants
- type AInput7Relay2Module
- func (air *AInput7Relay2Module) Activate(relay_mask byte) error
- func (air *AInput7Relay2Module) ActivateAll() error
- func (air *AInput7Relay2Module) ConfigEventAtTimeInterval(time_interval time.Duration, event_mask uint16) error
- func (air *AInput7Relay2Module) ConfigEventOnValueChange(threshold uint32, event_mask uint16) error
- func (air *AInput7Relay2Module) ConfigEventOutOfRange(low_limit uint32, high_limit uint32, event_mask uint16) error
- func (air *AInput7Relay2Module) ConfigEventWithinRange(low_limit uint32, high_limit uint32, event_mask uint16) error
- func (air *AInput7Relay2Module) ConfigInput(input_mask uint16) error
- func (air *AInput7Relay2Module) ConfigPulseWidth(relay_mask byte, width_ms uint32) error
- func (air *AInput7Relay2Module) ConfigSampleRate(ms_period uint32) error
- func (air *AInput7Relay2Module) CurrentToSamples(current float32) uint16
- func (air *AInput7Relay2Module) Deactivate(relay_mask byte) error
- func (air *AInput7Relay2Module) DeactivateAll() error
- func (air *AInput7Relay2Module) Destroy()
- func (air *AInput7Relay2Module) GetAllAnalogInput() ([NUMBER_OF_AI_INPUTS]float32, error)
- func (air *AInput7Relay2Module) GetAllRelayStatus() (byte, error)
- func (air *AInput7Relay2Module) GetAnalogInput(input_mask uint16) (float32, error)
- func (air *AInput7Relay2Module) GetInputConfig() (uint16, error)
- func (air *AInput7Relay2Module) GetRelayStatus(relay_mask byte) (byte, error)
- func (air *AInput7Relay2Module) Init(cb AInput7Relay2Module_callback_func, cb_ctx interface{}) error
- func (air *AInput7Relay2Module) InitModuleNumber(cb AInput7Relay2Module_callback_func, cb_ctx interface{}, module_number uint8) error
- func (air *AInput7Relay2Module) ResetEventConfiguration() error
- func (air *AInput7Relay2Module) SamplesToCurrent(samples uint16) float32
- func (air *AInput7Relay2Module) SamplesToVoltage(samples uint16) float32
- func (air *AInput7Relay2Module) VoltageToSamples(voltage float32) uint16
- type AInput7Relay2Module_callback_func
Constants ¶
const ( INPUT01 uint16 = uint16(C.AInput7Relay2Module_INPUT01) INPUT02 uint16 = uint16(C.AInput7Relay2Module_INPUT02) INPUT03 uint16 = uint16(C.AInput7Relay2Module_INPUT03) INPUT04 uint16 = uint16(C.AInput7Relay2Module_INPUT04) INPUT05 uint16 = uint16(C.AInput7Relay2Module_INPUT05) INPUT06 uint16 = uint16(C.AInput7Relay2Module_INPUT06) INPUT07 uint16 = uint16(C.AInput7Relay2Module_INPUT07) ALL_INPUT uint16 = uint16(C.AInput7Relay2Module_ALL_INPUT) )
const ( RELAY1 byte = byte(C.AInput7Relay2Module_RELAY1) RELAY2 byte = byte(C.AInput7Relay2Module_RELAY2) ALL_RELAY byte = byte(C.AInput7Relay2Module_ALL_RELAY) )
const ( NUMBER_OF_AI_INPUTS uint8 = uint8(C.AInput7Relay2Module_NUMBER_OF_AI_INPUTS) NUMBER_OF_RELAYS uint8 = uint8(C.AInput7Relay2Module_NUMBER_OF_RELAYS) )
const ( IdFunctionINPUT01 uint8 = uint8(C.AInput7Relay2Module_idFunctionINPUT01) IdFunctionINPUT02 uint8 = uint8(C.AInput7Relay2Module_idFunctionINPUT02) IdFunctionINPUT03 uint8 = uint8(C.AInput7Relay2Module_idFunctionINPUT03) IdFunctionINPUT04 uint8 = uint8(C.AInput7Relay2Module_idFunctionINPUT04) IdFunctionINPUT05 uint8 = uint8(C.AInput7Relay2Module_idFunctionINPUT05) IdFunctionINPUT06 uint8 = uint8(C.AInput7Relay2Module_idFunctionINPUT06) IdFunctionINPUT07 uint8 = uint8(C.AInput7Relay2Module_idFunctionINPUT07) )
const ( MAX_ADC uint16 = uint16(C.AInput7Relay2Module_MAX_ADC) MAX_VOLTAGE float32 = float32(C.AInput7Relay2Module_MAX_VOLTAGE) MAX_CURRENT float32 = float32(C.AInput7Relay2Module_MAX_CURRENT) )
const ( CFG_VOLTAGE byte = byte(C.AInput7Relay2Module_CFG_VOLTAGE) CFG_CURRENT byte = byte(C.AInput7Relay2Module_CFG_CURRENT) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AInput7Relay2Module ¶
type AInput7Relay2Module struct {
// contains filtered or unexported fields
}
This class represents the Analogue Inputs and Power Relays Module connected via eMOD bus to controller module. On the one hand, this module has 7 independent analogue inputs, the value of each one can be obtained separately. Its configuration for measuring voltage or current can be set also separately. And on the other hand, has 2 independent power relays than can be activated or deactivated separately. If polling is to be performed more than once per second, it's recommended set a callback instead.
func NewAInput7Relay2Module ¶
func NewAInput7Relay2Module() *AInput7Relay2Module
Allocates internal memory and returns an instance of the module
func (*AInput7Relay2Module) Activate ¶
func (air *AInput7Relay2Module) Activate(relay_mask byte) error
Activates a relay or set of relays.
func (*AInput7Relay2Module) ActivateAll ¶
func (air *AInput7Relay2Module) ActivateAll() error
Activates all module relays.
func (*AInput7Relay2Module) ConfigEventAtTimeInterval ¶
func (air *AInput7Relay2Module) ConfigEventAtTimeInterval(time_interval time.Duration, event_mask uint16) error
Configures module for calling init callback_func at specified period.
func (*AInput7Relay2Module) ConfigEventOnValueChange ¶
func (air *AInput7Relay2Module) ConfigEventOnValueChange(threshold uint32, event_mask uint16) error
Configures module for calling Init callback func when input changes its value by a specified amount.
func (*AInput7Relay2Module) ConfigEventOutOfRange ¶
func (air *AInput7Relay2Module) ConfigEventOutOfRange(low_limit uint32, high_limit uint32, event_mask uint16) error
Configures module for calling init callback_func when input value gets out of the specified range. The high and low limits of the range are in samples, so use the VoltageToSample or CurrentToSample methods.
func (*AInput7Relay2Module) ConfigEventWithinRange ¶
func (air *AInput7Relay2Module) ConfigEventWithinRange(low_limit uint32, high_limit uint32, event_mask uint16) error
Configures module for calling Init callback func when input value enters the specified range. The high and low limits of the range are in samples, so use the VoltageToSample or CurrentToSample methods.
func (*AInput7Relay2Module) ConfigInput ¶
func (air *AInput7Relay2Module) ConfigInput(input_mask uint16) error
Configure an input or set of inputs to select them for acquiring current (4 to 20 mA) or voltage (0 to 10 V).
func (*AInput7Relay2Module) ConfigPulseWidth ¶
func (air *AInput7Relay2Module) ConfigPulseWidth(relay_mask byte, width_ms uint32) error
Configure pulse width of a relay o list of relays. When pulse width is 0 a relay stays in the current state, and there is no pulse.
func (*AInput7Relay2Module) ConfigSampleRate ¶
func (air *AInput7Relay2Module) ConfigSampleRate(ms_period uint32) error
Configure sample rate at which you want to check the analog input data.
func (*AInput7Relay2Module) CurrentToSamples ¶
func (air *AInput7Relay2Module) CurrentToSamples(current float32) uint16
Converts current to discrete samples.
func (*AInput7Relay2Module) Deactivate ¶
func (air *AInput7Relay2Module) Deactivate(relay_mask byte) error
Deactivates a relay or set of relays.
func (*AInput7Relay2Module) DeactivateAll ¶
func (air *AInput7Relay2Module) DeactivateAll() error
Deactivates all module relays.
func (*AInput7Relay2Module) Destroy ¶
func (air *AInput7Relay2Module) Destroy()
Free the internal memory of the module. The instance can't be used anymore after that.
func (*AInput7Relay2Module) GetAllAnalogInput ¶
func (air *AInput7Relay2Module) GetAllAnalogInput() ([NUMBER_OF_AI_INPUTS]float32, error)
Gets last measured values for all analog inputs.
func (*AInput7Relay2Module) GetAllRelayStatus ¶
func (air *AInput7Relay2Module) GetAllRelayStatus() (byte, error)
Gets all relay status.
func (*AInput7Relay2Module) GetAnalogInput ¶
func (air *AInput7Relay2Module) GetAnalogInput(input_mask uint16) (float32, error)
Gets last measured value of a specified analog input.
func (*AInput7Relay2Module) GetInputConfig ¶
func (air *AInput7Relay2Module) GetInputConfig() (uint16, error)
Gets configured inputs mask. Each input indicates if it’s configured to acquire voltage (0) or current (1).
func (*AInput7Relay2Module) GetRelayStatus ¶
func (air *AInput7Relay2Module) GetRelayStatus(relay_mask byte) (byte, error)
Gets a relay status.
func (*AInput7Relay2Module) Init ¶
func (air *AInput7Relay2Module) Init(cb AInput7Relay2Module_callback_func, cb_ctx interface{}) error
Initialize module. It is important to emphasize that this method is mandatory to be called and must be called always after instantiating the module. It can be called several times, each of which the module is initialized again. The callback function only will be called with the context if the module is later configured in callback mode.
func (*AInput7Relay2Module) InitModuleNumber ¶
func (air *AInput7Relay2Module) InitModuleNumber(cb AInput7Relay2Module_callback_func, cb_ctx interface{}, module_number uint8) error
Same as Init(), but allows to initialize a specific module number instead of the first one.
func (*AInput7Relay2Module) ResetEventConfiguration ¶
func (air *AInput7Relay2Module) ResetEventConfiguration() error
Resets all previously configured events.
func (*AInput7Relay2Module) SamplesToCurrent ¶
func (air *AInput7Relay2Module) SamplesToCurrent(samples uint16) float32
Converts discrete samples to current.
func (*AInput7Relay2Module) SamplesToVoltage ¶
func (air *AInput7Relay2Module) SamplesToVoltage(samples uint16) float32
Converts discrete samples to voltage.
func (*AInput7Relay2Module) VoltageToSamples ¶
func (air *AInput7Relay2Module) VoltageToSamples(voltage float32) uint16
Converts voltage to discrete samples.