main/task_apds9930.h

changeset 12
bb72d448e282
child 37
50dbb626fbab
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/task_apds9930.h	Mon Apr 03 16:07:34 2023 +0200
@@ -0,0 +1,55 @@
+/**
+ * @file task_apds9930.h
+ * @brief The FreeRTOS task to query the APDS9930 sensor connected to
+ *        the I2C bus.
+ *        The task will update the sensor state structures.
+ */
+
+#ifndef	_TASK_APDS9930_H
+#define	_TASK_APDS9930_H
+
+/*
+ * Error codes in this task
+ */
+#define	APDS9930_ERR_NONE			0	///< No errors
+#define APDS9930_ERR_READ			1
+
+
+
+/**
+ * @brief Structure containing the variables for the APDS9930 task.
+ */
+typedef struct {
+    bool		valid;			///< Valid measurement
+    bool		fake;			///< Fake measurement
+    uint8_t		address;		///< Device i2c address
+    float		ambient_light;		///< Kind of Lux.
+    uint8_t		gain;			///< APDS9930 last gain setting
+    uint8_t		aglbit;			///< APDS9930 ALS Gain Level bit
+    int			error;			///< Error result
+} APDS9930_State;
+
+
+
+/**
+ * @brief Request a new measurement from the APDS9930.
+ */
+void request_apds9930(void);
+
+
+/**
+ * @brief Check if results are ready
+ * @return true of results are ready, else false.
+ */
+bool ready_apds9930(void);
+
+
+/**
+ * @brief The FreeRTOS task to update the APDS9930 on request.
+ * @param pvParameters Parameters for the task.
+ */
+void task_apds9930(void *pvParameters);
+
+
+#endif
+

mercurial