Exemplo n.º 1
0
// Recursive function to write each bit in proper order
void writePattern(HCNode * node, BitOutputStream& out)
{
    if(node->p != NULL)
    {
	writePattern(node->p, out);
	out.writeBit(node->isChild1);
    }
    return;
}
Exemplo n.º 2
0
//show 1 pattern
void SegDisp::showPattern(int digit, int pattern[7], int ms, bool dot){
	
	if (ms < 0){
		Error(12);
	}
	else if (digit > 3 || digit < 0){
		Error(13);
	}
	/*
	if we need to include the dot, do so
	Otherwise, just show the pattern
	*/
	writePattern(pattern,dot);
	digitOn(digit);
	delay(ms);
	digitOff(digit);
	digitalWrite(pins[7],LOW); //this is the dot
}
Exemplo n.º 3
0
//clear everything
void SegDisp::clear(){
	/*
	clear all of the pins
	*/
	writePattern(numbers[sd_EMPTY],false);
	/*
	turn off the colon
	*/
	colonOff();
	/*
	turn off the dot
	*/
	digitalWrite(pins[7],LOW);
	/*
	disconnect ground
	*/
	for (int x=0; x<4; x++){
		digitOff(x);
	}
}
Exemplo n.º 4
0
//make dot optional
void SegDisp::writePattern(int pattern[7]){
	writePattern(pattern[7], false);
}
Exemplo n.º 5
0
/** Write to the given BitOutputStream
 *  the sequence of bits coding the given symbol.
 *  PRECONDITION: build() has been called, to create the coding
 *  tree, and initialize root pointer and leaves vector.
 */
void HCTree::encode(byte symbol, BitOutputStream& out) const
{
   HCNode * node = leaves[(int) symbol];
   writePattern(node, out);
}