DCL Common Support Structures
Module: Digital Control Library (DCL)
Structures
Name |
|
|---|---|
struct |
DCL_CSS |
struct |
DCL_CSSF64 |
Types
Name |
|
|---|---|
enum |
DCL_status_bits { DCL_STS_NONE = 0U, DCL_STS_PARAM_UPDATE = (1U << 0), DCL_STS_CTRL_RUNNING = (1U << 1)} |
Defines
Name |
|
|---|---|
DCL_CSS_DEFAULTS |
|
DCL_CSSF64_DEFAULTS |
|
DCL_setControllerPeriod(p, t_sec) |
|
DCL_setUpdateStatus(p) |
|
DCL_clearUpdateStatus(p) |
|
DCL_getUpdateStatus(p) |
|
DCL_setControllerStatus(p) |
|
DCL_getControllerStatus(p) |
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)
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