aboutsummaryrefslogtreecommitdiff
path: root/src/k8055.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/k8055.h')
-rw-r--r--src/k8055.h46
1 files changed, 30 insertions, 16 deletions
diff --git a/src/k8055.h b/src/k8055.h
index 75f379c..5154214 100644
--- a/src/k8055.h
+++ b/src/k8055.h
@@ -61,70 +61,84 @@ enum k8055_error_code {
int k8055_open_device(int port, k8055_device** device);
/** Closes the given device. */
-void k8055_close_device(k8055_device* port);
+void k8055_close_device(k8055_device* device);
/**Sets all digital ouputs according to the given bitmask.
- * @param port address of board
+ * @param device k8055 board
* @param bitmask '1' for 'on', '0' for 'off'
* @return K8055_ERROR_CLOSED if the given device is not open
* @return K8055_ERROR_WRITE if another error occurred during the write process */
-int k8055_set_all_digital(k8055_device*, int bitmask);
+int k8055_set_all_digital(k8055_device* device, int bitmask);
/**Sets a digital output at given channel.
- * @param port address of board
+ * @param device k8055 board
* @param channel channel of port
* @param value output status: '1' for 'on', '0' for 'off'
* @return K8055_ERROR_CLOSED if the given device is not open
* @return K8055_ERROR_WRITE if another error occurred during the write process */
-int k8055_set_digital(k8055_device*, int channel, int value);
+int k8055_set_digital(k8055_device* device, int channel, int value);
/**Sets the values of both analog outputs.
- * @param port address of board
+ * @param device k8055 board
* @param analog0 value of first analog output
* @param analog1 value of second analog output
* @return K8055_ERROR_CLOSED if the given device is not open
* @return K8055_ERROR_WRITE if another error occurred during the write process */
-int k8055_set_all_analog(k8055_device*, int analog0, int analog1);
+int k8055_set_all_analog(k8055_device* device, int analog0, int analog1);
/**Sets the value for an analog output at a given channel.
- * @param port address of board
+ * @param device k8055 board
* @param channel channel of analog output (zero indexed)
* @param value value of analog output [0-255]
* @return K8055_ERROR_INDEX if channel is an invalid index
* @return K8055_ERROR_CLOSED if the given device is not open
* @return K8055_ERROR_WRITE if another error occurred during the write process */
-int k8055_set_analog(k8055_device*, int channel, int value);
+int k8055_set_analog(k8055_device* device, int channel, int value);
/**Resets a hardware integrated counter of the Velleman K8055 board.
- * @param port address of board
+ * @param device k8055 board
* @param counter index of counter (zero indexed)
* @return K8055_ERROR_INDEX if counter is an invalid index
* @return K8055_ERROR_CLOSED if the given device is not open
* @return K8055_ERROR_WRITE if another error occurred during the write process */
-int k8055_reset_counter(k8055_device*, int counter);
+int k8055_reset_counter(k8055_device* device, int counter);
/**Sets the debounce time of a hardware integrated counter of the Velleman K8055 board.
- * @param port address of board
+ * @param device k8055 board
* @param counter index of counter (zero indexed)
* @param debounce debounce value
* @return K8055_ERROR_INDEX if counter is an invalid index
* @return K8055_ERROR_CLOSED if the given device is not open
* @return K8055_ERROR_WRITE if another error occurred during the write process*/
-int k8055_set_debounce_time(k8055_device*, int counter, int debounce);
+int k8055_set_debounce_time(k8055_device* device, int counter, int debounce);
/**Reads all current data of a given board into the passed parameters. NULL is a valid parameter.
* Unless quick is set, data is read twice from the board to circumvent some kind of buffer and get current data.
- * @param port address of board
- * @param digitalBitmask bitmask value of digital inputs
+ * @param device k8055 board
+ * @param digitalBitmask bitmask value of digital inputs (there are 5 digital inputs)
* @param analog0 value of first analog input
* @param analog1 value of second analog input
* @param counter0 value of first counter
* @param counter1 value of second counter
+ * @param quick if set, read data only once
* @return 0 on success
* @return K8055_ERROR_CLOSED if the given device is not open
* @return K8055_ERROR_READ if another error occurred during the read process */
-int k8055_get_all_input(k8055_device*, int *digitalBitmask, int *analog0,
+int k8055_get_all_input(k8055_device* device, int *digitalBitmask, int *analog0,
int *analog1, int *counter0, int *counter1, bool quick);
+
+/**Gets a given board's current output status. NULL is a valid parameter.
+ * Note: as the K8055's firmware does not provide any method for querying the board's output status,
+ * this library only tracks the board's status by recording any successfull data writes.
+ * Hence no guarantee can be given on the validity of the output status.
+ * @param device k8055 board
+ * @param digitalBitmask bitmask value of digital outputs (there are 8 digital outputs)
+ * @param analog0 value of first analog output
+ * @param analog1 value of second analog output
+ * @param debounce0 value of first counter's debounce time [ms]
+ * @param debounce1 value of second counter's debounce time [ms] */
+void k8055_get_all_output(k8055_device* device, int* digitalBitmask, int *analog0,
+ int *analog1, int *debounce0, int *debounce1);
#ifdef __cplusplus
}