I run the demo arcsectors. But the gfxSleepMilliseconds() stuck.
here is my code
int main(void)
{
coord_t width, height, r1, r2, cx, cy;
uint8_t sectors;
SysTick_Config(SystemCoreClock / 1000);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
lcd_init();
win_flash();
delay(1000);
lcd_clear();
gfxInit();
// Get the screen size
width = gdispGetWidth();
height = gdispGetHeight();
// Initialize some variables
r1 = width > height ? height/3 : width/3;
r2 = r1*3/4;
cx = width/2;
cy = height/2;
sectors = 1;
while(1) {
// Draw the arc sectors
gdispClear(White);
gdispDrawArcSectors(cx, cy, r1, sectors, Black);
gdispFillArcSectors(cx, cy, r2, sectors, Black);
// Increase the sectors counter
sectors++;
// Waste some time
gfxSleepMilliseconds(250);
}
}
static volatile uint32_t gfx_tick = 0;
static volatile uint32_t cnt = 0;
systemticks_t gfxSystemTicks(void)
{
return gfx_tick;
}
systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
{
return ms;
}
void SysTick_Handler(void)
{
gfx_tick ++;
if (0 != cnt)
cnt--;
}
extern void delay(uint16_t val)
{
cnt = val;
while(cnt);
}
if I replace the gfxSleepMilliseconds(250) with delay(250), it is OK. what is wrong with it ?