Subversion Repositories group.electronics

Rev

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

Rev 171 Rev 172
Line 7... Line 7...
7
 
7
 
8
namespace nitdcscore {
8
namespace nitdcscore {
9
    public class NitMultiPanel : Panel {
9
    public class NitMultiPanel : Panel {
10
 
10
 
11
        private mcp23017[] chips;
11
        private mcp23017[] chips;
12
 
12
        
13
        public NitMultiPanel(mcp2221 mcp) : base(mcp) {
13
        public NitMultiPanel(mcp2221 mcp) : base(mcp) {
14
            chips = new mcp23017[2] { new mcp23017(mcp, 0x20), new mcp23017(mcp, 0x24) };
14
            chips = new mcp23017[2] { new mcp23017(mcp, 0x20), new mcp23017(mcp, 0x24) };
15
 
15
 
16
            this.Init();
16
            this.Init();
17
        }
17
        }
Line 112... Line 112...
112
 
112
 
113
            chips[1].SetIODirection(0x00, 0xff);
113
            chips[1].SetIODirection(0x00, 0xff);
114
            chips[1].SetIOPolarity(0x00, 0xff);
114
            chips[1].SetIOPolarity(0x00, 0xff);
115
            chips[1].SetIOPullups(0x00, 0xff);
115
            chips[1].SetIOPullups(0x00, 0xff);
116
 
116
 
117
            new Led(chips[1], 0, 1, 0x1112, 0x0002, 1);     // NMSP_ANCHR_LED
117
            this.addLed(new Led(0, 1, 0x1112, 0x0002, 1));     // NMSP_ANCHR_LED
118
            new Led(chips[1], 0, 4, 0x1110, 0x0800, 11);    // NMSP_EGI_LED
118
            this.addLed(new Led(0, 4, 0x1110, 0x0800, 11));    // NMSP_EGI_LED
119
            new Led(chips[1], 0, 6, 0x11bc, 0x0004, 2);     // NMSP_FM_LED
119
            this.addLed(new Led(0, 6, 0x11bc, 0x0004, 2));     // NMSP_FM_LED
120
            new Led(chips[1], 0, 5, 0x1110, 0x0200, 9);     // NMSP_HARS_LEF
120
            this.addLed(new Led(0, 5, 0x1110, 0x0200, 9));     // NMSP_HARS_LEF
121
            new Led(chips[1], 0, 3, 0x1112, 0x0020, 5);     // NMSP_ILS_LED
121
            this.addLed(new Led(0, 3, 0x1112, 0x0020, 5));     // NMSP_ILS_LED
122
            new Led(chips[1], 0, 0, 0x1110, 0x8000, 15);    // NMSP_STEERPT_LED
122
            this.addLed(new Led(0, 0, 0x1110, 0x8000, 15));    // NMSP_STEERPT_LED
123
            new Led(chips[1], 0, 2, 0x1112, 0x0008, 3);     // NMSP_TCN_LED
123
            this.addLed(new Led(0, 2, 0x1112, 0x0008, 3));     // NMSP_TCN_LED
124
            new Led(chips[1], 0, 7, 0x11bc, 0x0002, 1);     // NMSP_UHF_LED
124
            this.addLed(new Led(0, 7, 0x11bc, 0x0002, 1));     // NMSP_UHF_LED
125
 
125
 
126
            this.Refresh();
126
            this.Refresh();
127
            data.prev = data.buttons;
127
            data.prev = data.buttons;
128
            data.axis[0].prev = data.axis[0].value;
128
            data.axis[0].prev = data.axis[0].value;
129
            data.axis[1].prev = data.axis[1].value;
129
            data.axis[1].prev = data.axis[1].value;
Line 154... Line 154...
154
            if (data.buttons != data.prev)
154
            if (data.buttons != data.prev)
155
                data.changed = true;
155
                data.changed = true;
156
            else
156
            else
157
                data.changed = false;
157
                data.changed = false;
158
 
158
 
-
 
159
 
-
 
160
            byte ledByte = (byte)(data.buttons >> 16);
-
 
161
            foreach (Led led in this.leds) {
-
 
162
                if (led.Tick(ref ledByte)) {
-
 
163
                    Console.WriteLine("Led: " + ledByte);
-
 
164
                    chips[1].SetBank(led.bank, ledByte);
-
 
165
                }
-
 
166
            }
-
 
167
 
159
            return rslt;
168
            return rslt;
160
        }
169
        }
161
 
170
 
162
        public override int Input() {
171
        public override int Input() {
163
            //Console.WriteLine(input.curr.ToString("X"));
172
            //Console.WriteLine(input.curr.ToString("X"));