1 |
//-------------------------------------------------------------------------------
|
2 |
//$Header: /home/dashley/cvsrep/uculib01/uculib01/src/stm8/cosmic/modxx/atu16cmpdiffabsgtrxx/src/atu16cmpdiffabsgtrxx.c,v 1.4 2010/01/29 01:44:44 dashley Exp $
|
3 |
//-------------------------------------------------------------------------------
|
4 |
//Copyright (c)2010 David T. Ashley
|
5 |
//
|
6 |
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
//of this software source code and associated documentation files (the
|
8 |
//"Software"), to deal in the Software without restriction, including without
|
9 |
//limitation the rights to use, copy, modify, merge, publish, distribute,
|
10 |
//sublicense, and/or sell copies of the Software, and to permit persons to whom
|
11 |
//the Software is furnished to do so, subject to the following conditions:
|
12 |
//
|
13 |
//The above copyright notice and this permission notice shall be included in
|
14 |
//all copies or substantial portions of the Software.
|
15 |
//
|
16 |
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
//THE SOFTWARE.
|
23 |
//-------------------------------------------------------------------------------
|
24 |
|
25 |
#include "uculib.h"
|
26 |
|
27 |
|
28 |
UCU_BOOLEAN UcuAtU16CmpDiffAbsGtRxx( UCU_UINT16 sig1, UCU_UINT16 sig2, UCU_UINT16 threshold )
|
29 |
{
|
30 |
UCU_UINT16 gt, ls;
|
31 |
UCU_BOOLEAN result;
|
32 |
|
33 |
result = UCU_FALSE;
|
34 |
|
35 |
if( sig1 > sig2 )
|
36 |
{
|
37 |
gt = sig1;
|
38 |
ls = sig2;
|
39 |
}
|
40 |
else
|
41 |
{
|
42 |
gt = sig2;
|
43 |
ls = sig1;
|
44 |
}
|
45 |
|
46 |
if( (gt - ls) > threshold )
|
47 |
{
|
48 |
result = UCU_TRUE;
|
49 |
}
|
50 |
|
51 |
return( result );
|
52 |
}
|
53 |
|
54 |
//-------------------------------------------------------------------------------
|
55 |
//End of $Id: atu16cmpdiffabsgtrxx.c,v 1.4 2010/01/29 01:44:44 dashley Exp $
|
56 |
//-------------------------------------------------------------------------------
|
57 |
//$Log: atu16cmpdiffabsgtrxx.c,v $
|
58 |
//Revision 1.4 2010/01/29 01:44:44 dashley
|
59 |
//Addition of UcuAtU16CmpDiffAbsGtRxx() function.
|
60 |
//
|
61 |
//Revision 1.3 2010/01/21 23:19:16 dashley
|
62 |
//Symbolic oversight with FALSE and TRUE corrected.
|
63 |
//
|
64 |
//Revision 1.2 2010/01/21 21:36:03 dashley
|
65 |
//Minor whitespace correction.
|
66 |
//
|
67 |
//Revision 1.1 2010/01/21 21:35:24 dashley
|
68 |
//Initial checkin.
|
69 |
//-------------------------------------------------------------------------------
|
70 |
|