Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
nap.cpp
00001 #include <nap.hpp> 00002 00003 NAP::NAP(float nap_time):nap_time_(nap_time){ 00004 restart(); 00005 } 00006 00007 void NAP::take_a_nap(){ 00008 while((now_time - prev_time) < (nap_time_*1000)){ 00009 now_time = nap.read_ms(); 00010 } 00011 prev_time = now_time; 00012 if(prev_time > 18000000){ 00013 now_time = 0; 00014 prev_time = 0; 00015 nap.reset(); 00016 nap.start(); 00017 } 00018 } 00019 00020 void NAP::setNaptime(float nap_time){ 00021 nap_time_ = nap_time; 00022 } 00023 00024 void NAP::restart(){ 00025 nap.reset(); 00026 nap.start(); 00027 now_time = 0; 00028 prev_time = 0; 00029 }
Generated on Sat Oct 15 2022 07:52:33 by
1.7.2