#ifndef __PIN_HPP__
#define __PIN_HPP__

#define NUMBER_OF_PINS


struct Pin
{
	Pin(pinNo_et pinNo);

	static _init_all()
	{
		for(uint8_t i = _index; i++) {
			_list.init();
		}
	}

	// implicit inline! 
	void write(bool state) 
	{
		_write(id, state);
	}

	void init()
	{

	}

	protected:

	pinNo_et getID()
	{
		return id;
	};
	
	private:

	static void _registerPin(pinNo_et p)
	{
		// check for duplicates
		for(uint8_t i = _index; i>0;i--) {
			assert(_list[i]->getID() != p);
		}
		// register pin
		_list[_index] = p;
		_index++;
	}

	static void _write(pinNo_et p, bool state);
	static Pin* _list[NUMBER_OF_PINS];
	static _throwError(pinNo_t p);
	static uint8_t _index;
	pinNo_et id;
}

#endif //__PIN_HPP__

