LightHub  v4.0.0
Smarthome controller firmware
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 
23 #define ledRED 1
24 #define ledGREEN 2
25 #define ledBLUE 4
26 #define ledBLINK 8
27 #define ledFASTBLINK 16
28 #define ledParams (ledRED | ledGREEN | ledBLUE | ledBLINK | ledFASTBLINK)
29 
30 #define ledFlash 32
31 #define ledHidden 64
32 
33 #if defined(ARDUINO_ARCH_AVR)
34 #define pinRED 47
35 #define pinGREEN 48
36 #define pinBLUE 49
37 #else
38 #define pinRED 50
39 #define pinGREEN 51
40 #define pinBLUE 52
41 #endif
42 
43 #define ledDelayms 1000UL
44 #define ledFastDelayms 300UL
45 
46 class StatusLED {
47 public:
48  StatusLED(uint8_t pattern = 0);
49  void set (uint8_t pattern);
50  void show (uint8_t pattern);
51  void poll();
52  void flash(uint8_t pattern);
53 private:
54  uint8_t curStat;
55  uint32_t timestamp;
56 };
StatusLED::flash
void flash(uint8_t pattern)
Definition: statusled.cpp:59
StatusLED::StatusLED
StatusLED(uint8_t pattern=0)
Definition: statusled.cpp:25
StatusLED::set
void set(uint8_t pattern)
Definition: statusled.cpp:45
StatusLED::poll
void poll()
Definition: statusled.cpp:67
StatusLED::show
void show(uint8_t pattern)
Definition: statusled.cpp:36
StatusLED
Definition: statusled.h:46