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_PIT.h
00001 /* Timer_PIT.h 00002 * Tested with mbed board: FRDM-KL46Z 00003 * Author: Mark Gottscho 00004 * mgottscho@ucla.edu 00005 */ 00006 00007 #ifndef TIMER_PIT_H 00008 #define TIMER_PIT_H 00009 00010 #include "mbed.h" 00011 #include "HardwareTimer.h" 00012 #include "PreciseTime.h" 00013 00014 /** 00015 * Base class for PIT timing on the FRDM-KL46Z. 00016 */ 00017 class Timer_PIT : public HardwareTimer { 00018 public: 00019 /** 00020 * Construct a new PIT timer. The timer operates at 1 KHz. Only one Timer_PIT 00021 * object may be valid at a time (can control hardware). 00022 */ 00023 Timer_PIT(); 00024 00025 /** 00026 * Destroy the PIT object. If the object was valid (was allowed to access the timer 00027 * hardware), it will free the resource so that another Timer_PIT object can access 00028 * hardware. 00029 */ 00030 virtual ~Timer_PIT(); 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_PIT, 00043 * we need to wrap it instead. 00044 */ 00045 static void __pit_isr_wrapper(); 00046 00047 static bool __pit_used; //This flag ensures that no two Timer_PIT objects attempt to manipulate the hardware at once 00048 static Timer_PIT *__obj; //if __tpm_used is true, this should point to the valid Timer_PIT object. This helps with the ISR wrapper. 00049 }; 00050 00051 #endif
Generated on Tue Jul 12 2022 20:37:48 by
1.7.2
