Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
aareyes
Smart-Battery-Module-Info_For_Arduino
Commits
adaf540b
Commit
adaf540b
authored
Oct 18, 2019
by
Armin
Browse files
Leonardo setup
parent
1d837ab3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
src/SBMInfo/SBMInfo.ino
src/SBMInfo/SBMInfo.ino
+10
-11
No files found.
src/SBMInfo/SBMInfo.ino
View file @
adaf540b
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#define LCD_COLUMNS 20
#define LCD_COLUMNS 20
#define LCD_ROWS 4
#define LCD_ROWS 4
#define VERSION "3.1"
#define VERSION
_EXAMPLE
"3.1"
//#define DEBUG
//#define DEBUG
/*
/*
...
@@ -52,7 +52,7 @@ void printCurrent(struct SBMFunctionDescriptionStruct * aDescription, uint16_t a
...
@@ -52,7 +52,7 @@ void printCurrent(struct SBMFunctionDescriptionStruct * aDescription, uint16_t a
void
printTemperature
(
struct
SBMFunctionDescriptionStruct
*
aDescription
,
uint16_t
aTemperature
);
void
printTemperature
(
struct
SBMFunctionDescriptionStruct
*
aDescription
,
uint16_t
aTemperature
);
void
printFunctionDescriptionArray
(
struct
SBMFunctionDescriptionStruct
*
aSBMFunctionDescription
,
uint8_t
aLengthOfArray
,
void
printFunctionDescriptionArray
(
struct
SBMFunctionDescriptionStruct
*
aSBMFunctionDescription
,
uint8_t
aLengthOfArray
,
bool
aOnlyPrintIfValueChanged
);
bool
aOnlyPrintIfValueChanged
);
void
printSMBStaticInfo
(
void
);
void
printSMBStaticInfo
(
void
);
void
printSMBManufacturerInfo
(
void
);
void
printSMBManufacturerInfo
(
void
);
void
printSMBNonStandardInfo
(
bool
aOnlyPrintIfValueChanged
);
void
printSMBNonStandardInfo
(
bool
aOnlyPrintIfValueChanged
);
...
@@ -170,23 +170,22 @@ BQ20Z70_PackVoltage, Pack_Voltage, &printVoltage } };
...
@@ -170,23 +170,22 @@ BQ20Z70_PackVoltage, Pack_Voltage, &printVoltage } };
*/
*/
void
setup
()
{
void
setup
()
{
// initialize the digital pin as an output.
pinMode
(
LED_BUILTIN
,
OUTPUT
);
pinMode
(
LED_BUILTIN
,
OUTPUT
);
Serial
.
begin
(
115200
);
#if defined(__AVR_ATmega32U4__)
while
(
!
Serial
);
//delay for Leonardo, but this loops forever for Maple Serial
#endif
// Just to know which program is running on my Arduino
Serial
.
println
(
F
(
"START "
__FILE__
"
\r\n
Version "
VERSION_EXAMPLE
" from "
__DATE__
));
// Shutdown SPI, timers, and ADC
// Shutdown SPI, timers, and ADC
PRR
=
(
1
<<
PRSPI
)
|
(
1
<<
PRTIM1
)
|
(
1
<<
PRTIM2
)
|
(
1
<<
PRADC
);
PRR
=
(
1
<<
PRSPI
)
|
(
1
<<
PRTIM1
)
|
(
1
<<
PRTIM2
)
|
(
1
<<
PRADC
);
// Disable digital input on all unused ADC channel pins to reduce power consumption
// Disable digital input on all unused ADC channel pins to reduce power consumption
DIDR0
=
ADC0D
|
ADC1D
|
ADC2D
|
ADC3D
;
DIDR0
=
ADC0D
|
ADC1D
|
ADC2D
|
ADC3D
;
Serial
.
begin
(
115200
);
while
(
!
Serial
)
{
;
// wait for Leonardo enumeration, others continue immediately
}
// set up the LCD's number of columns and rows:
// set up the LCD's number of columns and rows:
myLCD
.
begin
(
LCD_COLUMNS
,
LCD_ROWS
);
myLCD
.
begin
(
LCD_COLUMNS
,
LCD_ROWS
);
Serial
.
println
(
F
(
"START SBMInfo
\r\n
Version "
VERSION
" from "
__DATE__
));
myLCD
.
print
(
F
(
"SBMInfo "
VERSION_EXAMPLE
));
myLCD
.
print
(
F
(
"SBMInfo "
VERSION
));
myLCD
.
setCursor
(
0
,
1
);
myLCD
.
setCursor
(
0
,
1
);
myLCD
.
print
(
F
(
__DATE__
));
myLCD
.
print
(
F
(
__DATE__
));
/*
/*
...
@@ -613,7 +612,7 @@ void printBatteryStatus(struct SBMFunctionDescriptionStruct * aDescription, uint
...
@@ -613,7 +612,7 @@ void printBatteryStatus(struct SBMFunctionDescriptionStruct * aDescription, uint
}
}
void
printFunctionDescriptionArray
(
struct
SBMFunctionDescriptionStruct
*
aSBMFunctionDescription
,
uint8_t
aLengthOfArray
,
void
printFunctionDescriptionArray
(
struct
SBMFunctionDescriptionStruct
*
aSBMFunctionDescription
,
uint8_t
aLengthOfArray
,
bool
aOnlyPrintIfValueChanged
)
{
bool
aOnlyPrintIfValueChanged
)
{
for
(
uint8_t
i
=
0
;
i
<
aLengthOfArray
;
++
i
)
{
for
(
uint8_t
i
=
0
;
i
<
aLengthOfArray
;
++
i
)
{
readWordAndPrint
(
aSBMFunctionDescription
,
aOnlyPrintIfValueChanged
);
readWordAndPrint
(
aSBMFunctionDescription
,
aOnlyPrintIfValueChanged
);
aSBMFunctionDescription
++
;
aSBMFunctionDescription
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment