Need help undestanding code

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
dev
Posts: 3
Joined: Wed Feb 14, 2018 3:31 pm

Need help undestanding code

Post by dev » Wed Feb 14, 2018 3:39 pm

Hi,
I was going throughout the code. Next line of code was confusing me. i didn't understand following for loop condition.

Please correct if i am wrong
I was checking in code bytes variable will have value as 1 in case of same 5x7 font.

Code: Select all

	
	    for (uint8_t i = bytes - 1; i < 254; i--) { // Vertical Bytes
	        uint8_t data = pgm_read_byte(this->Font + index + j + (i * width));
		    int offset = (i * 8);
		    if ((i == bytes - 1) && bytes > 1) {
		        offset = height - 8;
            }
This would really help me if any one explains me this codition.

User avatar
stryker
Posts: 268
Joined: Sat Jan 14, 2012 2:44 pm

Re: Need help undestanding code

Post by stryker » Thu Feb 15, 2018 8:58 am

Where is this code?

dev
Posts: 3
Joined: Wed Feb 14, 2018 3:31 pm

Re: Need help undestanding code

Post by dev » Thu Feb 15, 2018 2:41 pm

This code is part of Freetronics DMD library.

User avatar
stryker
Posts: 268
Joined: Sat Jan 14, 2012 2:44 pm

Re: Need help undestanding code

Post by stryker » Fri Feb 16, 2018 1:25 am

I see it now. You'd have to work through it with the font file open as well to see what all those offsets and indices add up to.

dev
Posts: 3
Joined: Wed Feb 14, 2018 3:31 pm

Re: Need help undestanding code

Post by dev » Fri Feb 16, 2018 6:29 pm

Thanks for the suggestion.

Post Reply