libeismultiplexer 1.6.2
Data Structures | Enumerations | Functions
User API

API to control EISmultiplexer devices. More...

Data Structures

struct  eismultiplexer
 

Enumerations

enum  channel_t {
  CHANNEL_A = (1 << 0) , CHANNEL_B = (1 << 1) , CHANNEL_C = (1 << 2) , CHANNEL_D = (1 << 3) ,
  CHANNEL_E = (1 << 4) , CHANNEL_F = (1 << 5) , CHANNEL_G = (1 << 6) , CHANNEL_H = (1 << 7) ,
  CHANNEL_NONE = 0
}
 
enum  trigger_state_t { TRIGGER_INPUT = 0 , TRIGGER_LOW , TRIGGER_HIGH , TRIGGER_STATE_COUNT }
 
enum  trigger_wait_t {
  TRIGGER_WAIT_LOW = 0 , TRIGGER_WAIT_HIGH , TRIGGER_WAIT_EDGE , TRIGGER_WAIT_LOW_LEVEL ,
  TRIGGER_WAIT_HIGH_LEVEL
}
 

Functions

uint16_t * eismultiplexer_list_available_devices (size_t *count)
 Lists the available eismultiplexer devices.
 
int eismultiplexer_connect (struct eismultiplexer *muliplexer, uint16_t serial)
 Attempts to connect to a EISmultiplexer device and initializes a eismultiplexer struct.
 
int eismultiplexer_connect_channel (struct eismultiplexer *muliplexer, channel_t channel)
 Connects the given channel(s) to the common inputs.
 
int eismultiplexer_connect_channel_exclusive (struct eismultiplexer *muliplexer, channel_t channel)
 Connects the given channel(s) to the common inputs disconnecting all others.
 
int eismultiplexer_disconnect_channel (struct eismultiplexer *muliplexer, channel_t channel)
 Disconnect the given channel(s) to the common inputs disconnecting all others.
 
channel_t eismultiplexer_get_connected (struct eismultiplexer *muliplexer)
 Returns the channels currently connected.
 
int eismultiplexer_set_led (struct eismultiplexer *muliplexer, bool on)
 Turns the led on the PCB on or off.
 
int eismultiplexer_set_trigger_state (struct eismultiplexer *muliplexer, uint16_t index, trigger_state_t state)
 Sets the state of the trigger pin.
 
int eismultiplexer_get_trigger_state (struct eismultiplexer *muliplexer, uint16_t index, trigger_state_t *state, bool *level)
 Gets the logic level and state of the trigger pin.
 
int eismultiplexer_wait_trigger (struct eismultiplexer *muliplexer, uint16_t index, trigger_wait_t wait, uint64_t timeout)
 Sets the state of the trigger pin.
 
int eismultiplexer_get_trigger_count (struct eismultiplexer *muliplexer)
 gets the nummber of trigger pins available on the device
 
int eismultiplexer_get_channel_count (struct eismultiplexer *muliplexer, uint16_t *count)
 Gets the number of channels on the device.
 
void eismultiplexer_disconnect (struct eismultiplexer *muliplexer)
 Disconnects from the eismultiplexer.
 
int eismultiplexer_write_eeprom (struct eismultiplexer *muliplexer, uint16_t addr, uint16_t value)
 
uint16_t eismultiplexer_read_eeprom (struct eismultiplexer *muliplexer, uint16_t addr)
 

Detailed Description

API to control EISmultiplexer devices.

This API allows you to control the EISmultiplexer device.

Function Documentation

◆ eismultiplexer_connect()

int eismultiplexer_connect ( struct eismultiplexer muliplexer,
uint16_t  serial 
)

Attempts to connect to a EISmultiplexer device and initializes a eismultiplexer struct.

Parameters
multiplexerpointer to a eismultiplexer struct to initialize
serialThe serial number of the device to connect to, or 0 for any
Returns
0 on success and < 0 on failure

◆ eismultiplexer_connect_channel()

int eismultiplexer_connect_channel ( struct eismultiplexer muliplexer,
channel_t  channel 
)

Connects the given channel(s) to the common inputs.

