HAL.GPIO

Entities

Simple Types

Interface Types

Access Types

Subtypes

Subprograms

Description

---------------------------------------------------------------------------- -- 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. -- -- ----------------------------------------------------------------------------

Any_GPIO_Point

type Any_GPIO_Point is access all GPIO_Point'Class;

Capability

type Capability is (Unknown_Mode, Input, Output,
                    Floating, Pull_Up, Pull_Down);
Enumeration Literal
Unknown_Mode

Mode

Input

Mode

Output

Mode

Floating
Pull_Up
Pull_Down

Resistor

Clear

procedure Clear (This : in out GPIO_Point)
Parameters
This

GPIO_Config_Mode

subtype GPIO_Config_Mode is GPIO_Mode range Input .. Output;

Modes a GPIO point can be configured in

GPIO_Mode

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.

GPIO_Point

type GPIO_Point is limited interface;

GPIO_Pull_Resistor

subtype GPIO_Pull_Resistor is Capability range Floating .. Pull_Down;

Mode

function Mode (This : GPIO_Point) return GPIO_Mode

Return the current mode of the GPIO_Point

Parameters
This
Return Value

Pull_Resistor

function Pull_Resistor (This : GPIO_Point)
                        return GPIO_Pull_Resistor

Return the current pull resistor mode

Parameters
This
Return Value

Set

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.

Parameters
This
Return Value

Set

procedure Set (This : in out GPIO_Point)
Parameters
This

Set_Mode

procedure Set_Mode (This : in out GPIO_Point;
                    Mode : GPIO_Config_Mode)

Set the mode of the GPIO_Point, iff the mode is supported

Parameters
This
Mode

Set_Pull_Resistor

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

Parameters
This
Pull

Support

function Support (This : GPIO_Point;
                  Capa : Capability)
                  return Boolean

Return True if the GPIO_Point supports the given capability

Parameters
This
Capa
Return Value

Toggle

procedure Toggle (This : in out GPIO_Point)
Parameters
This