]> rtime.felk.cvut.cz Git - hydro.git/blob - app-stefic/sensor/definitions.h
Added monitoring web system. Minor changes in regulator and in control.
[hydro.git] / app-stefic / sensor / definitions.h
1 #ifndef _DEFS_H
2 #define _DEFS_H
3
4 #include <time.h>
5 #include <lt_timer.h>
6
7 #include "hydroponie.h"
8 #include "board.h"
9
10 // CONSTANTS
11 #define ULDY_TMBUF_LEN 5
12
13 #define HEART_BUF_LEN 9
14 #define HEART_CID 1023
15 #define HEART_PERIOD 2
16
17 #define UL_DEV "/dev/ulan"
18
19 extern long sn;
20 uchar server_adr;
21 ul_msginfo msginfo;
22 int addfilt;
23
24 ul_fd_t ul_fd;
25 ul_fd_t ul_fd1;
26
27 uloi_coninfo_t uloi_coninfo_global;
28 ul_dyac_t ul_dyac_global;
29
30 #ifndef UL_WITHOUT_HANDLE
31 extern uloi_coninfo_t *coninfo;
32 extern ul_dyac_t *ul_dyac;
33 #endif
34
35 #ifdef OS_POSIX
36     typedef unsigned long mstime_t; 
37 #else
38     typedef lt_mstime_t mstime_t;
39 #endif
40
41 mstime_t led1_time, led2_time, l3time;
42
43 void long2buf(uchar *buf,unsigned long mod);
44 void int2buf(uchar *buf,int mod);
45 int buf2int(uchar *buf);
46
47 uint buf2uint(uchar *buf);
48
49 mstime_t current_time();
50 void blink(void);
51
52 int all_init(void);
53 void send_sn(void);
54 void heartbeat(void);
55 void accept_SDO(void);
56 void process_PDO(void);
57
58 uint take_cid(uchar* buf);
59 int take_len(uchar* buf);
60 int take_data(uchar* buf, int len);
61
62 char ul_save_sn(uint32_t usn);
63 char ul_save_adr(uint8_t uaddr);
64
65
66 #endif