I am trying to compare the speed of two pixel plotting functions, but I cant seem to get the speeds to print out:
Code:
PrintMini prints out three Xs, and PrintXY displays one X, but neither have any numbers following them. Am I using memcpy correctly here?
Code:
int main(void) {
int t1,t2,t3,t4;
int i,j;
t1 = RTC_GetTicks();
for(i=0;i<1000;i++)
{
plot(0,0,COLOR_WHITE);
}
t2 = RTC_GetTicks();
t3 = RTC_GetTicks();
for(j=0;j<1000;j++)
{
plot_asm(1,1,COLOR_WHITE);
}
t4 = RTC_GetTicks();
t1 = (t2-t1)/128;
t3 = (t4-t3)/128;
unsigned char time1[sizeof(t1)+3];
char time2[sizeof(t3)+3];
time1[0] = 'X';
time1[1] = 'X';
time2[0] = 'X';
time2[1] = 'X';
time1[2] = 'X';
time2[2] = 'X';
memcpy(&time1[3],&t1,sizeof(t1));
memcpy(&time2[3],&t3,sizeof(t3));
unsigned char * time1loc = &time1[0];
char * time2loc = &time2[0];
PrintXY(1, 1, "XXResults:", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
int x = 0;
int y = 50;
PrintMini( &x, &y, time1loc, 0x02, 350, 0, 0, TEXT_COLOR_BLACK, TEXT_COLOR_WHITE, 1, 0);
PrintXY(1, 4, time2loc, TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);
while(!keydownlast(KEY_PRGM_MENU))
{
Bdisp_PutDisp_DD();
keyupdate();
}
return 0;
}
PrintMini prints out three Xs, and PrintXY displays one X, but neither have any numbers following them. Am I using memcpy correctly here?