void IrSenderPwm::send(const IrSequence& irSequence, frequency_t frequency) { enable(frequency/1000); for (unsigned int i = 0; i < irSequence.getLength(); i++) { digitalWrite(getOutputPin(), (i & 1) ? LOW : HIGH); if (i & 1) { IR_SEND_PWM_STOP; } else { IR_SEND_PWM_START; } delayUSecs(irSequence.getDurations()[i]); } digitalWrite(getOutputPin(), LOW); }
void Switch::DrawConnections(ApplicationManager*A) { int N=m_OutputPin.ConnectedNo() ; for (int i = 0; i<N; i++) { if(m_OutputPin.getInputPins()[i]->getConnected()) { Component*pComp2=A->getComponent(m_OutputPin.getInputPins()[i]); //A->DrawConnection(this,pComp2); GraphicsInfo G1,G2; G1=this->getgraphicsinfo(); G2=pComp2->getgraphicsinfo(); for (int j=0;j<pComp2->getInputs();j++) { if (m_OutputPin.getInputPins()[i]==&pComp2->getInputPin()[j]) { if(!simulation) A->DrawLine(G1.x2,G1.y1+getOutputPin()->getPinInfo().y, G2.x1,G2.y1+pComp2->getInputPin()[j].getPinInfo().y); else { if(m_OutputPin.getStatus()==LOW) { A->DrawLine(G1.x2,G1.y1+getOutputPin()->getPinInfo().y, G2.x1,G2.y1+pComp2->getInputPin()[j].getPinInfo().y,RED); } else A->DrawLine(G1.x2,G1.y1+getOutputPin()->getPinInfo().y, G2.x1,G2.y1+pComp2->getInputPin()[j].getPinInfo().y,BLUE); } } } } } }
bool stateLed(Led* led) { return getOutputPin(led->pin); }