---------------------------------------------------------------------------- -- Copyright (C) 2015-2018, AdaCore -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are -- met: -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in -- the documentation and/or other materials provided with the -- distribution. -- 3. Neither the name of the copyright holder nor the names of its -- contributors may be used to endorse or promote products derived -- from this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- ----------------------------------------------------------------------------
type Any_GPIO_Point is access all GPIO_Point'Class;
type Capability is (Unknown_Mode, Input, Output,
Floating, Pull_Up, Pull_Down);
Mode
Mode
Mode
Resistor
procedure Clear (This : in out GPIO_Point)
subtype GPIO_Config_Mode is GPIO_Mode range Input .. Output;
Modes a GPIO point can be configured in
subtype GPIO_Mode is Capability range Unknown_Mode .. Output;
Possible modes for a GPIO point. Unknown_Mode means that the point is configured in a mode that is not described in this interface. For instance alternate function mode on an STM32 micro-controller.
type GPIO_Point is limited interface;
subtype GPIO_Pull_Resistor is Capability range Floating .. Pull_Down;
function Mode (This : GPIO_Point) return GPIO_Mode
Return the current mode of the GPIO_Point
function Pull_Resistor (This : GPIO_Point)
return GPIO_Pull_Resistor
Return the current pull resistor mode
function Set (This : GPIO_Point) return Boolean
Read actual state of the GPIO_Point.
So far all the GPIO supported by this library have the ability to read the state even when they are configured as output.
procedure Set (This : in out GPIO_Point)
procedure Set_Mode (This : in out GPIO_Point;
Mode : GPIO_Config_Mode)
Set the mode of the GPIO_Point, iff the mode is supported
procedure Set_Pull_Resistor (This : in out GPIO_Point;
Pull : GPIO_Pull_Resistor)
Set the pull resistor of the GPIO_Point, iff the pull mode is supported
function Support (This : GPIO_Point;
Capa : Capability)
return Boolean
Return True if the GPIO_Point supports the given capability
procedure Toggle (This : in out GPIO_Point)