CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

strange thing with reversing a string
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Oct 23, 2007 12:32 pm     Reply with quote

Ok, i will treid this.
But i going now looking to PSV
The Puma



Joined: 23 Apr 2004
Posts: 227
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Oct 23, 2007 3:14 pm     Reply with quote

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 Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group