PSDR/Source/src/Timer.c
Michael Colton ffcb904b66 Initial commit to GitHub.
Includes the Source (as an Eclipse project) and the Hardware files (including schematic, layout, gerbers, and bill of materials.)

The firmware is extremely incomplete. At this point the DDS chips work (with controlled phase relationship), the LCD (with fast-ish SPI, scrolling, and GFX, modified from Adafruit's library), the encoder knob, and LED work.

The ADC is capturing, but not in a usable way, but it's enough to feed the DSP code and see a nice pretty waterfall. Timers, interrupts, and DACs are not working yet.
2014-06-22 17:49:43 -06:00

53 lines
1.1 KiB
C

//
// This file is part of the GNU ARM Eclipse Plug-ins project.
// Copyright (c) 2014 Liviu Ionescu.
//
#include "Timer.h"
#include "cortexm/ExceptionHandlers.h"
// ----------------------------------------------------------------------------
// Forward declarations.
void
timer_tick (void);
// ----------------------------------------------------------------------------
volatile timer_ticks_t timer_delayCount;
// ----------------------------------------------------------------------------
void
timer_start (void)
{
// Use SysTick as reference for the delay loops.
SysTick_Config (SystemCoreClock / TIMER_FREQUENCY_HZ);
}
void
timer_sleep (timer_ticks_t ticks)
{
timer_delayCount = ticks;
// Busy wait until the SysTick decrements the counter to zero.
while (timer_delayCount != 0u)
;
}
void
timer_tick (void)
{
// Decrement to zero the counter used by the delay routine.
if (timer_delayCount != 0u)
{
--timer_delayCount;
}
}
// ----- SysTick_Handler() ----------------------------------------------------
// ----------------------------------------------------------------------------