gotosleep.c 772 B

12345678910111213141516171819202122232425262728293031323334353637
  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. #include "gotosleep.h"
  14. struct _fallSleep
  15. {
  16. struct _tm sleepTime;
  17. };
  18. struct _tm count;
  19. void setSleep()
  20. {
  21. X12RtcGetClock(&count);
  22. fallSleep.sleepTime = count;
  23. fallSleep.sleepTime.tm_hour += 1;
  24. playStream("62.195.226.247",80,"/test.mp3");
  25. return 1;
  26. }
  27. void checkSleep()
  28. {
  29. X12RtcGetClock(&count);
  30. if(compareTime(count, fallSleep.sleepTime) == 6){
  31. stopStream();
  32. }
  33. if(compareTime(count, fallSleep.sleepTime) == 4){
  34. /*change volume 1 of 2 naar beneden per minuut zodat hij langzaam zachter gaat*/
  35. }
  36. return 1;
  37. }