On Thu, Mar 19, 2015 at 1:25 PM, William Bulley wrote: > In the good ole' days (prior to object oriented languages) folks would > have used a "transfer vector" to handle things like this. It sounds > like the Arduino ecosystem is object oriented -- I dunno. But the C > language definitely is not. C++ is -- but don't go there... :-) Near as I can tell, Arduino is object oriented. Possibly straight C++, but I'm not knowledgeable in either to know for sure. > Perhaps write a bevy of functions in C, each of which is slightly > different, to handle the different hardware types you are dealing > with. Each function would have the same argument or parameter list > (the same calling convention, or "signature"). Then index into > your "transfer vector" (which is a list of function entry points) > based on some feature of your different hardware needs, and voila! My current task it to just get the darn thing working with one encoder. Assuming I can accomplish that, I'm thinking I might pass an argument when I call the function (something like serviceenc(enc1); ). In the header file I will define the proper variables to use given a specific encoder argument, and then deal with substituting those variables in the library code. I could in theory pass all the arguments needed when I call the function. I'm still unsure how many variables I need, and thus how ungainly that might be. Working on it though! By the way, I dumped in the .h file from the Arduino library. After commenting out references to the Arduino specific libraries, it actually compiles, even with things like this: class ClickEncoder { public: typedef enum Button_e { Open =3D 0, Closed, Pressed, Held, Released, Clicked, DoubleClicked } Button; That might be because MPLABX does support C++ compilers, but at this point I'm going to convert everything back to C syntax. Josh --=20 A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .