 }
 
 void setup(void) {
+	
+#ifdef FAST_PORT
 	setup_pc_pwm_any();
-	pinMode(EXT_CS_IN, OUTPUT);
+	pinModeFast(EXT_CS_IN, OUTPUT);
+	pinModeFast(EXT_DATA_IN, INPUT);
+	pinModeFast(EXT_CS, OUTPUT);	
+	pinModeFast(EXT_CLOCK, OUTPUT);
+	pinModeFast(EXT_DATA_OUT, OUTPUT);	
+	digitalWriteFast(EXT_CS_IN, HIGH);
+	digitalWriteFast(EXT_CS, HIGH);
+#else	
+	pinMode(EXT_CS_IN, OUTPUT);	
+	pinMode(EXT_DATA_IN, INPUT);
+	pinMode(EXT_CS, OUTPUT);	
+	pinMode(EXT_CLOCK, OUTPUT);
+	pinMode(EXT_DATA_OUT, OUTPUT);	
 	digitalWrite(EXT_CS_IN, HIGH);
-	pinMode(EXT_DATA_IN, INPUT);
-	pinMode(EXT_CS, OUTPUT);
+	digitalWrite(EXT_CS, HIGH);
+#endif	
 	//	pinMode(A2, OUTPUT);
-	digitalWrite(EXT_CS, HIGH);
-	pinMode(EXT_CLOCK, OUTPUT);
-	pinMode(EXT_DATA_OUT, OUTPUT);
+	
 	set_boiler_off(FORCE);
 	pump_off();
 	Serial.begin(9600);



byte get_input_data() {
	digitalWrite(EXT_CS_IN, LOW);
	digitalWrite(EXT_CLOCK, LOW);
	digitalWrite(EXT_CLOCK, HIGH);
	digitalWrite(EXT_CS_IN, HIGH);
	byte data = shiftIn(EXT_DATA_IN, EXT_CLOCK, LSBFIRST);
	return data;
}



// WARNING: address is a page address, 6-bit end will wrap around
// also, data can be maximum of about 30 bytes, because the Wire library has a buffer of 32 bytes
/*
void i2c_eeprom_write_buffer( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
	Wire.beginTransmission(deviceaddress);
	Wire.write((int)(eeaddresspage >> 8)); // MSB
