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.
BooleanTicker.cpp
00001 /** 00002 Generic Ticker implementation that sets a boolean flag at a regular interval 00003 00004 9/12/13 Andrew H. Fagg Original 00005 00006 */ 00007 00008 #include "BooleanTicker.h" 00009 00010 /** 00011 Constructor. Immediately starts the ticker. 00012 00013 \param interval Interval from one flag setting to the next 00014 */ 00015 00016 BooleanTicker::BooleanTicker(float interval){ 00017 value = false; 00018 ticker.attach(this, &BooleanTicker::BooleanTickerCallback, interval); 00019 } 00020 00021 /** 00022 Deconstructor 00023 */ 00024 00025 BooleanTicker::~BooleanTicker(){ 00026 ticker.detach(); 00027 } 00028 00029 /** 00030 Callback function: sets the flag 00031 */ 00032 00033 void BooleanTicker::BooleanTickerCallback(){ 00034 value = true; 00035 } 00036 00037 /** 00038 Clear the flag (public) 00039 */ 00040 00041 void BooleanTicker::clear(){ 00042 __disable_irq(); 00043 value = false; 00044 __enable_irq(); 00045 } 00046 00047 /** 00048 Set the flag (public) 00049 */ 00050 00051 void BooleanTicker::set(){ 00052 __disable_irq(); 00053 value = true; 00054 __enable_irq(); 00055 } 00056 00057 /** 00058 Get the current flag state 00059 00060 \return The current value of the flag. 00061 */ 00062 00063 bool BooleanTicker::getValue(){ 00064 return value; 00065 }
Generated on Tue Sep 6 2022 22:49:04 by
1.7.2