not tested yet, temporarily on left key but can be changed, and stream is just hardcoded for now.
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <sys/thread.h>
+#include <sys/timer.h>
+#include <sys/version.h>
+#include <dev/irqreg.h>
+#include "log.h"
+#include "rtc.h"
+#include "alarm.h"
+#include "display.h"
+#include "httpstream.h"
+
+struct _fallSleep
+{
+ struct _tm sleepTime;
+};
+struct _tm count;
+void setSleep()
+ X12RtcGetClock(&count);
+ fallSleep.sleepTime = count;
+ fallSleep.sleepTime.tm_hour += 1;
+ playStream("62.195.226.247",80,"/test.mp3");
+ return 1;
+}
+void checkSleep()
+ if(compareTime(count, fallSleep.sleepTime) >= 4){
+ stopStream();
+ }
@@ -0,0 +1,5 @@
+#ifndef _GoToSleep_H
+#define _GoToSleep_H
+extern void setSleep();
+extern void checkSleep();
+#endif
@@ -373,9 +373,16 @@ int main(void)
VsSetVolume(128-VOL, 128-VOL);
displayVolume(VOL/8);
}
+ else if(KbGetKey() == KEY_LEFT /*the key I can use or you guys want to use, for now KEY_LEFT*/)
+ {
+ NutSleep(150);
+ X12RtcGetClock(&timeCheck);
+ setSleep();
else if(timerStruct(timeCheck) >= 5 && checkAlarms() == 1)
{
+ checkSleep();
for (idx = 0; idx < 5; idx++){
if (getState(idx) == 1){
displayAlarm(0,1,idx);