/* Test pattern */ void test(void) { // turn all lights on - 10s allOn(); _delay_ms(10000); clear(); // cycle through a test pattern for (int i = 0; i < 5; i++) { for (int column = 0; column < 16; column++) { clear(); if (column < 8) { PORTB = 0x01 << column; PORTD = 0x00; } else { PORTD = 0x01 << (column - 8); PORTB = 0x00; } PORTA = 0x00; _delay_ms(50); } } for(int i = 0; i < 5; i++) { for(int j = 0; j < 8; j++) { clear(); for (int column = 0; column < 16; column++) { if (column < 8) { PORTB = 0x01<<column; PORTD = 0x00; } else { PORTD = 0x01 << (column - 8); PORTB = 0x00; } PORTA = ~(0x01 << j); _delay_ms(1); } _delay_ms(200); } } // turn all on again - 10s allOn(); _delay_ms(10000); clear(); }
void Flash() { // // Briefly flashes all the LEDs // allOn(); wait1Msec(150); allOff(); wait1Msec(150); }
bool OCGs::optContentIsVisible( Object *dictRef ) { Object dictObj; Dict *dict; Object dictType; Object ocg; Object policy; bool result = true; dictRef->fetch( m_xref, &dictObj ); if ( ! dictObj.isDict() ) { error(-1, "Unexpected oc reference target: %i", dictObj.getType() ); dictObj.free(); return result; } dict = dictObj.getDict(); // printf("checking if optContent is visible\n"); dict->lookup("Type", &dictType); if (dictType.isName("OCMD")) { // If we supported Visibility Expressions, we'd check // for a VE entry, and then call out to the parser here... // printf("found OCMD dict\n"); dict->lookup("P", &policy); dict->lookupNF("OCGs", &ocg); if (ocg.isArray()) { if (policy.isName("AllOn")) { result = allOn( ocg.getArray() ); } else if (policy.isName("AllOff")) { result = allOff( ocg.getArray() ); } else if (policy.isName("AnyOff")) { result = anyOff( ocg.getArray() ); } else if ( (!policy.isName()) || (policy.isName("AnyOn") ) ) { // this is the default result = anyOn( ocg.getArray() ); } } else if (ocg.isRef()) { OptionalContentGroup* oc = findOcgByRef( ocg.getRef() ); if ( !oc || oc->getState() == OptionalContentGroup::Off ) { result = false; } else { result = true ; } } ocg.free(); policy.free(); } else if ( dictType.isName("OCG") ) { OptionalContentGroup* oc = findOcgByRef( dictRef->getRef() ); if ( !oc || oc->getState() == OptionalContentGroup::Off ) { result=false; } } dictType.free(); dictObj.free(); // printf("visibility: %s\n", result? "on" : "off"); return result; }
void loop() { switch (program) { case 0: allOn(); break; case 1: blink(); break; case 2: fade(); break; case 3: flash(); break; case 4: sleep(); break; default: allOn(); } }