Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_q31.c')
-rw-r--r--Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_q31.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_q31.c b/Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_q31.c
index 17b3b094e..1625a5f2f 100644
--- a/Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_q31.c
+++ b/Drivers/CMSIS/DSP/Source/ControllerFunctions/arm_pid_init_q31.c
@@ -3,13 +3,13 @@
* Title: arm_pid_init_q31.c
* Description: Q31 PID Control initialization function
*
- * $Date: 27. January 2017
- * $Revision: V.1.5.1
+ * $Date: 18. March 2019
+ * $Revision: V1.6.0
*
* Target Processor: Cortex-M cores
* -------------------------------------------------------------------- */
/*
- * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
+ * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -28,22 +28,24 @@
#include "arm_math.h"
- /**
- * @addtogroup PID
- * @{
+/**
+ @addtogroup PID
+ @{
*/
/**
- * @brief Initialization function for the Q31 PID Control.
- * @param[in,out] *S points to an instance of the Q31 PID structure.
- * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
- * @return none.
- * \par Description:
- * \par
- * The <code>resetStateFlag</code> specifies whether to set state to zero or not. \n
- * The function computes the structure fields: <code>A0</code>, <code>A1</code> <code>A2</code>
- * using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd)
- * also sets the state variables to all zeros.
+ @brief Initialization function for the Q31 PID Control.
+ @param[in,out] S points to an instance of the Q31 PID structure
+ @param[in] resetStateFlag
+ - value = 0: no change in state
+ - value = 1: reset state
+ @return none
+
+ @par Details
+ The <code>resetStateFlag</code> specifies whether to set state to zero or not. \n
+ The function computes the structure fields: <code>A0</code>, <code>A1</code> <code>A2</code>
+ using the proportional gain( \c Kp), integral gain( \c Ki) and derivative gain( \c Kd)
+ also sets the state variables to all zeros.
*/
void arm_pid_init_q31(
@@ -53,20 +55,15 @@ void arm_pid_init_q31(
#if defined (ARM_MATH_DSP)
- /* Run the below code for Cortex-M4 and Cortex-M3 */
-
/* Derived coefficient A0 */
S->A0 = __QADD(__QADD(S->Kp, S->Ki), S->Kd);
/* Derived coefficient A1 */
S->A1 = -__QADD(__QADD(S->Kd, S->Kd), S->Kp);
-
#else
- /* Run the below code for Cortex-M0 */
-
- q31_t temp;
+ q31_t temp; /* to store the sum */
/* Derived coefficient A0 */
temp = clip_q63_to_q31((q63_t) S->Kp + S->Ki);
@@ -84,12 +81,12 @@ void arm_pid_init_q31(
/* Check whether state needs reset or not */
if (resetStateFlag)
{
- /* Clear the state buffer. The size will be always 3 samples */
+ /* Reset state to zero, The size will be always 3 samples */
memset(S->state, 0, 3U * sizeof(q31_t));
}
}
/**
- * @} end of PID group
+ @} end of PID group
*/