summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/ts_386ex/tools/ts_1325_ada/ts1325-button.adb
blob: cc273b0b3f626dac4a61a2a4d5b58691bfe72ae5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package body TS1325.Button is

   function Is_Button_Pressed return Boolean is
      State: Byte;
   begin
      Inport (Button_Port, State);
      return (State and Button_Mask) /= Button_Mask;
   end Is_Button_Pressed;

   procedure Wait_For_Button_Press is
   begin
  Poll_Loop:
      loop
         if Is_Button_Pressed then
            delay Minimum_Press_Time;
            exit Poll_Loop when Is_Button_Pressed;
         end if;
         delay Poll_Interval;
      end loop Poll_Loop;
   end Wait_For_Button_Press;

end TS1325.Button;