projects
/
avr_bc100.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Commit mthomas changes to GCC and port those changes to IAR
[avr_bc100.git]
/
BaseTinyFirmware
/
IAR
/
statefunc.c
diff --git
a/BaseTinyFirmware/IAR/statefunc.c
b/BaseTinyFirmware/IAR/statefunc.c
index 9dbdde18c4cf8c6bcc5a93b03471ea840d4f048d..e4d5ff64c174469735dfc6378a7a4f84c7ee49cc 100644
(file)
--- a/
BaseTinyFirmware/IAR/statefunc.c
+++ b/
BaseTinyFirmware/IAR/statefunc.c
@@
-115,7
+115,7
@@
unsigned char Initialize(unsigned char inp)
Time_Init();
\r
\r
// Attempt to get ADC-readings (also gets RID-data) from both batteries.
\r
Time_Init();
\r
\r
// Attempt to get ADC-readings (also gets RID-data) from both batteries.
\r
- for (i = 0; i <
2; i++)
{
\r
+ for (i = 0; i <
BATCONN; i++)
{
\r
EnableBattery(i);
\r
ADC_Wait();
\r
BatteryStatusRefresh();
\r
EnableBattery(i);
\r
ADC_Wait();
\r
BatteryStatusRefresh();
\r
@@
-166,7
+166,7
@@
unsigned char BatteryControl(unsigned char inp)
\r
// Get ADC-readings, try to read EPROM, and start prequalification
\r
// of any uncharged battery.
\r
\r
// Get ADC-readings, try to read EPROM, and start prequalification
\r
// of any uncharged battery.
\r
- for (i = 0; i <
2
; i++) {
\r
+ for (i = 0; i <
BATCONN
; i++) {
\r
if (BattControl[i].Enabled) {
\r
EnableBattery(i);
\r
ADC_Wait();
\r
if (BattControl[i].Enabled) {
\r
EnableBattery(i);
\r
ADC_Wait();
\r
@@
-220,11
+220,13
@@
unsigned char Sleep(unsigned char inp)
\r
// If any batteries need charging, go to ST_BATCON.
\r
// Otherwise, keep sleeping.
\r
\r
// If any batteries need charging, go to ST_BATCON.
\r
// Otherwise, keep sleeping.
\r
- for (i = 0; i <
2
; i++) {
\r
+ for (i = 0; i <
BATCONN
; i++) {
\r
EnableBattery(i);
\r
ADC_Wait();
\r
EnableBattery(i);
\r
ADC_Wait();
\r
- if ((BatteryStatusRefresh()) && (!BattData.Charged)) {
\r
- return(ST_BATCON);
\r
+ if ( BatteryStatusRefresh() ) {
\r
+ if ( !BattData.Charged ) {
\r
+ return(ST_BATCON);
\r
+ }
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-275,6
+277,7
@@
void Doze(void)
__sleep(); // Go to sleep, wake up by WDT.
\r
}
\r
else {
\r
__sleep(); // Go to sleep, wake up by WDT.
\r
}
\r
else {
\r
+ // stay awake if PB6 is pulled low by master
\r
do {
\r
} while ( !(WatchdogFlag) );
\r
}
\r
do {
\r
} while ( !(WatchdogFlag) );
\r
}
\r