27 lines
555 B
C++
27 lines
555 B
C++
#ifndef JANITZA104_ESP32_LED_H_
|
|
#define JANITZA104_ESP32_LED_H_
|
|
|
|
#include <Arduino.h>
|
|
#include <stdint.h>
|
|
|
|
class Led {
|
|
private:
|
|
uint8_t _pin;
|
|
|
|
public:
|
|
explicit Led(uint8_t pin) : _pin(pin) {
|
|
pinMode(_pin, OUTPUT);
|
|
off();
|
|
}
|
|
|
|
inline void off() const { digitalWrite(_pin, HIGH); }
|
|
inline void on() const { digitalWrite(_pin, LOW); }
|
|
|
|
void on_off(uint16_t delay_ms, bool last_delay = false) const;
|
|
void blink(uint8_t count, uint16_t delay_ms) const;
|
|
};
|
|
|
|
extern const Led* mcu_led;
|
|
|
|
#endif //JANITZA104_ESP32_LED_H_
|