Digital Scale
1.0
Digital Scale
Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
scale.h
Go to the documentation of this file.
1
/*
2
* scale.h
3
*
4
* Created: 01.12.2017 11:50:46
5
* Author: Robert Loos
6
*/
7
8
9
#ifndef SCALE_H_
10
#define SCALE_H_
11
#include <stdbool.h>
12
13
#define USE_GetAvg3
14
15
#if defined(__DOXYGEN__) || defined(USE_GetAvg1)
16
#define MAXHIST 64
17
#define MINHIST 8
18
extern uint8_t histSize;
19
#endif
20
#if defined(__DOXYGEN__) || defined(USE_GetAvg2)
21
#define MIN_AVG_WEIGHT 4
22
#define MAX_AVG_WEIGHT 10
23
extern uint8_t avgFactor;
24
#endif
25
#if defined(__DOXYGEN__) || defined(USE_GetAvg3)
26
#define NUM_COEFF 11 // number of filter coefficients
27
extern
const
int8_t
coeff
[];
28
extern
int32_t
weightHist
[];
29
#endif
30
31
typedef
uint16_t
delay_t
;
32
typedef
int32_t
weight_t
;
33
34
extern
weight_t
sum128
;
35
extern
uint8_t
cnt128
;
36
37
extern
volatile
uint8_t
tickCnt
,
secCnt
;
38
extern
volatile
uint8_t
zeroWeightSecCnt
;
39
40
extern
uint8_t
hxCnt
;
41
extern
bool
HXdisplayWeight
;
42
47
extern
volatile
uint8_t
tFlags
;
48
extern
volatile
uint8_t
eFlags
;
49
static
const
uint8_t
TFLAG_SEC
=1;
50
static
const
uint8_t
EFLAG_UNCAL
=1;
51
static
const
uint8_t
EFLAG_LOBAT
=2;
52
62
typedef
enum
63
{
SWITCH_NONE
,
64
SWITCH_SHORT
,
65
SWITCH_MED
,
66
SWITCH_LONG
,
67
SWITCH_DOUBLE
,
68
}
SWITCH_ACTION_t
;
69
extern
volatile
SWITCH_ACTION_t
switchAction
;
72
static
inline
void
PowerOff
(
void
)
73
{
74
for
(;;)
75
{
76
PORTD &= ~0b00100000;
// switch power off
77
}
78
}
79
80
static
inline
void
PowerOn
(
void
)
81
{
82
PORTD |= 0b00100000;
// hold power on
83
}
84
85
extern
void
DelayMs
(
delay_t
ms);
86
extern
void
Calibrate
(
void
);
87
88
#endif
/* SCALE_H_ */
Generated on Mon Dec 10 2018 20:32:17 for Digital Scale by
1.8.4