#include "procSwitch.h"

#define PROC_COLOR 0x7
procSwitch::procSwitch(RTKSemaphore *sem, SwitchPort *sp, Log *log) {
	this->sem = sem;
	this->ih = new IntHandler( 5, sem);
	this->sp = sp;
	this->log = log;
	LogData ld("Process Switch startet");
	this->log->skriv(ld);
}
void procSwitch::run() {
	WWindow *win = WNewWindow(5, 11, 36, 13, 500, PROC_COLOR, " SWITCH: ");
	LogData ld("Switch bliver opdateret");
	while (true) {
		WPutC( win, 0x0C );
		Wprintf( win, "Switches: ");
		for ( int i=0; i<=7; i++)
			Wprintf( win, "%d", sp->on(i) );
		RTKWait( *sem );
		this->log->skriv(ld);
	}
}