2006-06-22 11:10 PM
2006-06-22 11:10 PM
Can someone help me resolve calls to a function table which can pass parameters, I am struggling with this.
Mik ~~~~~~~~~~~~~~~ CODE ~~~~~~~~~~~~~~~~~ // Start of Test module typedef void (*fptr)(void); typedef unsigned char u8; // Prototype functions void NoBuz2(void); u8 NoBuz04(void); void BuzEngTone_Rpt(u8); u8 BuzTask(u8); void ExBuzz(u8); // Define function table const fptr Buzz_tbl[] = // Define Executive Routines here { NoBuz2, NoBuz04(), BuzEngTone_Rpt(0x05), u8 BuzTask(0x01,0xff) }; // Create functions in the functions table void NoBuz2(void) { } u8 NoBuz04(void) { return 0x04; } void BuzEngTone_Rpt(u8 test) { test+=2; } u8 BuzTask(u8 test) { test+=2; return test; } //Call functions from the function table void ExBuzz(u8 task) { Buzz_tbl[task](); } // End of Code