gotosleep.c 613 B

12345678910111213141516171819202122232425262728293031323334
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <assert.h>
  4. #include <sys/thread.h>
  5. #include <sys/timer.h>
  6. #include <sys/version.h>
  7. #include <dev/irqreg.h>
  8. #include "log.h"
  9. #include "rtc.h"
  10. #include "alarm.h"
  11. #include "display.h"
  12. #include "httpstream.h"
  13. struct _fallSleep
  14. {
  15. struct _tm sleepTime;
  16. };
  17. struct _tm count;
  18. void setSleep()
  19. {
  20. X12RtcGetClock(&count);
  21. fallSleep.sleepTime = count;
  22. fallSleep.sleepTime.tm_hour += 1;
  23. playStream("62.195.226.247",80,"/test.mp3");
  24. return 1;
  25. }
  26. void checkSleep()
  27. {
  28. X12RtcGetClock(&count);
  29. if(compareTime(count, fallSleep.sleepTime) >= 4){
  30. stopStream();
  31. }
  32. return 1;
  33. }