summaryrefslogtreecommitdiff
path: root/NxWidgets/libnxwidgets/include/cnxtimer.hxx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-17 13:50:02 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-17 13:50:02 +0000
commit925415fbda596e6da11429a72f57f2574ce50844 (patch)
treeee651f9e8843afb0fdec7a023e3f377fbd596052 /NxWidgets/libnxwidgets/include/cnxtimer.hxx
parentdbda56e617cfde1910ecf6091a76038f44dff65d (diff)
downloadnuttx-925415fbda596e6da11429a72f57f2574ce50844.tar.gz
nuttx-925415fbda596e6da11429a72f57f2574ce50844.tar.bz2
nuttx-925415fbda596e6da11429a72f57f2574ce50844.zip
Patches 7-9 from Petteri Aimonen
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5365 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/libnxwidgets/include/cnxtimer.hxx')
-rw-r--r--NxWidgets/libnxwidgets/include/cnxtimer.hxx55
1 files changed, 18 insertions, 37 deletions
diff --git a/NxWidgets/libnxwidgets/include/cnxtimer.hxx b/NxWidgets/libnxwidgets/include/cnxtimer.hxx
index be6038dac..d4715b378 100644
--- a/NxWidgets/libnxwidgets/include/cnxtimer.hxx
+++ b/NxWidgets/libnxwidgets/include/cnxtimer.hxx
@@ -80,6 +80,8 @@
#include <stdbool.h>
#include <ctime>
+#include <nuttx/wqueue.h>
+
#include "cnxwidget.hxx"
/****************************************************************************
@@ -108,42 +110,18 @@ namespace NXWidgets
class CNxTimer : public CNxWidget
{
protected:
- FAR timer_t m_timerid; /**< POSIX timer */
+ struct work_s m_work; /**< Work queue entry */
uint32_t m_timeout; /**< The timeout value in milliseconds */
bool m_isRunning; /**< Indicates whether or not the timer is running */
bool m_isRepeater; /**< Indicates whether or not the timer repeats */
/**
- * The SIGALM signal handler that will be called when the timer goes off
- *
- * @param signo The signal number call caused the handler to run (SIGALM)
- */
-
- static void signalHandler(int signo);
-
- /**
- * Handle an expired timer
- */
-
- void handleTimerExpiration(void);
-
- /**
- * Convert a timespec to milliseconds
+ * Static function called from work queue when the timeout expires.
*
- * @param tp The pointer to the timespec to convert
- * @return The corresponding time in milliseconds
+ * @param arg Pointer to the CNxTimer instance.
*/
- uint32_t timespecToMilliseconds(FAR const struct timespec *tp);
-
- /**
- * Convert milliseconds to a timespec
- *
- * @param milliseconds The milliseconds to be converted
- * @param tp The pointer to the location to store the converted timespec
- */
-
- void millisecondsToTimespec(uint32_t milliseconds, FAR struct timespec *tp);
+ static void workQueueCallback(FAR void *arg);
/**
* Copy constructor is protected to prevent usage.
@@ -172,15 +150,6 @@ namespace NXWidgets
~CNxTimer(void);
/**
- * Return the time remaining on this timer.
- *
- * @return The number of milliseconds that this timer runs before
- * firing an event. Zero is returned if the timer is not running.
- */
-
- const uint32_t getTimeout(void);
-
- /**
* Resets the (running) timer to its initial timeout value. This
* call does nothing if the timer is not running.
*/
@@ -212,6 +181,18 @@ namespace NXWidgets
{
m_timeout = timeout;
}
+
+ /**
+ * Return the timeout of this timer.
+ *
+ * @return The number of milliseconds that this timer will run before
+ * firing an event.
+ */
+
+ inline uint32_t getTimeout(void) const
+ {
+ return m_timeout;
+ }
};
}