diff --git a/parallel_io.h b/parallel_io.h old mode 100755 new mode 100644 index 02da5dd..726adf8 --- a/parallel_io.h +++ b/parallel_io.h @@ -30,8 +30,13 @@ enum ParallelPortMode { PARALLEL_BYTE, PARALLEL_NIBBLE_HIGH, PARALLEL_NIBBLE_LOW, + PARALLEL_TRIPLE_HIGHEST, PARALLEL_TRIPLE_HIGH, - PARALLEL_TRIPLE_LOW + PARALLEL_TRIPLE_LOW, + PARALLEL_DOUBLE_HIGH, + PARALLEL_DOUBLE_MIDHIGH, + PARALLEL_DOUBLE_MIDLOW, + PARALLEL_DOUBLE_LOW }; template @@ -58,10 +63,18 @@ struct ShiftMasks { }; }; +template<> +struct ShiftMasks { + enum Masks { + mask = 0xe0, + shift = 5, + }; +}; + template<> struct ShiftMasks { enum Masks { - mask = 0x78, + mask = 0x38, shift = 3, }; }; @@ -74,6 +87,38 @@ struct ShiftMasks { }; }; +template<> +struct ShiftMasks { + enum Masks { + mask = 0xc0, + shift = 6, + }; +}; + +template<> +struct ShiftMasks { + enum Masks { + mask = 0x30, + shift = 4, + }; +}; + +template<> +struct ShiftMasks { + enum Masks { + mask = 0x0c, + shift = 2, + }; +}; + +template<> +struct ShiftMasks { + enum Masks { + mask = 0x03, + shift = 0, + }; +}; + template struct ParallelPort { typedef ShiftMasks Masks; @@ -94,7 +139,8 @@ struct ParallelPort { } static inline void EnablePullUpResistors() { - Write(Masks::mask); + uint8_t preserve = *Port::Output::ptr(); + *Port::Output::ptr() = preserve | Masks::mask; } static inline uint8_t Read() {