update hardware init

This commit is contained in:
不吃油炸鸡
2025-09-11 16:34:17 +08:00
parent af387f6d02
commit 193844857a

View File

@@ -49,18 +49,23 @@ void HardwareInitTask(void *argument)
// HAL_UART_Transmit_DMA(&huart6,(uint8_t *)"power-pico\r\n",13); // HAL_UART_Transmit_DMA(&huart6,(uint8_t *)"power-pico\r\n",13);
// ADC // ADC
HAL_ADC_Start_DMA(&hadc1, (uint32_t*)adc_packet.data, ADC_TIMES * ADC_CHANELS); /*启动ADC的DMA传输配合定时器触发ADC转换 12位的ADC对应0-4095 */ HAL_ADC_Start_DMA(&hadc1, (uint32_t *)adc_packet.data, ADC_TIMES * ADC_CHANELS); /*启动ADC的DMA传输配合定时器触发ADC转换 12位的ADC对应0-4095 */
HAL_TIM_Base_Start(&htim2); /*开启定时器用溢出时间来触发ADC*/ HAL_TIM_Base_Start(&htim2); /*开启定时器用溢出时间来触发ADC*/
adc_packet.header[0] = 0x55; adc_packet.header[0] = 0x55;
adc_packet.header[1] = 0xAA; adc_packet.header[1] = 0xAA;
adc_packet.header[2] = ADC_TIMES; adc_packet.header[2] = ADC_TIMES;
adc_packet.header[3] = ADC_CHANELS; adc_packet.header[3] = ADC_CHANELS;
// 填充模式位
adc_packet.header[4] = 0x10;
// gate, for current flow route selection, high current by default // gate, for current flow route selection, high current by default
Gate_Port_Init(); Gate_Port_Init();
flow_route_selection(HIGH_CUR); flow_route_selection(HIGH_CUR);
// FUSB CC dis connect
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET);
// PWM Start for LCD backlight // PWM Start for LCD backlight
HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_3); HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_3);