added a small 10ms wait before turning on the backlight, thanks to profi for reminding me of that

This commit is contained in:
Wolfvak 2019-04-17 15:54:47 -03:00 committed by d0k3
parent f5a877d00b
commit bcff09a389
3 changed files with 47 additions and 33 deletions

View File

@ -18,3 +18,12 @@
#define TIMER_CNT_INT_EN BIT(2)
#define TIMER_CNT_RELOAD BIT(1)
#define TIMER_CNT_ENABLE BIT(0)
void TIMER_WaitTicks(u32 ticks)
{
REG_TIMER_IRQ(TIMER_THIS_CPU) = 1;
REG_TIMER_CNT(TIMER_THIS_CPU) = 0;
REG_TIMER_LOAD(TIMER_THIS_CPU) = ticks;
REG_TIMER_CNT(TIMER_THIS_CPU) = TIMER_CNT_ENABLE;
while(REG_TIMER_COUNT(TIMER_THIS_CPU));
}

View File

@ -7,6 +7,8 @@
// therefore
// Load_value = [(CPU_CLK / 2) * (T / (PRESCALER_value + 1))] - 1
#define BASE_CLKRATE (268111856)
#define BASE_CLKRATE (268111856 / 2)
#define CLK_FREQ_TO_INTERVAL(f, p) ((BASE_CLKRATE/2) * ((f) / ((p) + 1)) - 1)
#define CLK_MS_TO_TICKS(m) (((BASE_CLKRATE / 1000) * (m)) - 1)
void TIMER_WaitTicks(u32 ticks);

View File

@ -4,8 +4,9 @@
#include <pxi.h>
#include "arm/gic.h"
#include "arm/scu.h"
#include "arm/mmu.h"
#include "arm/scu.h"
#include "arm/timer.h"
#include "hw/gpulcd.h"
#include "hw/i2c.h"
@ -93,6 +94,8 @@ void SYS_CoreZeroInit(void)
GPU_SetFramebufferMode(0, PDC_RGB24);
GPU_SetFramebufferMode(1, PDC_RGB24);
TIMER_WaitTicks(CLK_MS_TO_TICKS(10));
MCU_WriteReg(0x22, 0x2A);
}