DCL Common Support Structures

Module: Digital Control Library (DCL)

More…

Structures

Name

struct

DCL_CSS
Defines the controller common support structure.

struct

DCL_CSSF64
Defines the 64bit CSS structure.

Types

Name

enum

DCL_status_bits { DCL_STS_NONE = 0U, DCL_STS_PARAM_UPDATE = (1U << 0), DCL_STS_CTRL_RUNNING = (1U << 1)}
Defines the library enumerated status bits.

Defines

Name

DCL_CSS_DEFAULTS
Default values to initialize the CSS structure.

DCL_CSSF64_DEFAULTS
Default values to initialize the CSS 64bit structure.

DCL_setControllerPeriod(p, t_sec)
Loads the controller period in the CSS CSS pointer must be configured first.

DCL_setUpdateStatus(p)
Macros to set the update-in-progress flag.

DCL_clearUpdateStatus(p)
Macro to clear the update-in-progress flag.

DCL_getUpdateStatus(p)
Determine whether a parameter update-in-progress flag is set.

DCL_setControllerStatus(p)
Macros placed at the beginning and end of the controller so that other functions know a control operation is in progress. Typically only used with complex controllers which may not be atomic.

DCL_clearControllerStatus(p)
See DCL_setControllerStatus.

DCL_getControllerStatus(p)
Determine whether a controller operation-in-progress flag is set.

Detailed Description

Defines Controller Common Support Structure (CSS) and related macros

Types Documentation

enum DCL_status_bits

Enumerator

Value

Description

DCL_STS_NONE

0U

Status empty.

DCL_STS_PARAM_UPDATE

(1U << 0)

Parameter update-in-progress flag, high if ongoing parameter update.

DCL_STS_CTRL_RUNNING

(1U << 1)

Controller operation-in-progress flag, high if operation is in progress.

Defines the library enumerated status bits.

To perform a safe parameter update, the user first loads new parameter into the controller’s SPS. Then either invoke DCL_update() for an one-time update, or in the case of an ISR routine update, the user could use DCL_setPendingStatus() to indicate an pending update. In which the next call to DCL_pendingUpdate() would update the controller parameter and clear the flag.

Both DCL_update() and DCL_pendingUpdate() disables global interrupts to ensure a safe update.

Macros Documentation

define DCL_CSS_DEFAULTS

#define DCL_CSS_DEFAULTS {0.0f, DCL_DEFAULT_PERIOD_S, 0U, 0U, 0U, NULL}

Default values to initialize the CSS structure.

define DCL_CSSF64_DEFAULTS

#define DCL_CSSF64_DEFAULTS {0.0L, DCL_DEFAULT_PERIODF64_S, 0U, 0U, 0U, NULL}

Default values to initialize the CSS 64bit structure.

define DCL_setControllerPeriod

#define DCL_setControllerPeriod(
    p,
    t_sec
)
((p)->css->T = t_sec)

Loads the controller period in the CSS CSS pointer must be configured first.

Parameters:

  • p Pointer to the controller structure

  • t_sec Controller period in seconds

Return: None

define DCL_setUpdateStatus

#define DCL_setUpdateStatus(
    p
)
((p)->css->sts |= DCL_STS_PARAM_UPDATE)

Macros to set the update-in-progress flag.

define DCL_clearUpdateStatus

#define DCL_clearUpdateStatus(
    p
)
((p)->css->sts &= ~DCL_STS_PARAM_UPDATE)

Macro to clear the update-in-progress flag.

define DCL_getUpdateStatus

#define DCL_getUpdateStatus(
    p
)
(0U != ((p)->css->sts & DCL_STS_PARAM_UPDATE))

Determine whether a parameter update-in-progress flag is set.

Return: ‘true’ if update status is set, otherwise false

define DCL_setControllerStatus

#define DCL_setControllerStatus(
    p
)
((p)->css->sts |= DCL_STS_CTRL_RUNNING)

Macros placed at the beginning and end of the controller so that other functions know a control operation is in progress. Typically only used with complex controllers which may not be atomic.

define DCL_clearControllerStatus

#define DCL_clearControllerStatus(
    p
)
((p)->css->sts &= ~DCL_STS_CTRL_RUNNING)

See DCL_setControllerStatus.

define DCL_getControllerStatus

#define DCL_getControllerStatus(
    p
)
(0U != ((p)->css->sts & DCL_STS_CTRL_RUNNING))

Determine whether a controller operation-in-progress flag is set.

Return: ‘true’ if controller running flag is set, otherwise false