Added lock
This commit is contained in:
@@ -30,6 +30,9 @@ hw::DisplayLed::DisplayLed(bsp::DigitalOut* led0, bsp::DigitalOut* led1, bsp::Di
|
||||
this->led4->write(0);
|
||||
this->led5->write(0);
|
||||
this->common->write(0);
|
||||
|
||||
this->lock_counter = 0;
|
||||
this->locked = 1;
|
||||
}
|
||||
|
||||
hw::DisplayLed::~DisplayLed(void)
|
||||
@@ -91,6 +94,18 @@ void hw::DisplayLed::set_brigthness(uint8_t percent)
|
||||
this->common->write(percent);
|
||||
}
|
||||
|
||||
void hw::DisplayLed::set_lock(uint16_t timeout)
|
||||
{
|
||||
this->lock_counter = timeout;
|
||||
this->locked = 1;
|
||||
}
|
||||
|
||||
void hw::DisplayLed::process_timer(void)
|
||||
{
|
||||
if(this->lock_counter) this->lock_counter--;
|
||||
else this->locked = 0;
|
||||
}
|
||||
|
||||
/**** Private function definitions ****/
|
||||
static uint8_t img_gen_dot10(uint8_t percent)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,8 @@ class DisplayLed
|
||||
bsp::DigitalOut* led5;
|
||||
bsp::PWMout* common;
|
||||
|
||||
uint16_t lock_counter;
|
||||
|
||||
public:
|
||||
typedef enum {
|
||||
LED_DSP_DOT20,
|
||||
@@ -35,6 +37,11 @@ class DisplayLed
|
||||
void write(uint8_t image);
|
||||
|
||||
void set_brigthness(uint8_t percent);
|
||||
|
||||
void set_lock(uint16_t timeout);
|
||||
void process_timer(void);
|
||||
|
||||
uint8_t locked;
|
||||
};
|
||||
|
||||
/**** Public function declarations ****/
|
||||
|
||||
Reference in New Issue
Block a user