From bd5e8f07b71b4fa0c058c0edfa8ff3f59ab31610 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 23 Dec 2009 13:28:44 +0000 Subject: Stub out more of the TPI programming protocol routines in the AVRISP project. --- Projects/AVRISP/Lib/ISPProtocol.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'Projects/AVRISP/Lib/ISPProtocol.h') diff --git a/Projects/AVRISP/Lib/ISPProtocol.h b/Projects/AVRISP/Lib/ISPProtocol.h index 4bbffbbd1..85a669a4e 100644 --- a/Projects/AVRISP/Lib/ISPProtocol.h +++ b/Projects/AVRISP/Lib/ISPProtocol.h @@ -64,6 +64,26 @@ #define PROG_MODE_PAGED_READYBUSY_MASK (1 << 6) #define PROG_MODE_COMMIT_PAGE_MASK (1 << 7) + /* Inline Functions: */ + /** Blocking delay for a given number of milliseconds, via a hardware timer. + * + * \param[in] DelayMS Number of milliseconds to delay for + */ + static inline void ISPProtocol_DelayMS(uint8_t DelayMS) + { + TCNT0 = 0; + TIFR0 = (1 << OCF1A); + + while (DelayMS) + { + if (TIFR0 & (1 << OCF1A)) + { + TIFR0 = (1 << OCF1A); + DelayMS--; + } + } + } + /* Function Prototypes: */ void ISPProtocol_EnterISPMode(void); void ISPProtocol_LeaveISPMode(void); -- cgit v1.2.3