From: Kevin Townsend Date: Fri, 4 May 2012 15:00:31 +0000 (+0200) Subject: Added ISR callback X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/commitdiff_plain/407d64f378d14d26e503fb994780b574174d462f Added ISR callback --- diff --git a/core/timer32/timer32.c b/core/timer32/timer32.c index 31e5b01..d25638f 100644 --- a/core/timer32/timer32.c +++ b/core/timer32/timer32.c @@ -351,6 +351,39 @@ void timer32Init(uint8_t timerNum, uint32_t timerInterval) /**************************************************************************/ /*! @brief Sets the optional callback function for 32-bit timer 0 + + @section EXAMPLE + + @code + #include "core/timer32/timer32.h" + + static volatile int32_t timerCounter; + + // Callback function for 32-bit timer 0 + void ct32b0Callback(void) + { + timerCounter++; + } + + int main(void) + { + // Configure cpu and mandatory peripherals + systemInit(); + + // Init timer 0 with 1ms delay + timer32Init(0, TIMER32_CCLK_1MS); + + // Setup the interrupt callback + timer32SetIntHandler(ct32b0Callback); + + // Enable the timer + timer32Enable(0); + + while (1) + { + } + } + @endcode */ /**************************************************************************/ void timer32SetIntHandler(void (*handler)(void))