Subversion Repositories group.electronics

Rev

Rev 173 | Rev 180 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 173 Rev 175
Line 75... Line 75...
75
        public int bank { get; set; }
75
        public int bank { get; set; }
76
        public int pin { get; set; }
76
        public int pin { get; set; }
77
        public UInt16 address { get; set; }
77
        public UInt16 address { get; set; }
78
        public UInt16 mask { get; set; }
78
        public UInt16 mask { get; set; }
79
        public int shift { get; set; }
79
        public int shift { get; set; }
80
 
-
 
81
        public uint value { get; set; }
80
        public uint value { get; set; }
-
 
81
        private UInt16 prevdata;
82
 
82
 
83
        public Led(int bank, int pin, UInt16 address, UInt16 mask, int shift) {
83
        public Led(int bank, int pin, UInt16 address, UInt16 mask, int shift) {
84
            this.pin = pin;
84
            this.pin = pin;
85
            this.address = address;
85
            this.address = address;
86
            this.mask = mask;
86
            this.mask = mask;
Line 97... Line 97...
97
        public bool Tick(ref byte shadow) {
97
        public bool Tick(ref byte shadow) {
98
           
98
           
99
            UInt16 data;
99
            UInt16 data;
100
            byte tmpshadow = shadow;
100
            byte tmpshadow = shadow;
101
            if (Globals.BiosOutput.TryGetValue(this.address, out data)) {
101
            if (Globals.BiosOutput.TryGetValue(this.address, out data)) {
-
 
102
                // Only continue if the data parm has changed
-
 
103
                if (data == this.prevdata)
-
 
104
                    return false;
-
 
105
                this.prevdata = data;
102
 
106
 
103
                this.value = (UInt16)((data & mask) >> shift);
107
                this.value = (UInt16)((data & mask) >> shift);
104
 
108
 
105
                if (this.value == 1)
109
                if (this.value == 1)
106
                    Globals.setBit(ref shadow, this.pin);
110
                    Globals.setBit(ref shadow, this.pin);
107
                else
111
                else
108
                    Globals.clearBit(ref shadow, this.pin);
112
                    Globals.clearBit(ref shadow, this.pin);
109
            }
113
            }
110
 
114
 
-
 
115
            // Only update the led if the led value has changed
111
            if (tmpshadow == shadow)
116
            if (tmpshadow == shadow)
112
                return false;
117
                return false;
113
 
118
 
-
 
119
            // Return true to signal the panel to update the led
114
            return true;
120
            return true;
115
        }
121
        }
116
 
122
 
117
    }
123
    }
118
 
124