clean up llm code and test all ADCs successfully
This commit is contained in:
@ -46,7 +46,7 @@ void MX_ADC1_Init(void)
|
||||
*/
|
||||
hadc1.Instance = ADC1;
|
||||
hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV2;
|
||||
hadc1.Init.Resolution = ADC_RESOLUTION_16B;
|
||||
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
|
||||
hadc1.Init.ScanConvMode = ADC_SCAN_ENABLE;
|
||||
hadc1.Init.EOCSelection = ADC_EOC_SEQ_CONV;
|
||||
hadc1.Init.LowPowerAutoWait = DISABLE;
|
||||
|
||||
@ -112,7 +112,6 @@ int main(void)
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
|
||||
if (HAL_ADC_Start_DMA(&hadc1, (uint32_t*)adc_values, 16) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
@ -120,11 +119,6 @@ int main(void)
|
||||
|
||||
HAL_TIM_Base_Start(&htim6);
|
||||
|
||||
if (!(hadc1.Instance->CR & ADC_CR_ADSTART))
|
||||
{
|
||||
Error_Handler(); // ADC not started
|
||||
}
|
||||
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
@ -135,12 +129,6 @@ int main(void)
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
volatile uint32_t counter = __HAL_TIM_GET_COUNTER(&htim6);
|
||||
|
||||
volatile uint32_t adc_cr = (hadc1.Instance->CR);
|
||||
|
||||
volatile uint32_t adc_values_adress = (uint32_t)adc_values;
|
||||
|
||||
HAL_GPIO_WritePin(STATUS_G_GPIO_Port, STATUS_G_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(500);
|
||||
HAL_GPIO_WritePin(STATUS_G_GPIO_Port, STATUS_G_Pin, GPIO_PIN_RESET);
|
||||
@ -224,7 +212,10 @@ static void MX_NVIC_Init(void)
|
||||
/* USER CODE BEGIN 4 */
|
||||
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
|
||||
{
|
||||
HAL_GPIO_WritePin(STATUS_R_GPIO_Port, STATUS_R_Pin, GPIO_PIN_SET);
|
||||
if (hadc->Instance == ADC1)
|
||||
{
|
||||
__asm volatile ("NOP");
|
||||
}
|
||||
}
|
||||
/* USER CODE END 4 */
|
||||
|
||||
@ -236,6 +227,7 @@ void Error_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN Error_Handler_Debug */
|
||||
/* User can add his own implementation to report the HAL error return state */
|
||||
HAL_GPIO_WritePin(STATUS_R_GPIO_Port, STATUS_R_Pin, GPIO_PIN_SET);
|
||||
__disable_irq();
|
||||
while (1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user