Fast digital I/O and software SPI with C++ templates

The problem is that template arguments must be constant -- either a straight number, #define, or something declared with const. The only way around it is to make the pin you're feeding into the digitalWriteFast template a template argument for the class itself.

blink.h:

#ifndef BLINK_H
#define BLINK_H
#include <inttypes.h>

template <unsigned char pinA>
class blink {
  public:
	blink();
    void setup();
    void blinking(uint8_t d);
    
  private:
    unsigned char _thePin;   
};

#endif

blink.cpp

#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "blink.h"

#include <../FastDigitalIO/FastDigitalIO.h>

template <unsigned char pinA>
blink::blink(){
	FastDigitalIO<pinA> blinkPin;
	setup();
}

template <unsigned char pinA>
void blink::setup() {
  _thePin = pinA;
  blinkPin.mode(OUTPUT);
}

void blink::blinking(uint8_t d) {
	if (d == 1){
		blinkPin.write(HIGH);
	} else {
		blinkPin.write(LOW);
	}
}

... or something like that