LevelMeter-Display
2.0
An ultrasonic Level Meter for Stormwater Cisterns
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Display.h
Go to the documentation of this file.
1
// Display.h
2
3
#ifndef DISPLAY_H_
4
#define DISPLAY_H_
5
6
#include <stdbool.h>
7
#include <avr/io.h>
8
#include "
lcd.h
"
9
10
#define WITH_UPDATE
11
12
#define SIGNAL_PORT PORTA
13
#define SIGNAL_1_MASK 0b00000100
14
#define SIGNAL_2_MASK 0b00001000
15
16
typedef
double
LITERS_T
;
17
30
typedef
struct
31
{
32
LITERS_T
liters
;
33
LITERS_T
litersPerHour
;
34
LITERS_T
litersLastHour
;
35
LITERS_T
litersToday
;
36
LITERS_T
litersYesterday
;
37
double
litersPerCent
;
38
uint8_t
temp
;
39
int32_t
liters_temp
;
40
uint8_t
nliters_temp
;
41
char
parityErrorChar
;
42
char
checksumErrorChar
;
43
char
sensorDeadChar
;
44
char
not10ErrorChar
;
45
// char dcf77Char; ///< Character to appear on position "DCF77 in sync"
46
}
displayValues_t
;
47
48
extern
uint16_t
pulseTimeInt
;
49
extern
uint8_t
pulseTimeMult
;
50
extern
uint8_t
deadTime
;
51
extern
signed
char
tempSemi
;
52
extern
uint8_t
tempRaw
;
53
extern
volatile
char
cmdline
[81];
54
55
extern
volatile
uint8_t
tickCnt
,
secCnt
,
minCnt
,
hrCnt
;
56
58
typedef
enum
59
{
60
RTC_NORMAL
,
61
RTC_FASTER
,
62
RTC_SLOWER
63
}
RTCAdj_t
;
64
extern
const
char
*
RTCAdjTxt
[];
65
extern
volatile
RTCAdj_t
RTCAdj
;
66
68
typedef
enum
69
{
70
SCREENSTEPAUTO
,
71
SCREENSTEPMANU
,
72
SCREENREFRESH
,
73
SCREENABSPAGE
,
74
}
showScreen_t
;
75
76
#define SCREENABSPAGE_VERSION 128
77
78
#define ADCVoltsPerLSB (2.56/1024)
79
#define dividerP3 (4.7/(4.7+8.2))
80
#define dividerP5 (4.7/(4.7+8.2))
81
#define dividerUnreg (4.7/(4.7+68))
82
#define dividerSWUnreg (4.7/(4.7+68))
83
84
extern
uint8_t
bootLdPage
[];
85
extern
uint16_t
bootLdAdr
;
86
extern
volatile
uint8_t
tFlags
;
87
static
const
uint8_t
TFLAG_SEC
=1;
88
static
const
uint8_t
TFLAG_MIN
=2;
89
static
const
uint8_t
TFLAG_HOUR
=4;
90
static
const
uint8_t
TFLAG_DAY
=8;
91
92
93
extern
volatile
uint8_t
cFlags
;
94
static
const
uint8_t
CFLAG_TIMERECEIVED
=1;
95
static
const
uint8_t
CFLAG_TEMPRECEIVED
=2;
96
static
const
uint8_t
CFLAG_PARITYERROR
=4;
97
static
const
uint8_t
CFLAG_CHECKSUMERROR
=8;
98
static
const
uint8_t
CFLAG_CMDRECEIVED
=16;
99
static
const
uint8_t
CFLAG_BYTERECEIVED
=32;
100
101
extern
volatile
uint8_t
blFlags
;
102
static
const
uint8_t
BOOTLDHELLO
=1;
103
static
const
uint8_t
BOOTLDDATA
=2;
104
static
const
uint8_t
BOOTLDOK
=4;
105
static
const
uint8_t
BOOTLDERROR
=8;
106
static
const
uint8_t
BOOTLDPROTECTED
=16;
107
108
extern
volatile
uint8_t
dFlags
;
109
static
const
uint8_t
DFLAG_DCF77
=1;
110
static
const
uint8_t
DFLAG_SENSOR
=2;
111
113
typedef
enum
114
{
115
DISPLAY_2x16
,
116
DISPLAY_4x20
,
117
DISPLAY_ANALOG
,
118
}
displayType_t
;
119
extern
displayType_t
displayType
;
122
typedef
struct
{
123
uint8_t
width
;
124
uint8_t
nLines
;
125
uint8_t startLine[
LCD_MAX_LINES
];
126
}
displayMetrics_T
;
127
extern
const
displayMetrics_T
displayMetrics
[];
128
131
inline
static
void
SensorPowerOn
(
void
)
132
{
133
PORTA |= 0x01;
134
}
135
138
inline
static
void
SensorPowerOff
(
void
)
139
{
140
PORTA &= ~0x01;
141
}
142
145
inline
static
void
BluetoothPowerOn
(
void
)
146
{
147
PORTD |= 0xC0;
148
}
149
152
inline
static
void
BluetoothPowerOff
(
void
)
153
{
154
PORTD &= ~0x80;
155
}
156
159
inline
static
void
Sig1ON
(
void
)
160
{
161
SIGNAL_PORT
&= ~
SIGNAL_1_MASK
;
162
}
163
166
inline
static
void
Sig1OFF
(
void
)
167
{
168
SIGNAL_PORT
|=
SIGNAL_1_MASK
;
169
}
170
173
inline
static
void
Sig2ON
(
void
)
174
{
175
SIGNAL_PORT
&= ~
SIGNAL_2_MASK
;
176
}
177
180
inline
static
void
Sig2OFF
(
void
)
181
{
182
SIGNAL_PORT
|=
SIGNAL_2_MASK
;
183
}
184
188
inline
static
bool
GetSig1
(
void
)
189
{
190
return
!(
SIGNAL_PORT
&
SIGNAL_1_MASK
);
191
}
192
196
inline
static
bool
GetSig2
(
void
)
197
{
198
return
!(
SIGNAL_PORT
&
SIGNAL_2_MASK
);
199
}
200
201
typedef
uint8_t
delay_t
;
202
203
extern
void
delay10ms
(
delay_t
delay10ms
);
204
205
extern
void
SetAnalogPerCent
(
double
perCent);
206
207
#endif
Generated on Fri Sep 6 2013 23:24:34 for LevelMeter-Display by
1.8.3.1