UIMainEventListeningThread::~UIMainEventListeningThread() { /* Make a request to shutdown: */ setShutdown(true); /* And wait 30 seconds for run() to finish (1 sec increments to help with delays incurred debugging and prevent suicidal use-after-free behaviour): */ uint32_t i = 30000; do wait(1000); while (i-- > 0 && !isFinished()); }
void max7221::init() { /* * set the pin configuration and default values to initially turn on the chip. * this function has to be called EXACTLY one time before any data is pushed to the chip. * it is NOT a class constructor, because we will use multiple instances of this class */ pinMode( _pinCLK, OUTPUT ); pinMode( _pinDATA, OUTPUT ); pinMode( _pinLOAD, OUTPUT ); for( int i = 0; i < _chipcount; i++ ) { selectChip(i); setDecodeMode( 0x00 ); //use a custom matrix on all registers setIntensity( 0x0f ); //use maximum intensity setScanLimit( 0x07 ); //use all 8 available registers setShutdown( 0x01 ); //wake up setDisplayTest( 0x00 ); //no display test } selectChip(0);//reset to default first chip for backwards compatibility }
Server::~Server() { setShutdown(); }