diff --git a/src/ftdipp_mpsse.cpp b/src/ftdipp_mpsse.cpp index b4c26f7..c5a1c88 100644 --- a/src/ftdipp_mpsse.cpp +++ b/src/ftdipp_mpsse.cpp @@ -456,6 +456,29 @@ bool FTDIpp_MPSSE::gpio_write(uint8_t gpio, bool low_pins) return (mpsse_write() >= 0); } +/** + * update half bank pins direction (no write is done at this time) + * @param[in] dir: pins direction (1 out, 0 in) for low or high bank + * @param[in] low_pins: high/low half bank + */ +void FTDIpp_MPSSE::gpio_set_dir(uint8_t dir, bool low_pins) +{ + if (low_pins) + _cable.bit_low_dir = dir; + else + _cable.bit_high_dir = dir; +} + +/** + * update full bank pins direction (no write is done at this time) + * @param[in] dir: pins direction (1 out, 0 in) for low or high bank + */ +void FTDIpp_MPSSE::gpio_set_dir(uint16_t dir) +{ + _cable.bit_low_dir = dir & 0xff; + _cable.bit_high_dir = (dir >> 8) & 0xff; +} + /** * private method to write ftdi half bank GPIOs (pins state are in _cable) * @param[in] low or high half bank diff --git a/src/ftdipp_mpsse.hpp b/src/ftdipp_mpsse.hpp index bf940b3..13a7d8d 100644 --- a/src/ftdipp_mpsse.hpp +++ b/src/ftdipp_mpsse.hpp @@ -39,6 +39,8 @@ class FTDIpp_MPSSE { /* full access */ bool gpio_write(uint16_t gpio); bool gpio_write(uint8_t gpio, bool low_pins); + void gpio_set_dir(uint8_t dir, bool low_pins); + void gpio_set_dir(uint16_t dir); protected: void open_device(const std::string &serial, unsigned int baudrate);