parent
38e6beaa95
commit
e06e59086f
|
@ -36,6 +36,10 @@ float g_temp_value;
|
|||
|
||||
void adc_2_temp(void)
|
||||
{
|
||||
if(adc_value_of_temp >= 4050)
|
||||
{
|
||||
adc_value_of_temp = 2048;
|
||||
}
|
||||
float r_of_temp_10 = 100.0 * (float)(adc_value_of_temp) * 10.0f / (4095.0f - (float)(adc_value_of_temp));
|
||||
|
||||
int i = 0;
|
||||
|
|
|
@ -63,7 +63,8 @@ void Error_Handler(void);
|
|||
#define LED_GPIO_Port GPIOB
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
#define WDI_Pin GPIO_PIN_1
|
||||
#define WDI_GPIO_Port GPIOB
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -55,6 +55,8 @@ void MX_GPIO_Init(void)
|
|||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(LED_GPIO_Port, LED_Pin, GPIO_PIN_RESET);
|
||||
|
||||
HAL_GPIO_WritePin(WDI_GPIO_Port, WDI_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin : HEAT_PORT_Pin */
|
||||
GPIO_InitStruct.Pin = HEAT_PORT_Pin;
|
||||
|
@ -70,6 +72,12 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(LED_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : WDI_Pin */
|
||||
GPIO_InitStruct.Pin = WDI_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(WDI_GPIO_Port, &GPIO_InitStruct);
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
|
|
@ -99,14 +99,13 @@ int main(void)
|
|||
/* USER CODE BEGIN 2 */
|
||||
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD>رռ<D8B1><D5BC><EFBFBD>
|
||||
stop_heat();
|
||||
init_ring_queue();
|
||||
uart_device_info *device_485 = get_handle_485();//485设备
|
||||
// init_ring_queue();
|
||||
// uart_device_info *device_485 = get_handle_485();//485设备
|
||||
|
||||
HAL_TIM_Base_Start_IT(&htim7);
|
||||
HAL_UART_Receive_IT(&huart3, rx_uart3_buf, 1);
|
||||
// HAL_UART_Receive_IT(&huart3, rx_uart3_buf, 1);
|
||||
HAL_ADCEx_Calibration_Start(&hadc2, ADC_SINGLE_ENDED);
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
|
@ -128,15 +127,16 @@ int main(void)
|
|||
if(g_tim7_500ms_flag)
|
||||
{
|
||||
g_tim7_500ms_flag = 0;
|
||||
HAL_GPIO_TogglePin(WDI_GPIO_Port, WDI_Pin);
|
||||
}
|
||||
// 1S<31><53><EFBFBD><EFBFBD>
|
||||
if(g_tim7_1000ms_flag)
|
||||
{
|
||||
g_tim7_1000ms_flag = 0;
|
||||
temp_ctrl();
|
||||
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
|
||||
adc_value_of_temp = get_adc_value();
|
||||
adc_2_temp();
|
||||
temp_ctrl();
|
||||
}
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -13,7 +13,7 @@
|
|||
<MemConfigValue>D:\Program Files\IAR Systems\arm\config\debugger\ST\STM32G431RB.ddf</MemConfigValue>
|
||||
</PlDriver>
|
||||
<DebugChecksum>
|
||||
<Checksum>3410310515</Checksum>
|
||||
<Checksum>1766344271</Checksum>
|
||||
</DebugChecksum>
|
||||
<Exceptions>
|
||||
<StopOnUncaught>_ 0</StopOnUncaught>
|
||||
|
|
Loading…
Reference in New Issue