bool taskAccelerometerWork(bool likelyError) {
	int32_t accelerationX = abs(MMA0_GetX()); //(MMA0_GetX()/16384)*980665
	int32_t accelerationY = abs(MMA0_GetY()); //100000
	int32_t accelerationZ = abs(MMA0_GetZ());

	int32_t sum = accelerationX + accelerationY + accelerationZ;

//	printf("Soma = %ld!\r\n", sum);

	if (likelyError) {
		if (!((accelerationX == accelerationY)
				&& (accelerationY == accelerationZ))) {
			likelyError = 0;
		}
	}

	if (sum < 5000) {
		LEDBlue_SetVal();
		LEDRed_ClrVal();
		printf("QUEDA LIVRE!\r\n");
		startBeep();
		FreeRTOS0_vTaskDelay(500 / portTICK_RATE_MS);
	} else {
		LEDRed_SetVal();
		LEDBlue_ClrVal();
		stopBeep();
	}
	
	return likelyError;
}
Exemple #2
0
int
playBeep (unsigned short frequency, unsigned int duration) {
  if (asynchronousBeep(frequency, duration*4)) {
    asyncWait(duration);
    stopBeep();
    return 1;
  }

  if (startBeep(frequency)) {
    asyncWait(duration);
    stopBeep();
    return 1;
  }

  return synchronousBeep(frequency, duration);
}
Exemple #3
0
void ConsoleWidget::readStandardOut()
{
	QByteArray array = m_process->readAll();
	int i = array.lastIndexOf('\f');
	if(i >= 0) {
		setPlainText("");
		array = array.mid(i + 1);
	}
	i = array.lastIndexOf('\a');
	if(i >= 0) startBeep();
	array.remove(i, 1);
	
	insertPlainText(array);
	moveCursor(QTextCursor::End, QTextCursor::KeepAnchor);
	update();
}
Exemple #4
0
static int
beeperPlay (NoteDevice *device, unsigned char note, unsigned int duration) {
  logMessage(LOG_DEBUG, "tone: msec=%d note=%d", duration, note);

  if (!note) {
    accurateDelay(duration);
    return 1;
  }

  if (asynchronousBeep(getIntegerNoteFrequency(note), duration*4)) {
    accurateDelay(duration);
    stopBeep();
    return 1;
  }

  if (startBeep(getIntegerNoteFrequency(note))) {
    accurateDelay(duration);
    stopBeep();
    return 1;
  }

  return synchronousBeep(getIntegerNoteFrequency(note), duration);
}
Exemple #5
0
int
stopBeep (void) {
  return startBeep(0);
}