From 21b466dcac989474510e3e4d0b9e050a2b10480b Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Wed, 17 Nov 2021 09:57:09 +0000 Subject: [PATCH] iio.h: Protect against inclusion of Add the missing enums from and protect all of them from double-definition by wrapping them with the header's protect guards. Fixes #758. Signed-off-by: Paul Cercueil --- iio.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/iio.h b/iio.h index ccc83be84..e12c47d5b 100644 --- a/iio.h +++ b/iio.h @@ -84,6 +84,13 @@ struct iio_context_info; struct iio_scan_context; struct iio_scan_block; +/* + * header guard to protect these enums from being defined + * twice + */ +#ifndef _IIO_TYPES_H_ +#define _IIO_TYPES_H_ + /** * @enum iio_chan_type * @brief IIO channel type @@ -185,6 +192,37 @@ enum iio_modifier { IIO_MOD_O2, }; +/** + * @enum iio_event_type + * @brief IIO event type + * + * Some IIO devices can deliver events. The type of the event can be specified + * by one of the iio_event_type values. + */ +enum iio_event_type { + IIO_EV_TYPE_THRESH, + IIO_EV_TYPE_MAG, + IIO_EV_TYPE_ROC, + IIO_EV_TYPE_THRESH_ADAPTIVE, + IIO_EV_TYPE_MAG_ADAPTIVE, + IIO_EV_TYPE_CHANGE, +}; + +/** + * @enum iio_event_direction + * @brief IIO event direction + * + * When applicable, this enum specifies the direction of the iio_event_type. + */ +enum iio_event_direction { + IIO_EV_DIR_EITHER, + IIO_EV_DIR_RISING, + IIO_EV_DIR_FALLING, + IIO_EV_DIR_NONE, +}; + +#endif /* _IIO_TYPES_H_ */ + /* ---------------------------------------------------------------------------*/ /* ------------------------- Scan functions ----------------------------------*/ /** @defgroup Scan Functions for scanning available contexts