PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Utility
libsimpletools
source
timeout.c
1
/*
2
* @file timeout.c
3
*
4
* @author Andy Lindsay
5
*
6
* @version 0.85
7
*
8
* @copyright Copyright (C) Parallax, Inc. 2012. See end of file for
9
* terms of use (MIT License).
10
*
11
* @brief timeout function source, see simpletools.h for documentation.
12
*
13
* @detail Please submit bug reports, suggestions, and improvements to
14
* this code to editor@parallax.com.
15
*/
16
17
#include "
simpletools.h
"
// simpletools function prototypes
18
19
int
timeout
(
int
time)
// pause function definition
20
{
21
// If dt not initialized, set it up to 1 us.
22
/*
23
if(st_iodt == 0) // If dt not initialized
24
{
25
set_io_dt(CLKFREQ/1000000); // Set up timed I/O time increment
26
set_io_timeout(CLKFREQ/4); // Set up timeout
27
}
28
*/
29
time *=
st_iodt
;
// Calculate system clock ticks
30
if
(
CNT
-
st_mark
< time)
// Wait for system clock target
31
{
32
return
0;
33
}
34
else
35
{
36
return
1;
37
}
38
}
39
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
timeout
int timeout(int time)
Compares the time against the time elapsed since mark (deprecated).
Definition:
timeout.c:19
st_iodt
int st_iodt
Clock ticks in a time increment used by pulse_in, pulse_out, and rc_time. Default value is the number...
Definition:
timeTicks.c:24
CNT
#define CNT
The system clock count.
Definition:
propeller1.h:151
st_mark
int st_mark
Variable shared by mark and time_out functions.
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17