Listing 81 continued DIOC

**********************************************************************************

* CONFIGURE DISCRETE OUTPUT MODE

* Description : This function is used to configure the mode of a discrete output channel.

* Arguments : n is the discrete output channel to configure (0. .DIO_MAX_DO-l) .

* mode is the desired mode and can be:

* DO_M3DE_LOW output is forced LOW

* DO_WDE_HIGH output is forced HIGH

* DO_MQDE_DIRBCT output is based on state of DOBypass

* DO_M3DE_BLINK_SYNC output will be blinking synchronously with EOSyncCtr

* DO_MDDE_BLINK_ASYNC Output will be blinking based en DQA and DOB

* inv indicates whether the output will be inverted:

* TRUE forces the output to be inverted

* FALSE does not cause any inversion

*********************************************************************************************************

void DOCfgtfade (INr8U n, INr8U mode, BOOLEAN inv) {

if (n < DIO_MAX_DO) { OS_ENTER_CRITICAL ( ) ; DOTblln] .DCModeSel = mode; DOTbltn] .DOInv - inv; OS_EXIT_CRITICAL ( ) ;

*********************************************************************************************************

* GE7T THE STATE OF THE DISCRETE OUTPUT

* Description : This function is used to obtain the state of the discrete output.

* Arguments : n is the discrete output channel (0. .DIO_MAX_DO-l) .

* Returns : TRUE if the output is asserted.

* FALSE if the output is negated. *********************************************************************************************************

BOOLEAN EOGet (INr8U n) {

BOOLEAN out;

if (n < DIO_MAX_DO) { OS_ENTER_CRITICAL ( ) ; out = DOTbl [n] .EOOut; OS_EXIT_CRITICAL ( ) ; retxjxn (out) ; } else {

return (FALSE);

**************************************************************************

* SEE IF BLINK IS ENABLED

* Description : See if blink mode is enabled.

* Arguments : pdo is a pointer to the discrete output data structure.

* Returns : TRUE if blinking is enabled

* FALSE otherwise *********************************************************************************************************

#if DO_BLINK_MODE_EN

static BOOLEAN DOIsBlinkEn (DIO_DO *pdo) {

BOOLEAN en;

switch (pdo->DOBlinkEnSel) {

case DO_ELINK_EN: /* Blink is always enabled */

case DO_BLINK_EN_NORMAL: /* Blink depends on user request's state */

case DO_BLINK_EN_INV: /* Blink depends on the ccnplemented user request's state */

#endif

Was this article helpful?

0 0

Post a comment