Last modified: Jun 3 1998 

FAQ - Project 1

 Why do I get linker errors when referencing the variable writeOutRegisterShadow?

The variable writeOutRegisterShadow must be declared in the file frontpanel.cc since it is declared static in the class. There is only one instance of writeOutRegisterShadow which is shared by all instances derived from the class LED.

byte LED::writeOutRegisterShadow = 0x38;

How are parameters sent into the constructor of the class LED?

It is possible to explicitly specify the constructor which should be used in C++. If no specification is given, the compiler automatically uses the default constructors in the base classes and all objects in the derived class. The implementation of the constructor in the class FrontPanel should initialise the LED instances according to

FrontPanel::FrontPanel():
 Job(),
 mySemaphore(Semaphore::createQueueSemaphore("FP",0)),
 myNetworkLED(networkLedId),
 myCDLED(cdLedId),
 myStatusLED(statusLedId)
{
 cout << "FrontPanel created." << endl;
 Job::schedule(this);
}

Nothing happens!?

There are many reasons for nothing to happen. One possible reason is that you forgot to schedule the thread.

Why are the timers not started?

All periodic timers must be explicitly started by the method startPeriodicTimer. Instances of the class Timed only depend on the method timeOutAfter.

How is the front panel accessed?

The front panel is referenced by the method instance

FrontPanel::instance().notifyLedEvent(FrontPanel::cdLedId);

What does volatile mean?

*(volatile byte*)0x80000000 = 0x08;

The purpose of the reserved word volatile is to force an implementation to suppress optimization that could otherwise occur. For example, for a machine with memory-mapped input/output, a pointer to a device register might be declared as a pointer to volatile, in order to prevent the compiler from removing apparently redundant references through the pointer.