40 lines
1.4 KiB
Ada
40 lines
1.4 KiB
Ada
package STM32.GPIO.Ports is
|
|
|
|
-- Single GPIO pin
|
|
generic
|
|
Register : in out GPIO_Registers;
|
|
Bit : Port_Bit_Number;
|
|
Invert : Boolean := False;
|
|
package GPIO_Port_Boolean is
|
|
procedure Set (Value : Boolean) with Inline; -- Output to port
|
|
function Value return Boolean with Inline; -- Read port
|
|
|
|
-- Shortcuts to manipulate ports
|
|
procedure Set_MODER (Mode : Port_Mode) with Inline;
|
|
procedure Set_OTYPER (Output : Output_Type) with Inline;
|
|
procedure Set_OSPEEDR (Speed : Output_Speed) with Inline;
|
|
procedure Set_PUPDR (Pull : Port_Pull) with Inline;
|
|
procedure Set_AFR (Value : Alternate_Function) with Inline;
|
|
end GPIO_Port_Boolean;
|
|
|
|
-- Multi-pin GPIO
|
|
generic
|
|
type Value_Type is mod <>;
|
|
Register : in out GPIO_Registers;
|
|
First_Bit : Port_Bit_Number;
|
|
Last_Bit : Port_Bit_Number;
|
|
Invert : Value_Type := 0;
|
|
package GPIO_Port_Modular is
|
|
procedure Set(Value: Value_Type) with Inline;
|
|
function Value return Value_Type with Inline;
|
|
|
|
-- Shortcuts to manipulate ports
|
|
procedure Set_MODER (Mode : Port_Mode) with Inline;
|
|
procedure Set_OTYPER (Output : Output_Type) with Inline;
|
|
procedure Set_OSPEEDR (Speed : Output_Speed) with Inline;
|
|
procedure Set_PUPDR (Pull : Port_Pull) with Inline;
|
|
procedure Set_AFR (Value : Alternate_Function) with Inline;
|
|
end GPIO_Port_Modular;
|
|
|
|
end STM32.GPIO.Ports;
|