38 lines
826 B
C++
38 lines
826 B
C++
#ifndef __LED0_H
|
|
#define __LED0_H
|
|
|
|
#ifndef __HERMIT_CRAB_H
|
|
#include "HermitCrab.h"
|
|
#endif
|
|
|
|
#define LED0_DUTY_BOOT 20
|
|
#define LED0_DUTY_CONNECTED 0
|
|
#define LED0_DUTY_CONNECTING 5
|
|
#define LED0_DUTY_SMART_CONFIG 100
|
|
#define LED0_DUTY_CLIENT 1
|
|
#define LED0_DUTY_AC 90
|
|
#define LED0_DUTY_LOAD 80
|
|
|
|
class CLED0 {
|
|
public:
|
|
void setup(uint8_t _pin, uint16_t _freq, uint16_t _channel);
|
|
void loop();
|
|
void setFreq(uint16_t _freq);
|
|
void setDuty(uint16_t _duty);
|
|
void setDuty();
|
|
inline void setAC() { bAC = true; };
|
|
inline void clearAC() { bAC = false; };
|
|
inline void setLoad() { bLoad = true; };
|
|
inline void clearLoad() { bLoad = false; };
|
|
|
|
private:
|
|
uint16_t channel;
|
|
uint16_t freq;
|
|
uint16_t duty;
|
|
uint8_t pin;
|
|
bool bPWMMode;
|
|
bool bAC, bLoad;
|
|
};
|
|
|
|
extern CLED0 led0;
|
|
#endif |