1 #ifndef MY_DEVICES_H |
1 #ifndef MY_DEVICES_H |
2 #define MY_DEVICES_H |
2 #define MY_DEVICES_H |
3 |
3 |
|
4 |
|
5 /** |
|
6 * @brief Read one byte from a 1-wire device like a DS2413 |
|
7 * @param address The device address string |
|
8 * @param file The file in the address space |
|
9 * @return The read value or negative value if error |
|
10 */ |
4 int read_w1(char *address, char *file); |
11 int read_w1(char *address, char *file); |
5 int write_w1(char *address, char *file, uint8_t val); |
12 int write_w1(char *address, char *file, uint8_t val); |
6 |
13 |
7 int device_out(char *uuid, int value); |
14 int device_out(char *uuid, int value); |
8 int device_in(char *uuid, int *value); |
15 int device_in(char *uuid, int *value); |
9 |
16 |
|
17 /** |
|
18 * @brief Set present status |
|
19 * @param address The device address string |
|
20 * @param present The desired present value |
|
21 * @return -1 if error. 0 if ok and 1 if ok and changed. |
|
22 */ |
|
23 int device_present(char *address, int present); |
|
24 |
|
25 |
10 char *device_json(devices_list *device); |
26 char *device_json(devices_list *device); |
|
27 |
|
28 |
|
29 void devices_ws(void); |
11 |
30 |
12 int devices_detect(void); |
31 int devices_detect(void); |
13 |
32 |
14 void *my_devices_loop(void *); |
33 void *my_devices_loop(void *); |
15 |
34 |