ftdipp_mpsse: update direction method
This commit is contained in:
parent
b2abafa76d
commit
deefcd2d38
|
|
@ -484,7 +484,7 @@ void FTDIpp_MPSSE::gpio_set_dir(uint16_t dir)
|
||||||
* @param[in] gpio: pins bitmask
|
* @param[in] gpio: pins bitmask
|
||||||
* @param[int] low_pins: select between CBUS or DBUS
|
* @param[int] low_pins: select between CBUS or DBUS
|
||||||
*/
|
*/
|
||||||
void FTDIpp_MPSSE::gpio_set_input(uint16_t gpio, bool low_pins)
|
void FTDIpp_MPSSE::gpio_set_input(uint8_t gpio, bool low_pins)
|
||||||
{
|
{
|
||||||
if (low_pins)
|
if (low_pins)
|
||||||
_cable.bit_low_dir &= ~gpio;
|
_cable.bit_low_dir &= ~gpio;
|
||||||
|
|
@ -492,12 +492,24 @@ void FTDIpp_MPSSE::gpio_set_input(uint16_t gpio, bool low_pins)
|
||||||
_cable.bit_high_dir &= ~gpio;
|
_cable.bit_high_dir &= ~gpio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* configure pins as input
|
||||||
|
* @param[in] gpio: pins bitmask
|
||||||
|
*/
|
||||||
|
void FTDIpp_MPSSE::gpio_set_input(uint16_t gpio)
|
||||||
|
{
|
||||||
|
if (gpio & 0x00ff)
|
||||||
|
_cable.bit_low_dir &= ~(gpio & 0x00ff);
|
||||||
|
if (gpio & 0xff00)
|
||||||
|
_cable.bit_high_dir &= ~((gpio >> 8) & 0x00ff);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* configure low or high pins as output
|
* configure low or high pins as output
|
||||||
* @param[in] gpio: pins bitmask
|
* @param[in] gpio: pins bitmask
|
||||||
* @param[int] low_pins: select between CBUS or DBUS
|
* @param[int] low_pins: select between CBUS or DBUS
|
||||||
*/
|
*/
|
||||||
void FTDIpp_MPSSE::gpio_set_output(uint16_t gpio, bool low_pins)
|
void FTDIpp_MPSSE::gpio_set_output(uint8_t gpio, bool low_pins)
|
||||||
{
|
{
|
||||||
if (low_pins)
|
if (low_pins)
|
||||||
_cable.bit_low_dir |= gpio;
|
_cable.bit_low_dir |= gpio;
|
||||||
|
|
@ -505,6 +517,18 @@ void FTDIpp_MPSSE::gpio_set_output(uint16_t gpio, bool low_pins)
|
||||||
_cable.bit_high_dir |= gpio;
|
_cable.bit_high_dir |= gpio;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* configure pins as output
|
||||||
|
* @param[in] gpio: pins bitmask
|
||||||
|
*/
|
||||||
|
void FTDIpp_MPSSE::gpio_set_output(uint16_t gpio)
|
||||||
|
{
|
||||||
|
if (gpio & 0x00ff)
|
||||||
|
_cable.bit_low_dir |= (gpio & 0x00ff);
|
||||||
|
if (gpio & 0xff00)
|
||||||
|
_cable.bit_high_dir |= ((gpio >> 8) & 0x00ff);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* private method to write ftdi half bank GPIOs (pins state are in _cable)
|
* private method to write ftdi half bank GPIOs (pins state are in _cable)
|
||||||
* @param[in] low or high half bank
|
* @param[in] low or high half bank
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,14 @@ class FTDIpp_MPSSE {
|
||||||
/* gpio direction */
|
/* gpio direction */
|
||||||
void gpio_set_dir(uint8_t dir, bool low_pins);
|
void gpio_set_dir(uint8_t dir, bool low_pins);
|
||||||
void gpio_set_dir(uint16_t dir);
|
void gpio_set_dir(uint16_t dir);
|
||||||
void gpio_set_input(uint16_t gpio, bool low_pins);
|
/* configure as input low/high pins */
|
||||||
void gpio_set_output(uint16_t gpio, bool low_pins);
|
void gpio_set_input(uint8_t gpio, bool low_pins);
|
||||||
|
/* configure as input pins */
|
||||||
|
void gpio_set_input(uint16_t gpio);
|
||||||
|
/* configure as output low/high pins */
|
||||||
|
void gpio_set_output(uint8_t gpio, bool low_pins);
|
||||||
|
/* configure as output pins */
|
||||||
|
void gpio_set_output(uint16_t gpio);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void open_device(const std::string &serial, unsigned int baudrate);
|
void open_device(const std::string &serial, unsigned int baudrate);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue