Typically, each peripheral will have control registers to configure the
peripheral, status registers to determine the current peripheral status, and
data registers to read data from and write data to the peripheral. Each GPIO
port (GPIOA, GPIOB, etc.) has seven registers. Two are used to configure
the sixteen port bits individually, two are used to read/write the sixteen port
bits in parallel, two are used to set/reset the sixteen port bits individually,
and one is used to implement a “locking sequence” that is intended to prevent
rogue code from accidentally modifying the port configuration. This final
feature can help minimize the possibility that software bugs lead to hardware
failures; e.g, accidentally causing a short circuit.