Parameters
multiplexerpointer to a eismultiplexer struct
channelA channel to connect, multiple channels can be specified by or'ing together the channel flags e.g. (CHANNEL_A | CHANNEL_B)
Returns
0 on success and < 0 on failure

◆ eismultiplexer_connect_channel_exclusive()

int eismultiplexer_connect_channel_exclusive ( struct eismultiplexer muliplexer,
channel_t  channel 
)

Connects the given channel(s) to the common inputs disconnecting all others.

Parameters
multiplexerpointer to a eismultiplexer struct
channelA channel to connect, multiple channels can be specified by or'ing together the channel flags e.g. (CHANNEL_A | CHANNEL_B)
Returns
0 on success and < 0 on failure

◆ eismultiplexer_disconnect_channel()

int eismultiplexer_disconnect_channel ( struct eismultiplexer muliplexer,
channel_t  channel 
)

Disconnect the given channel(s) to the common inputs disconnecting all others.

Parameters
multiplexerpointer to a eismultiplexer struct
channelA channel to connect, multiple channels can be specified by or'ing together the channel flags e.g. (CHANNEL_A | CHANNEL_B) All channels can be disconnected by passing CHANNEL_NONE
Returns
0 on success and < 0 on failure

◆ eismultiplexer_get_channel_count()

int eismultiplexer_get_channel_count ( struct eismultiplexer muliplexer,
uint16_t *  count 
)

Gets the number of channels on the device.

Parameters
multiplexerpointer to an eismultiplexer struct
counta pointer where the nummber of channels will be stored.
Returns
0 on success and < 0 on failure

◆ eismultiplexer_get_connected()

channel_t eismultiplexer_get_connected ( struct eismultiplexer muliplexer)

Returns the channels currently connected.

Parameters
multiplexerpointer to a eismultiplexer struct
Returns
channels connected as a bitfield

◆ eismultiplexer_get_trigger_count()

int eismultiplexer_get_trigger_count ( struct eismultiplexer muliplexer)

gets the nummber of trigger pins available on the device

Returns
the nummber of trigger pins on success and < 0 on failure

◆ eismultiplexer_get_trigger_state()

int eismultiplexer_get_trigger_state ( struct eismultiplexer muliplexer,
uint16_t  index,
trigger_state_t *  state,
bool *  level 
)

Gets the logic level and state of the trigger pin.

Parameters
multiplexerpointer to a eismultiplexer struct
indexthe index of the trigger
statea pointer where the current state of the trigger will be stored, can be NULL
levela pointer where the current logic level of the trigger will be stored, only relevant if state is TRIGGER_INPUT, can be NULL
Returns
0 on success and < 0 on failure

◆ eismultiplexer_list_available_devices()

uint16_t * eismultiplexer_list_available_devices ( size_t *  count)

Lists the available eismultiplexer devices.

Parameters
countThe number of available eismultiplexer devices
Returns
An newly allocated array of length count with the serial numbers of the available devices to be freed by the user with free()

◆ eismultiplexer_set_led()

int eismultiplexer_set_led ( struct eismultiplexer muliplexer,
bool  on 
)

Turns the led on the PCB on or off.

Parameters
multiplexerpointer to a eismultiplexer struct
ontrue to turn the led on, false to turn it off
Returns
0 on success and < 0 on failure

◆ eismultiplexer_set_trigger_state()

int eismultiplexer_set_trigger_state ( struct eismultiplexer muliplexer,
uint16_t  index,
trigger_state_t  state 
)

Sets the state of the trigger pin.

Parameters
multiplexerpointer to a eismultiplexer struct
statestate to put the trigger in
indexthe index of the trigger to set
Returns
0 on success and < 0 on failure

◆ eismultiplexer_wait_trigger()

int eismultiplexer_wait_trigger ( struct eismultiplexer muliplexer,
uint16_t  index,
trigger_wait_t  wait,
uint64_t  timeout 
)

Sets the state of the trigger pin.

Parameters
multiplexerpointer to a eismultiplexer struct
indexthe index of the trigger
waitwait type
timeoutmaximum time in milliseconds to wait
Returns
0 on success and < 0 on failure