[Taranis X9E] Bitmaps added on startup

This commit is contained in:
bsongis
2015-07-11 08:52:30 +02:00
parent 17f465bff5
commit a7462157c5
7 changed files with 56 additions and 65 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

+52 -62
View File
@@ -115,6 +115,18 @@ extern "C" void INTERRUPT_5MS_IRQHandler()
#if defined(REV9E)
#define PWR_PRESS_DURATION_MIN 80 // 800ms
#define PWR_PRESS_DURATION_MAX 300 // 3s
const pm_uchar bmp_startup[] PROGMEM = {
#include "../../bitmaps/Taranis/startup.lbm"
};
const pm_uchar bmp_lock[] PROGMEM = {
#include "../../bitmaps/Taranis/lock.lbm"
};
const pm_uchar bmp_sleep[] PROGMEM = {
#include "../../bitmaps/Taranis/sleep.lbm"
};
#endif
void boardInit()
@@ -124,74 +136,14 @@ void boardInit()
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE);
pwrInit();
init5msTimer();
__enable_irq();
#if 0 // first version
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
tmr10ms_t start = get_tmr10ms();
while (pwrPressed());
tmr10ms_t duration = get_tmr10ms() - start;
if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) {
pwrOff();
}
}
#endif
#if 0 // second version
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
tmr10ms_t start = get_tmr10ms();
tmr10ms_t duration = 0;
uint8_t pwr_on = 0;
while (pwrPressed()) {
duration = get_tmr10ms() - start;
if (duration >= PWR_PRESS_DURATION_MAX) {
turnBacklightOff();
}
else if (duration > PWR_PRESS_DURATION_MIN && pwr_on != 1) {
backlightInit();
pwr_on = 1;
}
}
if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) {
pwrOff();
}
}
#endif
#if defined(REV9E) // third version
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
tmr10ms_t start = get_tmr10ms();
tmr10ms_t duration = 0;
uint8_t pwr_on = 0;
while (pwrPressed()) {
duration = get_tmr10ms() - start;
if (duration >= PWR_PRESS_DURATION_MAX) {
turnBacklightOff();
}
else if (duration > PWR_PRESS_DURATION_MIN && pwr_on != 1) {
backlightInit();
pwr_on = 1;
}
}
if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) {
pwrOff();
}
}
#endif
keysInit();
adcInit();
delaysInit();
lcdInit(); // delaysInit() must be called before
#if defined(REV9E)
topLcdInit();
#endif
audioInit();
init2MhzTimer();
init5msTimer();
__enable_irq();
i2cInit();
usbInit();
@@ -207,7 +159,45 @@ void boardInit()
DBGMCU_APB1PeriphConfig(DBGMCU_IWDG_STOP|DBGMCU_TIM1_STOP|DBGMCU_TIM2_STOP|DBGMCU_TIM3_STOP|DBGMCU_TIM6_STOP|DBGMCU_TIM8_STOP|DBGMCU_TIM10_STOP|DBGMCU_TIM13_STOP|DBGMCU_TIM14_STOP, ENABLE);
#endif
#if defined(REV9E)
if (!(RCC->CSR & (RCC_CSR_SFTRSTF | RCC_CSR_WDGRSTF))) {
tmr10ms_t start = get_tmr10ms();
tmr10ms_t duration = 0;
uint8_t pwr_on = 0;
while (pwrPressed()) {
duration = get_tmr10ms() - start;
lcd_clear();
if (duration < PWR_PRESS_DURATION_MIN) {
lcd_bmp(76, 0, bmp_lock, 0, 60);
}
else if (duration >= PWR_PRESS_DURATION_MAX) {
lcd_bmp(76, 0, bmp_sleep, 0, 60);
turnBacklightOff();
}
else {
unsigned index = (duration - PWR_PRESS_DURATION_MIN) / ((PWR_PRESS_DURATION_MAX-PWR_PRESS_DURATION_MIN) / 4);
lcd_bmp(76, 0, bmp_startup, index*60, 60);
if (pwr_on != 1) {
backlightInit();
pwr_on = 1;
}
}
lcdRefresh();
}
if (duration < PWR_PRESS_DURATION_MIN || duration >= PWR_PRESS_DURATION_MAX) {
pwrOff();
}
else {
lcdRefreshWait();
}
}
else {
backlightInit();
}
topLcdInit();
#else
backlightInit();
#endif
}
#endif
@@ -342,6 +342,7 @@ void bluetoothWakeup(void);
// LCD driver
void lcdInit(void);
void lcdInitFinish(void);
void lcdOff(void);
// Top LCD driver
+3 -3
View File
@@ -268,8 +268,8 @@ void backlightInit()
BACKLIGHT_TIMER->PSC = (PERI2_FREQUENCY * TIMER_MULT_APB2) / 50000 - 1; // 20us * 100 = 2ms => 500Hz
BACKLIGHT_TIMER->CCMR1 = TIM_CCMR1_OC1M_1 | TIM_CCMR1_OC1M_2 | TIM_CCMR1_OC2M_1 | TIM_CCMR1_OC2M_2 ; // PWM
BACKLIGHT_TIMER->CCER = TIM_CCER_CC1E | TIM_CCER_CC2E ;
BACKLIGHT_TIMER->CCR1 = 0 ;
BACKLIGHT_TIMER->CCR2 = 80 ;
BACKLIGHT_TIMER->CCR2 = 0 ;
BACKLIGHT_TIMER->CCR1 = 100 ;
BACKLIGHT_TIMER->EGR = 0 ;
BACKLIGHT_TIMER->CR1 = TIM_CR1_CEN ; // Counter enable
#elif defined(REVPLUS)
@@ -287,7 +287,7 @@ void backlightInit()
BACKLIGHT_TIMER->CCMR2 = TIM_CCMR2_OC4M_1 | TIM_CCMR2_OC4M_2 ; // PWM
BACKLIGHT_TIMER->CCER = TIM_CCER_CC4E | TIM_CCER_CC2E ;
BACKLIGHT_TIMER->CCR2 = 0 ;
BACKLIGHT_TIMER->CCR4 = 80 ;
BACKLIGHT_TIMER->CCR4 = 100 ;
BACKLIGHT_TIMER->EGR = 0 ;
BACKLIGHT_TIMER->CR1 = TIM_CR1_CEN ; // Counter enable
#else