AdaCore / Ada_Drivers_Library

Ada source code and complete sample GNAT projects for selected bare-board platforms supported by GNAT.
BSD 3-Clause "New" or "Revised" License
240 stars 141 forks source link

robust, safer version of GPIO_Port_Config and Configure_IO routine #228

Closed pat-rogers closed 6 years ago

pat-rogers commented 6 years ago

Now type GPIO_Port_Configuration is a discriminated record with a variant part, so we cannot accidentally specify configuration components that don't apply to the specified mode. The record type now also includes the alternate function component value so that when Mode_AF is specified the AF value must also be specified. The procedure Configure_IO now also configures the AF value. Note that the separate procedure for configuring the AF value is still available, and occasionally useful.

The code now uses aggregates for most uses of GPIO_Port_Configuration values and caught a couple of places where some expected values were not specified (the pin speed, in particular).

I compiled everything using this type but not the OpenMV2 stuff, for lack of a toolchain and board. I compiled and tested all the STM32 boards stuff but did not test the F769 Disco stuff for lack of a board. I did test it on the F746.