選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

26 行
527 B

  1. #include "MainUnit.h"
  2. #include "Rtc.h"
  3. #include "Pins.h"
  4. namespace mainunit {
  5. void interrupt() {
  6. detachInterrupt(digitalPinToInterrupt(RTC_WAKE));
  7. }
  8. void interruptIn(uint16_t seconds) {
  9. rtc::setAlarm(seconds);
  10. pinMode(RTC_WAKE, INPUT);
  11. attachInterrupt(digitalPinToInterrupt(RTC_WAKE), interrupt, FALLING);
  12. }
  13. void sleep(period_t period) {
  14. LowPower.powerDown(period, ADC_OFF, BOD_OFF);
  15. }
  16. void deepSleep(uint16_t seconds) {
  17. interruptIn(seconds);
  18. LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
  19. }
  20. }