]> git.zerfleddert.de Git - fnordlicht-mini/blob - firmware/fnordlicht-firmware/remote.h
move fixcrc to patcheeprom, add patching of node id (pretty ugly)
[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
44 extern struct global_remote_t global_remote;
45
46 /* we depend on serial uart */
47 #if !CONFIG_SERIAL || !CONFIG_REMOTE
48
49 #define remote_init(...)
50 #define remote_poll(...)
51 #define remote_address(...) 0
52
53 #define remote_apply_offset(x, ...) x
54 #define remote_apply_hsv_offset(x, ...) x
55
56 #define remote_pull_int(...)
57 #define remote_release_int(...)
58
59 #else
60
61 void remote_init(void);
62 void remote_poll(void);
63 #define remote_address() (global_remote.address)
64
65 void remote_pull_int(void);
66 void remote_release_int(void);
67
68 /* offset helper functions */
69 uint8_t remote_apply_offset(uint8_t value, int8_t offset);
70 void remote_apply_hsv_offset(struct hsv_color_t *color);
71
72 #endif
73 #endif
Impressum, Datenschutz