Added "#define inverted" to invert incoming data polarity.