The Puma
Joined: 23 Apr 2004 Posts: 227 Location: The Netherlands
|
|
Posted: Tue Oct 23, 2007 3:14 pm |
|
|
| ckielstra wrote: | | The [spam] wrote: | I have now this and it works
Can i optimise this ?
| Get rid of the lines reversing the buffer, you can do this in the copy-loop by reading the input buffer backwards (from the end to start).
| Code: | void max7221_fill_dot_matrix_buffer(char *buffer) {
int8 i;
char *msgptr, currentchar;
int8 MsgLength;
memset(dot_matrix_buffer,0x00,MAX_DOT_MATRIX_BUFFER_SIZE);
MsgLength = strlen(buffer);
msgptr=&dot_matrix_buffer[0];
for (i=0; i<MsgLength; i++)
{
currentchar=buffer[MsgLength - i - 1];
memcpy(msgptr,font5x7[currentchar-0x20],MAX_FONT_SIZE);
msgptr+=MAX_FONT_SIZE;
}
} |
|
This also works  |
|