Added lock

This commit is contained in:
2024-04-13 12:27:58 +03:00
parent 57ab8bda6a
commit 8449ca098e
2 changed files with 22 additions and 0 deletions

View File

@@ -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)
{

View File

@@ -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 ****/