feat-hal-2 #4

Merged
andis merged 35 commits from feat-hal-2 into develop 2024-07-31 16:15:36 +00:00
2 changed files with 22 additions and 0 deletions
Showing only changes of commit 8449ca098e - Show all commits

View File

@@ -30,6 +30,9 @@ hw::DisplayLed::DisplayLed(bsp::DigitalOut* led0, bsp::DigitalOut* led1, bsp::Di
this->led4->write(0); this->led4->write(0);
this->led5->write(0); this->led5->write(0);
this->common->write(0); this->common->write(0);
this->lock_counter = 0;
this->locked = 1;
} }
hw::DisplayLed::~DisplayLed(void) hw::DisplayLed::~DisplayLed(void)
@@ -91,6 +94,18 @@ void hw::DisplayLed::set_brigthness(uint8_t percent)
this->common->write(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 ****/ /**** Private function definitions ****/
static uint8_t img_gen_dot10(uint8_t percent) static uint8_t img_gen_dot10(uint8_t percent)
{ {

View File

@@ -21,6 +21,8 @@ class DisplayLed
bsp::DigitalOut* led5; bsp::DigitalOut* led5;
bsp::PWMout* common; bsp::PWMout* common;
uint16_t lock_counter;
public: public:
typedef enum { typedef enum {
LED_DSP_DOT20, LED_DSP_DOT20,
@@ -35,6 +37,11 @@ class DisplayLed
void write(uint8_t image); void write(uint8_t image);
void set_brigthness(uint8_t percent); void set_brigthness(uint8_t percent);
void set_lock(uint16_t timeout);
void process_timer(void);
uint8_t locked;
}; };
/**** Public function declarations ****/ /**** Public function declarations ****/