API to control EISmultiplexer devices.
More...
|
| 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
} |
| |
|
| 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) |
| |
API to control EISmultiplexer devices.
This API allows you to control the EISmultiplexer device.
◆ eismultiplexer_connect()
| int eismultiplexer_connect |
( |
struct eismultiplexer * |
muliplexer, |
|
|
uint16_t |
serial |
|
) |
| |
Attempts to connect to a EISmultiplexer device and initializes a eismultiplexer struct.
- Parameters
-
| multiplexer | pointer to a eismultiplexer struct to initialize |
| serial | The 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
-
| multiplexer | pointer to a eismultiplexer struct |
| channel | A 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
-
| multiplexer | pointer to a eismultiplexer struct |
| channel | A 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
-
| multiplexer | pointer to a eismultiplexer struct |
| channel | A 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
-
| multiplexer | pointer to an eismultiplexer struct |
| count | a 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
-
| multiplexer | pointer 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
-
| multiplexer | pointer to a eismultiplexer struct |
| index | the index of the trigger |
| state | a pointer where the current state of the trigger will be stored, can be NULL |
| level | a 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
-
| count | The 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
-
| multiplexer | pointer to a eismultiplexer struct |
| on | true 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
-
| multiplexer | pointer to a eismultiplexer struct |
| state | state to put the trigger in |
| index | the 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
-
| multiplexer | pointer to a eismultiplexer struct |
| index | the index of the trigger |
| wait | wait type |
| timeout | maximum time in milliseconds to wait |
- Returns
- 0 on success and < 0 on failure