thermferm/thermferm.h

changeset 158
f1b7e2ef90be
parent 157
259a018758f9
child 162
6fc9e3f7962f
--- a/thermferm/thermferm.h	Thu Jul 31 13:43:09 2014 +0200
+++ b/thermferm/thermferm.h	Thu Jul 31 17:44:50 2014 +0200
@@ -135,6 +135,46 @@
 #define	PROFILE_RUN		2		/* Profile is running		*/
 #define	PROFILE_DONE		3		/* Profile is finished		*/
 
+/*
+ * External devices like sensors, relays.
+ */
+typedef struct _dev_list {
+    struct _dev_list	*next;
+    int			version;		/* Version 1			*/
+    char		*uuid;			/* UUID of this device		*/
+    int			type;			/* Device type			*/
+    int			direction;		/* Device direction		*/
+    int			value;			/* Device value			*/
+    int			present;		/* Device present		*/
+    char		*address;		/* Device address		*/
+    int			subdevice;		/* Device sub address		*/
+    int			gpiopin;		/* Device GPIO pin or -1	*/
+    char		*description;		/* Device description		*/
+    int			inuse;			/* In use counter		*/
+    char		*comment;		/* What we think it is		*/
+    time_t		timestamp;		/* Last updated			*/
+} devices_list;
+
+#define	DEVTYPE_NA		0		/* Unknown device type		*/
+#define	DEVTYPE_W1		1		/* 1-Wire bus			*/
+#define	DEVTYPE_GPIO		2		/* GPIO I/O device		*/
+#define	DEVTYPE_RC433		3		/* 433 MHz device		*/
+#define	DEVTYPE_DHT		4		/* DHT type device on GPIO	*/
+#define	DEVTYPE_I2C		5		/* I2C bus device		*/
+#define	DEVTYPE_SPI		6		/* SPI bus device		*/
+
+#define	DEVPRESENT_UNDEF	0		/* Precence not testable	*/
+#define	DEVPRESENT_NO		1		/* Device is missing		*/
+#define	DEVPRESENT_YES		2		/* Device is detected		*/
+#define	DEVPRESENT_ERROR	3		/* Device is in error		*/
+
+#define	DEVDIR_UNDEF		0		/* Undefined			*/
+#define	DEVDIR_IN_BIN		1		/* Binary input			*/
+#define	DEVDIR_OUT_BIN		2		/* Binary output		*/
+#define	DEVDIR_IN_ANALOG	3		/* Temperature input etc.	*/
+#define	DEVDIR_OUT_ANALOG	4		/* Analog steering		*/
+#define	DEVDIR_OUT_PWM		5		/* PWM outout			*/
+
 
 typedef struct _w1_therm {
     struct _w1_therm    *next;
@@ -162,6 +202,7 @@
 #endif
     units_list		*units;			/* Fermenter units		*/
     profiles_list	*profiles;		/* Ferment profiles		*/
+    devices_list	*devices;		/* Sensors and switches		*/
 } sys_config;
 
 

mercurial