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 HardwareTimersLib by
Timer_LPTMR.h
00001 /* Timer_LPTMR.h 00002 * Tested with mbed board: FRDM-KL46Z 00003 * Author: Mark Gottscho 00004 * mgottscho@ucla.edu 00005 */ 00006 00007 #ifndef TIMER_LPTMR_H 00008 #define TIMER_LPTMR_H 00009 00010 #include "mbed.h" 00011 #include "HardwareTimer.h" 00012 #include "PreciseTime.h" 00013 00014 /** 00015 * Base class for LPTMR timing on the FRDM-KL46Z. 00016 */ 00017 class Timer_LPTMR : public HardwareTimer { 00018 public: 00019 /** 00020 * Construct a new LPTMR timer. The timer operates at 1 KHz. Only one Timer_LPTMR 00021 * object may be valid at a time (can control hardware). 00022 */ 00023 Timer_LPTMR(); 00024 00025 /** 00026 * Destroy the LPTMR object. If the object was valid (was allowed to access the timer 00027 * hardware), it will free the resource so that another Timer_LPTMR object can access 00028 * hardware. 00029 */ 00030 virtual ~Timer_LPTMR(); 00031 00032 virtual uint32_t getTick (); 00033 00034 private: 00035 virtual void __init_timer(); 00036 virtual void __start_timer(); 00037 virtual void __stop_timer(); 00038 virtual void __timer_isr(); 00039 00040 /** 00041 * We need a static function to use as interrupt service routine. 00042 * Although we would ideally like to use a member function of Timer_LPTMR, 00043 * we need to wrap it instead. 00044 */ 00045 static void __lptmr_isr_wrapper(); 00046 00047 static bool __lptmr_used; //This flag ensures that no two Timer_LPTMR objects attempt to manipulate the hardware at once 00048 static Timer_LPTMR *__obj; //if __tpm_used is true, this should point to the valid Timer_LPTMR object. This helps with the ISR wrapper. 00049 }; 00050 00051 #endif
Generated on Tue Jul 12 2022 20:37:48 by
1.7.2
