Hardware Reference
In-Depth Information
77 attrset(A_NORMAL);
78 addstr("Off"); /
LED is now off
/
∗
∗
79 }
80 }
81
82 attrset(A_NORMAL);
83 if ( SW1 >= 0 || LED >= 0 )
84 mvprintw(7,15,"ONLINE ");
85 move(7, 12);
86 refresh();
87 mutex_unlock(); /
Release hold on curses
/
∗
∗
88 }
89
90 /
∗
91
Post online status to screen
∗
92
/
93 static void
94 post_offline(void) {
95
96 SW1 = −1;
97 LED = −1;
98
99 mutex_lock(); /
∗
Lock for shared curses access
/
∗
∗
100 attrset(A_REVERSE|A_BLINK);
101 mvprintw(7,15,"OFFLINE");
102 refresh();
103 mutex_unlock(); /
Done with curses
/
∗
∗
104
105 post_LED();
106 post_SW1();
107 }
108
109 /
∗
110
Main console thread for command center
∗
111
/
112 static void
∗
∗
113 command_center(void
ignored) {
∗
114 int rc;
115
116 post_LED(); /
Post unknown LED status
/
∗
∗
117 post_SW1(); /
Post unknown SW1 status
/
∗
∗
118
119 for (;;) {
120 mutex_lock(); /
Lock curses
/
∗
∗
121 move (7,12); /
Move cursor to command point
/
∗
∗
122 refresh();
123 mutex_unlock(); /
Release curses
/
∗
∗
124