I2C - bit banging query
Your code change the DDR/DIR bit of that pin because in I2C you want either an high impedance pin (pin set as input pin -> send a "1") or a super low impedance pin (output pin set to 0 -> send a "0"). By design I2C forbids to pull up the bus directly from the pin as it will cause very BAD things (one device setting an high, another device setting a low and... bang!!! a great short-circuit!). Pull up is done by the external 4.7K pull-ups. Any pin used for I2C should be open-drain.