]> git.zerfleddert.de Git - fnordlicht-mini/blob - firmware/fnordlicht-firmware/remote.h
65354893a6bd4f8f62516174e3fd89568a8ae4a4
[fnordlicht-mini] / firmware / fnordlicht-firmware / remote.h
1 /* vim:ts=4 sts=4 et tw=80
2 *
3 * fnordlicht firmware
4 *
5 * for additional information please
6 * see http://lochraster.org/fnordlichtmini
7 *
8 * (c) by Alexander Neumann <alexander@bumpern.de>
9 *
10 * This program is free software: you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 3 as published by
12 * the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23 #ifndef __REMOTE_H
24 #define __REMOTE_H
25
26 #include <stdint.h>
27 #include <stdbool.h>
28 #include "color.h"
29
30 struct remote_offsets_t
31 {
32 int8_t step;
33 int8_t delay;
34 int16_t hue;
35 uint8_t saturation;
36 uint8_t value;
37 };
38
39 struct global_remote_t {
40 uint8_t address;
41 struct remote_offsets_t offsets;
42
43 #if CONFIG_MASTER_MODE
44 /* master mode */
45 bool master;
46 #endif
47 };
48
49 extern struct global_remote_t global_remote;
50
51 /* we depend on serial uart */
52 #if !CONFIG_SERIAL || !CONFIG_REMOTE
53
54 #define remote_init(...)
55 #define remote_poll(...)
56 #define remote_address(...) 0
57
58 #define remote_apply_offset(x, ...) x
59 #define remote_apply_hsv_offset(x, ...) x
60
61 #define remote_pull_int(...)
62 #define remote_release_int(...)
63
64 #else
65
66 void remote_init(void);
67 void remote_poll(void);
68 #define remote_address() (global_remote.address)
69
70 void remote_pull_int(void);
71 void remote_release_int(void);
72
73 /* offset helper functions */
74 uint8_t remote_apply_offset(uint8_t value, int8_t offset);
75 void remote_apply_hsv_offset(struct hsv_color_t *color);
76
77 #endif
78 #endif
Impressum, Datenschutz