OceanDirectLighthouseC++ 3.1.3
OceanDirect Lighthouse C++/C API
oceandirect::api::GpioAPI Class Reference

#include <GpioAPI.h>

Public Member Functions

 GpioAPI ()
 
virtual ~GpioAPI ()=default
 
virtual int getNumberOfGPIO (long deviceID, int *errorCode)
 
virtual uint32_t getOutputAlternate (long deviceID, int *errorCode)
 
virtual bool getOutputAlternate (long deviceID, int *errorCode, int bit)
 
virtual std::uint32_t getOutputEnable (long deviceID, int *errorCode)
 
virtual bool getOutputEnable (long deviceID, int *errorCode, int bit)
 
virtual uint32_t getValue (long deviceID, int *errorCode)
 
virtual bool getValue (long deviceID, int *errorCode, int bit)
 
virtual void setOutputAlternate (long deviceID, int *errorCode, int bit, bool isAlternate)
 
virtual void setOutputAlternate (long deviceID, int *errorCode, uint32_t bitMask)
 
virtual void setOutputEnable (long deviceID, int *errorCode, std::uint32_t bitmask)
 
virtual void setOutputEnable (long deviceID, int *errorCode, std::uint32_t bitPosition, bool isOutput)
 
virtual void setValue (long deviceID, int *errorCode, std::uint32_t bitmask)
 
virtual void setValue (long deviceID, int *errorCode, std::uint32_t bitPosition, bool isHigh)
 

Static Public Member Functions

static GpioAPIgetInstance ()
 
static void shutdown ()
 

Static Protected Attributes

static GpioAPIinstance
 

Constructor & Destructor Documentation

◆ GpioAPI()

oceandirect::api::GpioAPI::GpioAPI ( )

◆ ~GpioAPI()

virtual oceandirect::api::GpioAPI::~GpioAPI ( )
virtualdefault

Member Function Documentation

◆ getInstance()

static GpioAPI * oceandirect::api::GpioAPI::getInstance ( )
static

◆ getNumberOfGPIO()

virtual int oceandirect::api::GpioAPI::getNumberOfGPIO ( long deviceID,
int * errorCode )
virtual
Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
Returns
the number of GPIO pins provided by the device.

◆ getOutputAlternate() [1/2]

virtual uint32_t oceandirect::api::GpioAPI::getOutputAlternate ( long deviceID,
int * errorCode )
virtual

Get the settings for alternate functionality on the GPIO pins. Not all spectrometers support this functionality.

Deprecated
This function is deprecated starting with release 2.1 and will be removed in the future release.
Parameters
deviceIDThe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
Returns
a bitmask with value 1 where the corresponding pin is set to alternate functionality, 0 otherwise (pin is a GPIO pin).

◆ getOutputAlternate() [2/2]

virtual bool oceandirect::api::GpioAPI::getOutputAlternate ( long deviceID,
int * errorCode,
int bit )
virtual

Get the setting for alternate functionality on the specified bit (pin). Not all spectrometers support this functionality.

Deprecated
This function is deprecated starting with release 2.1 and will be removed in the future release.
Parameters
deviceIDThe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitWhich GPIO bit or pin to query.
Returns
true if the pin is set to alternate functionality, false otherwise (pin is a GPIO pin).

◆ getOutputEnable() [1/2]

virtual std::uint32_t oceandirect::api::GpioAPI::getOutputEnable ( long deviceID,
int * errorCode )
virtual
Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
Returns
the bitmask specifying the direction of each GPIO pin.

◆ getOutputEnable() [2/2]

virtual bool oceandirect::api::GpioAPI::getOutputEnable ( long deviceID,
int * errorCode,
int bit )
virtual

Read bit direction on whether it's in or out.

See also
setOutputEnable()
Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitthe GPIO pin to query.
Returns
true if the pin is an output pin, false if the pin is an input pin.

◆ getValue() [1/2]

virtual uint32_t oceandirect::api::GpioAPI::getValue ( long deviceID,
int * errorCode )
virtual
Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
Returns
the bitmask specifying the logic level of each GPIO pin.

◆ getValue() [2/2]

virtual bool oceandirect::api::GpioAPI::getValue ( long deviceID,
int * errorCode,
int bit )
virtual

Read the bit value whether it's high or low.

See also
setValue()
Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitthe GPIO pin to query.
Returns
true if the specified pin is set to logic level hig, false if the specified pin is set to logic level low.

◆ setOutputAlternate() [1/2]

virtual void oceandirect::api::GpioAPI::setOutputAlternate ( long deviceID,
int * errorCode,
int bit,
bool isAlternate )
virtual

Set the alternate functionality for the specified pin (bit) number. Not all spectrometers support this functionality.

Deprecated
This function is deprecated starting with release 2.1 and will be removed in the future release.
Parameters
deviceIDThe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitWhich GPIO bit or pin to set
isAlternateset true to enable the alternate functionality for the pin, false otherwise (pin is a GPIO pin).

◆ setOutputAlternate() [2/2]

virtual void oceandirect::api::GpioAPI::setOutputAlternate ( long deviceID,
int * errorCode,
uint32_t bitMask )
virtual

Set the alternate functionality for the specified pins (bits). Not all spectrometers support this functionality.

Deprecated
This function is deprecated starting with release 2.1 and will be removed in the future release.
Parameters
deviceIDThe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitMaskwith bit set to 1 to set enable the alternate functionality, 0 otherwise (pin is a GPIO pin).

◆ setOutputEnable() [1/2]

virtual void oceandirect::api::GpioAPI::setOutputEnable ( long deviceID,
int * errorCode,
std::uint32_t bitmask )
virtual

Set the direction (input/output) of the GPIO pins.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitmaska bitmask specifying the pin directions i.e. the nth bit set to 1 sets the nth pin to output.

◆ setOutputEnable() [2/2]

virtual void oceandirect::api::GpioAPI::setOutputEnable ( long deviceID,
int * errorCode,
std::uint32_t bitPosition,
bool isOutput )
virtual

Set the direction (input/output) of a specified GPIO pin.

See also
getOutputEnable()
Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitthe GPIO pin to set.
isOutputset to true to make the pin output, false to make the pin input.

◆ setValue() [1/2]

virtual void oceandirect::api::GpioAPI::setValue ( long deviceID,
int * errorCode,
std::uint32_t bitmask )
virtual

Set the logic value for all GPIO pins.

Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitmaskthe bitmask specifying the logic level of each GPIO pin.

◆ setValue() [2/2]

virtual void oceandirect::api::GpioAPI::setValue ( long deviceID,
int * errorCode,
std::uint32_t bitPosition,
bool isHigh )
virtual

Set the logic value for a spcified pin.

See also
getValue()
Parameters
deviceIDthe ID of the device returned by getDeviceIDs.
errorCodeon exit this contains zero on success, nonzero otherwise.
bitthe GPIO pin to set.
isHighset true to set the logic level high, set false to set the logic level low.

◆ shutdown()

static void oceandirect::api::GpioAPI::shutdown ( )
static

Member Data Documentation

◆ instance

GpioAPI* oceandirect::api::GpioAPI::instance
staticprotected

The documentation for this class was generated from the following file: