增加电流驱动芯片复位接口
authorkyz <kongyuzhong@google.com>
Wed, 20 Aug 2025 03:15:16 +0000 (11:15 +0800)
committerkyz <kongyuzhong@google.com>
Thu, 28 Aug 2025 01:03:39 +0000 (09:03 +0800)
user/user_proportionvalve.c

index 462f2c8e424cebe6387fdfe0adba3439de09c9eb..8bb762bb9235b2171bb75a4d879414dcee0de569 100644 (file)
@@ -108,3 +108,36 @@ void lt3092_set_current( float current )
       R_set = current/2/0.000010f * R_out;
       ad5245_set_res( R_set );
 }
+
+static void __delay_us( uint32_t us )
+{
+       volatile int i;
+
+       for( i=0; i<us*1000; i++ )
+               ;
+}
+
+void lt3092_reset( void )
+{
+       GPIO_InitTypeDef GPIO_InitStruct = {0};
+
+       HAL_GPIO_WritePin( PB7_AA1_GPIO_Port, PB7_AA1_Pin, GPIO_PIN_RESET );
+
+       /*Configure output */
+       GPIO_InitStruct.Pin = PB7_AA1_Pin;
+       GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+       GPIO_InitStruct.Pull = GPIO_NOPULL;
+       GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+       HAL_GPIO_Init( PB7_AA1_GPIO_Port, &GPIO_InitStruct);
+
+       HAL_GPIO_WritePin( PB7_AA1_GPIO_Port, PB7_AA1_Pin, GPIO_PIN_SET );
+       __delay_us(1);
+       HAL_GPIO_WritePin( PB7_AA1_GPIO_Port, PB7_AA1_Pin, GPIO_PIN_RESET );
+
+       /*Configure input */
+       GPIO_InitStruct.Pin = PB7_AA1_Pin;
+       GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
+       GPIO_InitStruct.Pull = GPIO_NOPULL;
+       GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+       HAL_GPIO_Init( PB7_AA1_GPIO_Port, &GPIO_InitStruct);
+}