void playTone(){ VsPlayerInit(); VsSetVolume(1, 1); VsBeepStart(2500); NutSleep(1000); VsBeepStop(); return 1; }
/*-----functions-----*/ THREAD(tone, arg){ VsPlayerInit(); VsSetVolume(1, 1); VsBeepStart(2500); NutSleep(1000); VsBeepStop(); NutThreadExit(); NutThreadKill(); NutThreadDestroy(); }
THREAD(AlarmBeep,arg) { printf("beeping started"); //while(alarmOn==1) for(;;) { NutSleep(500); //alarmBeep(); VsBeepStart(100); NutSleep(500); VsBeepStop(); } printf ("beep done"); for(;;) { NutSleep(1000); } }
/*static int PlayMp3File(char *path) { int fd; size_t rbytes; u_char *mp3buf; int got; u_char ief; // Open the MP3 file. printf("Play %s: ", path); if ((fd = _open(path, _O_RDONLY | _O_BINARY)) == -1) { printf("Error %d\n", errno); return -1; } puts("OK"); //Reset decoder buffer. printf("[B.RST]"); ief = VsPlayerInterrupts(0); NutSegBufReset(); VsPlayerInterrupts(ief); for (;;) { //Query number of byte available in MP3 buffer. ief = VsPlayerInterrupts(0); mp3buf = NutSegBufWriteRequest(&rbytes); VsPlayerInterrupts(ief); // Read data directly into the MP3 buffer. if (rbytes) { printf("[B.RD%d]", rbytes); if ((got = _read(fd, mp3buf, rbytes)) > 0) { printf("[B.CMT%d]", got); ief = VsPlayerInterrupts(0); mp3buf = NutSegBufWriteCommit(got); VsPlayerInterrupts(ief); } else { printf("[EOF]"); break; } } //If the player is not running, kick it. if (VsGetStatus() != VS_STATUS_RUNNING) { printf("[P.KICK]"); VsPlayerKick(); } //Allow background threads to take over. NutThreadYield(); } _close(fd); //Flush decoder and wait until finished. printf("[P.FLUSH]"); //VsPlayerFlush(); while (VsGetStatus() != VS_STATUS_EMPTY) { NutSleep(1); } //Reset the decoder. printf("[P.RST]"); VsPlayerReset(0); printf("\nDone, %u bytes free\n", NutHeapAvailable()); return 0; }*/ void pauze() { VsBeepStop(); }