-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrobot_interface.adb
60 lines (48 loc) · 1.29 KB
/
robot_interface.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
with Digital_IO_Sim; use Digital_IO_Sim;
with System;
package body Robot_Interface is
protected Robot is
pragma Priority(System.Priority'Last-1);
procedure Move_Robot (Command: in Byte);
function Robot_State return Byte;
function Current_Command return Byte;
private
Last_Command_Applied: Byte := 0;
end Robot;
protected body Robot is
procedure Move_Robot (Command : in Byte) is
begin
Last_Command_Applied := Command;
Write_Low_Byte(Command);
end Move_Robot;
function Robot_State return Byte is
begin
return Read_Low_Byte;
end Robot_State;
function Current_Command return Byte is
begin
return Last_Command_Applied;
end Current_Command;
end Robot;
----------------
-- Move_Robot --
----------------
procedure Move_Robot (Command: in Byte) is
begin
Robot.Move_Robot(Command);
end Move_Robot;
-----------------
-- Robot_State --
-----------------
function Robot_State return Byte is
begin
return Robot.Robot_State;
end Robot_State;
-------------------
-- Robot_Command --
-------------------
function Robot_Command return Byte is
begin
return Robot.Current_Command;
end Robot_Command;
end Robot_Interface;