LightHub
4.6.0
Open-source smart home controller firmware
Toggle main menu visibility
Loading...
Searching...
No Matches
statusled.h
Go to the documentation of this file.
1
/* Copyright © 2017-2018 Andrey Klimov. All rights reserved.
2
3
Licensed under the Apache License, Version 2.0 (the "License");
4
you may not use this file except in compliance with the License.
5
You may obtain a copy of the License at
6
7
http://www.apache.org/licenses/LICENSE-2.0
8
9
Unless required by applicable law or agreed to in writing, software
10
distributed under the License is distributed on an "AS IS" BASIS,
11
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
See the License for the specific language governing permissions and
13
limitations under the License.
14
15
Homepage: http://lazyhome.ru
16
GIT: https://github.com/anklimov/lighthub
17
e-mail anklimov@gmail.com
18
19
*/
20
#pragma once
21
#include <Arduino.h>
22
24
#define ledRED 1
26
#define ledGREEN 2
28
#define ledBLUE 4
30
#define ledBLINK 8
32
#define ledFASTBLINK 16
34
#define ledParams (ledRED | ledGREEN | ledBLUE | ledBLINK | ledFASTBLINK)
35
37
#define ledFlash 32
39
#define ledHidden 64
40
41
#if defined(ARDUINO_ARCH_AVR)
42
#define pinRED 47
43
#define pinGREEN 48
44
#define pinBLUE 49
45
#else
46
// Due: RGB status LED on pins 50-52
47
#define pinRED 50
48
#define pinGREEN 51
49
#define pinBLUE 52
50
#endif
51
53
#define ledDelayms 1000UL
55
#define ledFastDelayms 300UL
56
64
class
StatusLED
{
65
public
:
70
StatusLED
(uint8_t pattern = 0);
75
void
set
(uint8_t pattern);
80
void
show
(uint8_t pattern);
84
void
poll
();
89
void
flash
(uint8_t pattern);
90
private
:
92
uint8_t curStat;
94
uint32_t timestamp;
95
};
StatusLED::set
void set(uint8_t pattern)
Sets the steady/blinking LED pattern.
Definition
statusled.cpp:45
StatusLED::poll
void poll()
Advances blink/flash timing; call from the main loop.
Definition
statusled.cpp:67
StatusLED::flash
void flash(uint8_t pattern)
Shows the given pattern once (single flash).
Definition
statusled.cpp:59
StatusLED::StatusLED
StatusLED(uint8_t pattern=0)
Initializes the LED pins and sets the initial pattern.
Definition
statusled.cpp:25
StatusLED::show
void show(uint8_t pattern)
Immediately drives the pins to the given color (no state change).
Definition
statusled.cpp:36
lighthub
statusled.h
Generated by
1.18.0