mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-30 01:48:50 +02:00
ftdipp_mpsse: add method to update pins direction
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user