OpenDTU-old/include/Led_Single.h
Thomas Basler 9ae791edd4 Feature: Added ability to change the brightness of the LEDs
Based on the idea of @moritzlerch with several modifications like pwmTable and structure
2023-12-07 12:46:38 +01:00

39 lines
736 B
C++

// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "PinMapping.h"
#include <TaskSchedulerDeclarations.h>
#include <TimeoutHelper.h>
#define LEDSINGLE_UPDATE_INTERVAL 2000
class LedSingleClass {
public:
LedSingleClass();
void init(Scheduler* scheduler);
void turnAllOff();
void turnAllOn();
private:
void setLoop();
void outputLoop();
void setLed(uint8_t ledNo, bool ledState);
Task _setTask;
Task _outputTask;
enum class LedState_t {
On,
Off,
Blink,
};
LedState_t _ledMode[PINMAPPING_LED_COUNT];
LedState_t _allMode;
bool _ledStateCurrent[PINMAPPING_LED_COUNT];
TimeoutHelper _blinkTimeout;
};
extern LedSingleClass LedSingle;