Add trigger functionality
Some checks failed
Build eismuliplexer for windows / Build (push) Has been cancelled
Build eismuliplexer for linux / Build (push) Has been cancelled
Some checks failed
Build eismuliplexer for windows / Build (push) Has been cancelled
Build eismuliplexer for linux / Build (push) Has been cancelled
This commit is contained in:
parent
5c42094b06
commit
ba13899644
3 changed files with 197 additions and 2 deletions
|
|
@ -54,6 +54,23 @@ typedef enum {
|
|||
CHANNEL_NONE = 0,
|
||||
} channel_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TRIGGER_INPUT = 0, /*** Trigger is high impedance and set as an input*/
|
||||
TRIGGER_LOW, /*** Trigger output is logic low*/
|
||||
TRIGGER_HIGH, /*** Trigger output is logic high*/
|
||||
TRIGGER_STATE_COUNT
|
||||
} trigger_state_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
TRIGGER_WAIT_LOW = 0, /*** Waits until the trigger falls from high to low*/
|
||||
TRIGGER_WAIT_HIGH, /*** Waits until the trigger rises from low to high*/
|
||||
TRIGGER_WAIT_EDGE, /*** Waits until the trigger changes from low to high or high to low*/
|
||||
TRIGGER_WAIT_LOW_LEVEL, /*** Waits until the trigger is low*/
|
||||
TRIGGER_WAIT_HIGH_LEVEL /*** Waits until the trigger is high*/
|
||||
} trigger_wait_t;
|
||||
|
||||
struct eismultiplexer {
|
||||
struct usbshm* priv;
|
||||
};
|
||||
|
|
@ -113,6 +130,41 @@ channel_t eismultiplexer_get_connected(struct eismultiplexer* muliplexer);
|
|||
*/
|
||||
int eismultiplexer_set_led(struct eismultiplexer* muliplexer, bool on);
|
||||
|
||||
/**
|
||||
* @brief Sets the state of the trigger pin
|
||||
* @param multiplexer pointer to a eismultiplexer struct
|
||||
* @param state state to put the trigger in
|
||||
* @param index the index of the trigger to set
|
||||
* @return 0 on success and < 0 on failure
|
||||
*/
|
||||
int eismultiplexer_set_trigger_state(struct eismultiplexer* muliplexer, uint16_t index, trigger_state_t state);
|
||||
|
||||
/**
|
||||
* @brief Gets the logic level and state of the trigger pin
|
||||
* @param multiplexer pointer to a eismultiplexer struct
|
||||
* @param index the index of the trigger
|
||||
* @param state a pointer where the current state of the trigger will be stored, can be NULL
|
||||
* @param level a pointer where the current logic level of the trigger will be stored, only relevant if state is TRIGGER_INPUT, can be NULL
|
||||
* @return 0 on success and < 0 on failure
|
||||
*/
|
||||
int eismultiplexer_get_trigger_state(struct eismultiplexer* muliplexer, uint16_t index, trigger_state_t* state, bool* level);
|
||||
|
||||
/**
|
||||
* @brief Sets the state of the trigger pin
|
||||
* @param multiplexer pointer to a eismultiplexer struct
|
||||
* @param index the index of the trigger
|
||||
* @param wait wait type
|
||||
* @param timeout maximum time in milliseconds to wait
|
||||
* @return 0 on success and < 0 on failure
|
||||
*/
|
||||
int eismultiplexer_wait_trigger(struct eismultiplexer* muliplexer, uint16_t index, trigger_wait_t wait, uint64_t timeout);
|
||||
|
||||
/**
|
||||
* @brief gets the nummber of trigger pins available on the device
|
||||
* @return the nummber of trigger pins on success and < 0 on failure
|
||||
*/
|
||||
int eismultiplexer_get_trigger_count(struct eismultiplexer* muliplexer);
|
||||
|
||||
/**
|
||||
* @brief Gets the number of channels on the device
|
||||
* @param multiplexer pointer to an eismultiplexer struct
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue