OpenOCD
delay.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2011 by Martin Schmoelzer *
5  * <martin.schmoelzer@student.tuwien.ac.at> *
6  ***************************************************************************/
7 
8 #include "delay.h"
9 
10 void delay_5us(void)
11 {
12  NOP;
13 }
14 
15 void delay_1ms(void)
16 {
17  uint16_t i;
18 
19  for (i = 0; i < 598; i++)
20  ;
21 }
22 
23 void delay_us(uint16_t delay)
24 {
25  uint16_t i;
26  uint16_t maxcount = (delay / 5);
27 
28  for (i = 0; i < maxcount; i++)
29  delay_5us();
30 }
31 
32 void delay_ms(uint16_t delay)
33 {
34  uint16_t i;
35 
36  for (i = 0; i < delay; i++)
37  delay_1ms();
38 }
void delay_5us(void)
Definition: delay.c:10
void delay_us(uint16_t delay)
Definition: delay.c:23
void delay_1ms(void)
Definition: delay.c:15
void delay_ms(uint16_t delay)
Definition: delay.c:32
#define NOP
Definition: delay.h:13