OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [i386/] [ts_386ex/] [tools/] [ts_1325_ada/] [ts1325-led.adb] - Blame information for rev 609

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
package body TS1325.LED is
2
 
3
   protected body LED_State is
4
 
5
      function Get return LED_Colour is
6
         State: Byte;
7
         Red_On, Green_On: Boolean;
8
      begin
9
         Inport (LED_Port, State);
10
 
11
         Green_On := (State and Green_Bit) = Green_Bit;
12
         Red_On := (State and Red_Bit) /= Red_Bit;
13
 
14
         if not (Green_On or Red_On) then
15
            return Off;
16
         elsif Green_On and not Red_On then
17
            return Green;
18
         elsif Green_On and Red_On then
19
            return Yellow;
20
         else
21
            return Red;
22
         end if;
23
      end Get;
24
 
25
      procedure Set (Col: in LED_Colour) is
26
         State: Byte;
27
      begin
28
         Inport (LED_Port, State);
29
 
30
         case Col is
31
            when Off =>
32
               State := (State and not Green_Bit) or Red_Bit;
33
            when Green =>
34
               State := State or Green_Bit or Red_Bit;
35
            when Yellow =>
36
               State := (State or Green_Bit) and not Red_Bit;
37
            when Red =>
38
               State := State and not (Green_Bit or Red_Bit);
39
         end case;
40
 
41
         Outport (LED_Port, State);
42
      end Set;
43
 
44
   end LED_State;
45
 
46
end TS1325.LED;

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.