-
Notifications
You must be signed in to change notification settings - Fork 71
/
Globals.cpp
43 lines (34 loc) · 991 Bytes
/
Globals.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#if defined(ARDUINO_ARCH_AVR) && ! defined(__AVR_ATmega644A__)
#include <AskSinPP.h>
#include <BatterySensor.h>
#endif
namespace as {
void* __gb_store;
void* __gb_radio;
const char* __gb_chartable = "0123456789ABCDEF";
void(* resetFunc) (void) = 0;
#if defined(ARDUINO_ARCH_AVR) && ! defined(__AVR_ATmega644A__)
volatile uint16_t intVCC=0;
volatile uint16_t IrqBaseBatt::__gb_BatCurrent = 0;
volatile uint8_t IrqBaseBatt::__gb_BatCount = 0;
uint16_t (*IrqBaseBatt::__gb_BatIrq)() = 0;
void IrqBaseBatt::__vectorfunc() {
if( __gb_BatIrq != 0 ) {
__gb_BatCount++;
if( __gb_BatCount > 10 ) { // ignore first 10 values
uint16_t v = __gb_BatIrq();
if( __gb_BatCurrent == 0 ) {
__gb_BatCurrent = v;
}
else {
if( v < __gb_BatCurrent ) {
__gb_BatCurrent = v;
}
}
}
if( __gb_BatIrq != 0 )
ADCSRA |= (1 << ADSC); // start conversion again
}
}
#endif
}