STC15W408AS library
0.10.0
Loading...
Searching...
No Matches
include
delay.h
Go to the documentation of this file.
1
#ifndef STC15_DELAYH
2
#define STC15_DELAYH
3
12
#include <stdint.h>
13
#include <
frequency.h
>
14
20
#define TICKS_DELAY_1ms ((uint16_t) (((get_master_clock_frequency() / 1000UL) - 30UL) / 18UL))
21
30
#define delay_ms(ms) \
31
do { \
32
uint16_t ms_div = ms >> get_frequency_divider_scale(); \
33
do \
34
{ \
35
uint16_t d = TICKS_DELAY_1ms; \
36
do \
37
{ \
38
__asm NOP __endasm; \
39
__asm NOP __endasm; \
40
__asm NOP __endasm; \
41
} while (d--); \
42
} while (ms_div--); \
43
} while(0) \
44
45
#endif
frequency.h
Generated by
1.9.8