CCAux  2.20.0.0
CCAux API reference
Functions
DigIO functions

Functions

EXTERN_C CCAUXDLL_API DIGIOHANDLE CCAUXDLL_CALLING_CONV GetDigIO (void)
 
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV DigIO_release (DIGIOHANDLE)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV DigIO_getDigIO (DIGIOHANDLE, uint8_t *status)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV DigIO_setDigIO (DIGIOHANDLE, uint8_t state)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV DigIO_getDigPowerOutput (DIGIOHANDLE, PowerOutput output, CCStatus *enabled, uint8_t *status)
 
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV DigIO_setDigPowerOutput (DIGIOHANDLE, PowerOutput output, CCStatus enabled)
 

Detailed Description

Functions in the DigIO class

Function Documentation

◆ DigIO_getDigIO()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::DigIO_getDigIO ( DIGIOHANDLE  ,
uint8_t status 
)

Get Digital inputs.

Supported Platform(s): XL, XM, XS, XA

Parameters
statusStatus of the four digital input pins. Bit0: Digital input 1. Bit1: Digital input 2. Bit2: Digital input 3. Bit3: Digital input 4. Bit 4..7 are always zero.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = DigIO_getDigIO(pDigIO, &inputs);
{
cout << "Digital In 1: " << ((inputs & CrossControl::DigitalIn_1) ? "High" : "Low") << endl;
cout << "Digital In 2: " << ((inputs & CrossControl::DigitalIn_2) ? "High" : "Low") << endl;
cout << "Digital In 3: " << ((inputs & CrossControl::DigitalIn_3) ? "High" : "Low") << endl;
cout << "Digital In 4: " << ((inputs & CrossControl::DigitalIn_4) ? "High" : "Low") << endl;
}
else
{
cout << "Unable to read digital input status." << endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV DigIO_getDigIO(DIGIOHANDLE, uint8_t *status)
const uint8_t DigitalIn_2
Definition: DigIO.h:35
const uint8_t DigitalIn_4
Definition: DigIO.h:37
const uint8_t DigitalIn_3
Definition: DigIO.h:36
@ ERR_SUCCESS
Definition: CCAuxTypes.h:163
const uint8_t DigitalIn_1
Definition: DigIO.h:34

◆ DigIO_getDigPowerOutput()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::DigIO_getDigPowerOutput ( DIGIOHANDLE  ,
PowerOutput  output,
CCStatus enabled,
uint8_t status 
)

Get digital power output status.

Supported Platform(s): VS

Parameters
outputWhich output to read
enabledState of the power output signal.
statusError status of the power output signal.

Error status: The error status byte can be used to detect certain error conditions. If the error status byte is set to 1, this indicates an error (0 is no error).

If the signal state is Enabled (high), the following error conditions gererates an error status: "Short circuit to GND" or "Over temperature". SS monitors the signal and turns it off immediately if an error is indicated when the signal has been set high. This means that "enabled" will be read as disabled and in this case the status may have any value - although in most cases it will be set to no error since the signal is now turned off.

If the signal is disabled (low), these error conditions generates an error status: "Short circuit to VDD" or "Off state open load".

Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

◆ DigIO_release()

EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV CrossControl::DigIO_release ( DIGIOHANDLE  )

Delete the DigIO object.

Supported Platform(s): XL, XM, XS, XA

Returns
-

Example Usage:

DIGIOHANDLE pDigIO = ::GetDigIO();
assert(pDigIO);
list_digital_inputs(pDigIO);
DigIO_release(pDigIO);
EXTERN_C CCAUXDLL_API DIGIOHANDLE CCAUXDLL_CALLING_CONV GetDigIO(void)
EXTERN_C CCAUXDLL_API void CCAUXDLL_CALLING_CONV DigIO_release(DIGIOHANDLE)
void * DIGIOHANDLE
Definition: DigIO.h:32

◆ DigIO_setDigIO()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::DigIO_setDigIO ( DIGIOHANDLE  ,
uint8_t  state 
)

Set Digital outputs.

Supported Platform(s): XA, XS

Parameters
stateState of the four digital output pins. Bit0: Digital output 1. Bit1: Digital output 2. Bit2: Digital output 3. Bit3: Digital output 4. Bit 4..7 not used.
Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

err = DigIO_setDigIO(pDigIO, inputs);
{
cout << "Digital out set to the status read." << endl;
}
else
{
cout << "Unable to set digital output status." << endl;
}
EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV DigIO_setDigIO(DIGIOHANDLE, uint8_t state)

◆ DigIO_setDigPowerOutput()

EXTERN_C CCAUXDLL_API eErr CCAUXDLL_CALLING_CONV CrossControl::DigIO_setDigPowerOutput ( DIGIOHANDLE  ,
PowerOutput  output,
CCStatus  enabled 
)

Set Digital power outputs.

Supported Platform(s): VS

Parameters
outputThe output to set
enabledState of the power output signal.

Outputs 1 and 2 can also be set to be turned on automatically at system startup using: Config_setDigPowerOutputStartupConfig.

Returns
error status. 0 = ERR_SUCCESS, otherwise error code. See the enum eErr for details.

Example Usage:

◆ GetDigIO()

EXTERN_C CCAUXDLL_API DIGIOHANDLE CCAUXDLL_CALLING_CONV CrossControl::GetDigIO ( void  )

Factory function that creates instances of the DigIO object.

Supported Platform(s): XL, XM, XS, XA

Returns
DIGIOHANDLE to an allocated DigIO object. The returned handle needs to be deallocated using the DigIO_release(DIGIOHANDLE) method when it's no longer needed. Returns NULL if it fails to allocate memory.

Example Usage:

DIGIOHANDLE pDigIO = ::GetDigIO();
assert(pDigIO);
list_digital_inputs(pDigIO);
DigIO_release(pDigIO);