text stringlengths 0 234 |
|---|
-- Default mode -- |
pragma Assert (No_Pull_Wire.Point (1).Mode = Input, |
"Default point mode should be input"); |
-- State with only inputs and a wire pull resistor -- |
pragma Assert (Pull_Up_Wire.Point (1).Set, |
"Default state of pull up wire should be high"); |
pragma Assert (not Pull_Down_Wire.Point (1).Set, |
"Default state of pull down wire should be low"); |
-- State with only inputs and a point pull resistor -- |
pragma Assert (No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Up), |
"It should be possible to change the pull resitor"); |
pragma Assert (No_Pull_Wire.Point (1).Set, |
"State of wire with one pull up point should be high"); |
Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Down); |
pragma Assert (not No_Pull_Wire.Point (1).Set, |
"State of wire with one pull down point should be low"); |
-- State with one input one output and no pull resistor -- |
pragma Assert (No_Pull_Wire.Point (1).Set_Mode (Input), |
"It should be possible to change the mode"); |
Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Down); |
Unref := No_Pull_Wire.Point (2).Set_Mode (Output); |
Unref := No_Pull_Wire.Point (2).Set_Pull_Resistor (Floating); |
No_Pull_Wire.Point (2).Set; |
pragma Assert (No_Pull_Wire.Point (1).Set, "Should be high"); |
No_Pull_Wire.Point (2).Clear; |
pragma Assert (not No_Pull_Wire.Point (1).Set, "Should be low"); |
-- State with one input one output and point pull resistor -- |
Unref := No_Pull_Wire.Point (1).Set_Mode (Input); |
Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Up); |
Unref := No_Pull_Wire.Point (2).Set_Mode (Output); |
Unref := No_Pull_Wire.Point (2).Set_Pull_Resistor (Floating); |
No_Pull_Wire.Point (2).Set; |
pragma Assert (No_Pull_Wire.Point (1).Set, "Should be high"); |
No_Pull_Wire.Point (2).Clear; |
pragma Assert (not No_Pull_Wire.Point (1).Set, "Should be low"); |
Unref := No_Pull_Wire.Point (1).Set_Pull_Resistor (Pull_Down); |
No_Pull_Wire.Point (2).Set; |
pragma Assert (No_Pull_Wire.Point (1).Set, "Should be high"); |
No_Pull_Wire.Point (2).Clear; |
pragma Assert (not No_Pull_Wire.Point (1).Set, "Should be low"); |
-- Opposite pull on the same wire -- |
declare |
begin |
Unref := Pull_Down_Wire.Point (1).Set_Pull_Resistor (Pull_Up); |
exception |
when Invalid_Configuration => |
Put_Line ("Expected exception on oppposite pull (1)"); |
Function Definition: procedure TC_Log_Priorities is |
Function Body: Maximum_Message_Length : constant := 64; |
package Log is new Logging_With_Priority |
(Priorities => Natural, |
Maximum_Message_Length => Maximum_Message_Length, |
Maximum_Number_Of_Messages => 6); |
procedure Pop_And_Print; |
procedure Fill_Queue; |
procedure Empty_Queue; |
------------------- |
-- Pop_And_Print -- |
------------------- |
procedure Pop_And_Print is |
Str : String (1 .. Maximum_Message_Length); |
Length : Natural; |
Prio : Natural; |
begin |
Log.Pop (Str, Length, Prio); |
if Length /= 0 then |
Ada.Text_IO.Put_Line ("Prio:" & Prio'Img & " -> " & |
Str (Str'First .. Str'First + Length - 1)); |
else |
Ada.Text_IO.Put_Line ("Pop : The queue is empty"); |
end if; |
end Pop_And_Print; |
---------------- |
-- Fill_Queue -- |
---------------- |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.