void test_invalid_timer() { t = Invalid(Timer); TEST_ASSERT_FALSE_MESSAGE(isPwmTimer(t), "invalid timer should not be pwm"); TEST_ASSERT_FALSE_MESSAGE(IsValid(getTimerOutputPin(t)), "invalid timer should not have output pin"); setTimerValue(t, 23); // Check for no segfault. TEST_ASSERT_EQUAL_MESSAGE(0, getTimerValue(t), "invalid timer should have 0 timer value"); }
// Sets the timer value bool Timer::setSlotTimerValue(const Time* const msg) { bool ok = false; if (msg != 0) { double sec = Seconds::convertStatic(*msg); ok = setTimerValue(sec); if (ok) setCurrentTime(sec); } return ok; }
InstructionWidget::InstructionWidget(QWidget* parent) : QWidget(parent), insObs(0), timer(new TimerWidget(this)) { setupUi(this); timer->setVisible(false); connect( checkBox_showTimer, SIGNAL(stateChanged(int)), this, SLOT(setHasTimer()) ); connect( checkBox_completed, SIGNAL(stateChanged(int)), this, SLOT(setCompleted()) ); connect( timer, SIGNAL(timerSet(QString)), this, SLOT(setTimerValue(QString)) ); connect( textEdit, SIGNAL(textChanged()), this, SLOT(setDirections()) ); }
void setTimerFrequency(Timer timer, uint16_t prescaler, uint16_t herz) { uint32_t prescaled_freq = (uint32_t) F_CPU / (uint32_t) prescaler; uint32_t value = prescaled_freq / (uint32_t) herz; setTimerValue(timer, (uint16_t) value); }
void assert_write(uint16_t set_val, uint16_t expected, int num) { char buf[] = "Unexpected timer ocr value set (run XX)"; sprintf(buf, "Unexpected timer ocr value set (run %i)", num); setTimerValue(t, set_val); TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, ocr, buf); }