57 lines
1.4 KiB
C
57 lines
1.4 KiB
C
/* Reflow Oven Controller
|
|
*
|
|
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
|
*
|
|
* This file is part of the Reflow Oven Controller Project.
|
|
*
|
|
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* GDSII-Converter is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with the reflow oven controller project.
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/**
|
|
* @file systick.c
|
|
*/
|
|
|
|
#include <reflow-controller/systick.h>
|
|
#include <stm32/stm32f4xx.h>
|
|
#include <cmsis/core_cm4.h>
|
|
|
|
volatile uint32_t wait_tick_ms;
|
|
volatile uint64_t global_tick_ms;
|
|
|
|
void systick_setup(void)
|
|
{
|
|
/* Setup Systick for 1ms tick @ 168 MHz Clock Speed */
|
|
SysTick_Config(SYSTICK_RELOAD);
|
|
}
|
|
|
|
void systick_wait_ms(uint32_t ms)
|
|
{
|
|
wait_tick_ms = 0UL;
|
|
while (wait_tick_ms < ms);
|
|
}
|
|
|
|
/**
|
|
* @brief Interrupt Handler for SysTick
|
|
*
|
|
* This handler is called every millisecond
|
|
*
|
|
* @warning For calling cyclic functions use separate timers/flags and don't spoil this function
|
|
*/
|
|
void SysTick_Handler()
|
|
{
|
|
/* Increase tick counters */
|
|
wait_tick_ms++;
|
|
global_tick_ms++;
|
|
}
|