5.1.6.1.2. Functional requirements
|
The system shall provide functionality to enable the clock for a specific GPIO port by setting the corresponding bit in the RCC->AHB1ENR register. |
System must support enabling clocks for all available GPIO ports |
System must ensure the clock enable process is completed before proceeding with any GPIO configuration |
The system shall allow each GPIO pin to be configured in one of four modes by updating the MODER register |
The pin mode configuration must validate the mode value and the pin number before applying changes. |
The system shall allow configuration of the GPIO output type using the OTYPER register. |
The system shall support Push-pull Mode (0). |
The system shall allow independent configuration of each pin on the port. |
The system shall allow the user to define the output speed for each GPIO pin by updating the OSPEEDR register. |
System shall ensure the speed settings match the timing requirements. |
The system must support the configuration of internal pull-up by modifying the PUPDR register, |
The system must support the configuration of internal pull-down resistors by modifying the PUPDR register, |
The function shall allow independent resistor configuration for each pin. |
For pins configured in alternate function mode, the system shall allow the alternate function to be set by updating the AFRL (for pins 0–7) |
System shall provide a way to assign an alternate function to a pin using its function number. |
The system shall allow direct control of the GPIO pin output state by modifying the Output Data Register (ODR) to directly set pin value |
The system shall allow direct control of the GPIO pin output state by modifying the Output Data Register (ODR) to directly reset pin value |
The system shall use Bit Set/Reset Register (BSRR) to atomically set state of GPIO pins. |
The system shall use Bit Set/Reset Register (BSRR) to atomically reset state of GPIO pins. |
A method for toggling the pin state shall also be provided. |
|
Each function shall validate input parameters. |
Each function shall return an appropriate status code for error handling. |
The system shall include a delay function that pauses execution for a specified number of milliseconds. |
The delay function shall be implemented using a simple loop mechanism or a timer for better accuracy. |