Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Marshall Brown
10/04/12 03:27
Read: 603 times
Hamilton
New Zealand


 
#188571 - I Agree
Responding to: Oliver Sedlacek's previous message
I will make all the functions accept a void pointer

void TIMERS_test(void *thingy){
	unsigned char *j_ptr;
	static unsigned char result;


	//cast the pointer into something that we know we are expecting
	j_ptr = (unsigned char *)thingy;

	result = *j_ptr;	//grab the value of the pointer 
	result ++;			//add one to it
	*j_ptr = result;	//write the result back to the thing pointed to by j_ptr.

}



 


My LED Blink was redefined as

void MAIN_blink(void *not_used){
	RUN_LED = !RUN_LED;
}

 


so although I get a warning about not_used being not used, that's fine, everything works.


I hadn't thought of it as an RTOS, just a simple method to implement timeouts, retries, interchar timeouts for a serial protocol.

Thanks for the comment.

Regards

Marshall




List of 13 messages in thread
TopicAuthorDate
Timers - Function Pointers      Marshall Brown      10/03/12 21:08      
   Too much for a '51?      Oliver Sedlacek      10/04/12 02:05      
      I Agree      Marshall Brown      10/04/12 03:27      
   Function Pointers...      Andy Neil      10/04/12 05:50      
   you are violating KISS      Erik Malund      10/04/12 08:41      
   Various Timer Functions        Michael Karas      10/06/12 01:14      
      Thanks Michael      Marshall Brown      10/06/12 23:34      
         regardless, you are violating KISS        Erik Malund      10/09/12 07:44      
            even on ARM      Stefan KAnev      10/09/12 13:40      
            The timer simply increments      Marshall Brown      10/11/12 15:58      
               bug      Marshall Brown      10/11/12 16:08      
                  more bugs      Maarten Brock      10/13/12 14:30      
                     thanks      Marshall Brown      10/14/12 13:31      

Back to Subject List