zmemw16 wrote:is it possible write this so that it could be used for any port eg A, B, ... G etc ?
any pointers to helpful documentation would be nice, i found this from hitex development tools

Sure, you could create a base template that implements the functions and accepts the specific port as a template argument. I didn't do this in the example to avoid confusing people more than just the simple template code already does. The simplest solution if you aren't template savvy is to cut and paste and just change the port.

For the msp430, I took a different approach as the its GPIO ports can have different capabilities. Some of the ports are interrupt capable and other ports are not. I created base class templates that have different features and capabilities:

is it possible write this so that it could be used for any port eg A, B, ... G etc ?

@zmemw16 I was looking at this again for some reason. I made a simple change that lets you do what you want.

I added a generic template member function called GPIOPortX() that returns the proper port based on a number. You have to use a different syntax for the pin template. Still as efficient just more flexible.