00001 /* ---------------------------------------------------------------------- 00002 * Copyright (C) 2010 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 29. November 2010 00005 * $Revision: V1.0.3 00006 * 00007 * Project: CMSIS DSP Library 00008 * Title: arm_pid_init_f32.c 00009 * 00010 * Description: Floating-point PID Control initialization function 00011 * 00012 * 00013 * Target Processor: Cortex-M4/Cortex-M3 00014 * 00015 * Version 1.0.3 2010/11/29 00016 * Re-organized the CMSIS folders and updated documentation. 00017 * 00018 * Version 1.0.2 2010/11/11 00019 * Documentation updated. 00020 * 00021 * Version 1.0.1 2010/10/05 00022 * Production release and review comments incorporated. 00023 * 00024 * Version 1.0.0 2010/09/20 00025 * Production release and review comments incorporated. 00026 * ------------------------------------------------------------------- */ 00027 00028 #include "arm_math.h" 00029 00048 void arm_pid_init_f32( 00049 arm_pid_instance_f32 * S, 00050 int32_t resetStateFlag) 00051 { 00052 00053 /* Derived coefficient A0 */ 00054 S->A0 = S->Kp + S->Ki + S->Kd; 00055 00056 /* Derived coefficient A1 */ 00057 S->A1 = (-S->Kp) - ((float32_t) 2.0 * S->Kd); 00058 00059 /* Derived coefficient A2 */ 00060 S->A2 = S->Kd; 00061 00062 /* Check whether state needs reset or not */ 00063 if(resetStateFlag) 00064 { 00065 /* Clear the state buffer. The size will be always 3 samples */ 00066 memset(S->state, 0, 3u * sizeof(float32_t)); 00067 } 00068 00069 } 00070