49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
//
|
|
// Created by robtor on 15.12.22.
|
|
//
|
|
|
|
#include "InitSequence.h"
|
|
|
|
namespace floatpump {
|
|
void floatpump::InitSequence::runInitSequence(bool silent, bool noBacklight) {
|
|
beeperExecute();
|
|
displayWelcome(true);
|
|
|
|
ledFlash(LED0_GPIO_Port, LED0_Pin);
|
|
ledFlash(LED1_GPIO_Port, LED1_Pin);
|
|
ledFlash(LED2_GPIO_Port, LED2_Pin);
|
|
ledFlash(LED3_GPIO_Port, LED3_Pin);
|
|
ledFlash(LED4_GPIO_Port, LED4_Pin);
|
|
ledFlash(LED5_GPIO_Port, LED5_Pin);
|
|
}
|
|
|
|
|
|
void InitSequence::ledFlash(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin) {
|
|
HAL_GPIO_WritePin(GPIOx, GPIO_Pin, GPIO_PIN_RESET);
|
|
HAL_Delay(this->flash_duration);
|
|
HAL_GPIO_WritePin(GPIOx, GPIO_Pin, GPIO_PIN_SET);
|
|
}
|
|
|
|
void InitSequence::displayWelcome(bool backlight) {
|
|
driver.LCDPower(true);
|
|
driver.LCDClearDisplay();
|
|
driver.LCDSetBacklight(backlight);
|
|
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
driver.LCDSetCursor(0, i);
|
|
driver.LCDSendCString(const_cast<char *>(welcometext[i].c_str()));
|
|
}
|
|
driver.LCDSetCursor(0, 0);
|
|
|
|
HAL_Delay(this->welcome_duration);
|
|
driver.LCDClearDisplay();
|
|
}
|
|
|
|
void InitSequence::beeperExecute() {
|
|
HAL_GPIO_WritePin(BEEP_GPIO_Port, BEEP_Pin, GPIO_PIN_SET);
|
|
HAL_Delay(this->beep_duration);
|
|
HAL_GPIO_WritePin(BEEP_GPIO_Port, BEEP_Pin, GPIO_PIN_RESET);
|
|
}
|
|
|
|
} // floatpump
|