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.
Fork of MQTT by
MQTTmbed.h
00001 #if !defined(MQTT_MBED_H) 00002 #define MQTT_MBED_H 00003 00004 #include "mbed.h" 00005 00006 class Countdown : private mbed::NonCopyable<Countdown> 00007 { 00008 public: 00009 Countdown() : t() 00010 { 00011 } 00012 00013 Countdown(int ms) : t() 00014 { 00015 countdown_ms(ms); 00016 } 00017 00018 bool expired() 00019 { 00020 return t.read_ms() >= interval_end_ms; 00021 } 00022 00023 void countdown_ms(unsigned long ms) 00024 { 00025 t.stop(); 00026 interval_end_ms = ms; 00027 t.reset(); 00028 t.start(); 00029 } 00030 00031 void countdown(int seconds) 00032 { 00033 countdown_ms((unsigned long)seconds * 1000L); 00034 } 00035 00036 int left_ms() 00037 { 00038 return interval_end_ms - t.read_ms(); 00039 } 00040 00041 private: 00042 Timer t; 00043 unsigned long interval_end_ms; 00044 }; 00045 00046 #endif
Generated on Thu Jul 14 2022 19:54:21 by
1.7.2
