# Problem
You are provided with a set of C instructions for a program that reads from the A/D converter for the first potentiometer and writes the value to the LED array. Place each instruction in the appropriate code location group. Not all instructions that are provided are valid for the program.
Code location groups:
* Initialize all clocks.
* Initialize all hardware.
* `main()` function prior to the `while(1)` loop.
* `if` statement and code that goes inside the `if` statement's `{}`.
* Uncategorized.
Instructions:
* `GPIOD->MODER = 0x55555555; // All pins outputs`.
* `GPIOA->MODER = 0x0000000C0; // Pot 1`.
* `ADC1->CR2 |= 1; // Enable ADC1`.
* `ADC1->CR2 |= 1<<30; // Start first conversion`.
* `ADC1->CR2 |= 1<<30; // Start next conversion`.
* `if ((ADC1->SR & 1<<1) > 0)`.
* `RCC->AHB1ENR |= 1<<3; // Port D`.
* `GPIOD->ODR = ADC1->DR;`.
* `GPIOA->MODER = 0x55555555; // All pins outputs`.
* `RCC->AHB1ENR |= 1; // Port A`.
* `RCC->APB2ENR |= 1<<8; // ADC1`.
* `ADC1->SQR3 = 1; // Pot 1`.
* `ADC2-> |= 1; // Enable ADC2`.
# Process
...
# Answer
* Initialize all clocks.
* `RCC->AHB1ENR |= 1; // Port A`.
* `RCC->APB2ENR |= 1<<8; // ADC1`.
* `RCC->AHB1ENR |= 1<<3; // Port D`.
* Initialize all hardware.
* `GPIOD->MODER = 0x55555555; // All pins outputs`.
* `GPIOA->MODER = 0x0000000C0; // Pot 1`.
* `ADC1->CR2 |= 1; // Enable ADC1`.
* `ADC1->SQR3 = 1; // Pot 1`.
* `main()` function prior to the `while(1)` loop.
* `ADC1->CR2 |= 1<<30; // Start first conversion`.
* `if` statement and code that goes inside the `if` statement's `{}`.
* `if ((ADC1->SR & 1<<1) > 0)`.
* `GPIOD->ODR = ADC1->DR;`.
* `ADC1->CR2 |= 1<<30; // Start next conversion`.
* Uncategorized.
* `ADC2-> |= 1; // Enable ADC2`.
* `GPIOA->MODER = 0x55555555; // All pins outputs`.