MatrixMiniR4
1.1.9
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4Power.h
Go to the documentation of this file.
1
6
#ifndef MINIR4POWER_H
7
#define MINIR4POWER_H
8
9
#include "
MMLower.h
"
10
17
class
MiniR4Power
18
{
19
public
:
20
MiniR4Power
() {}
21
28
bool
setBattCell
(uint8_t cell)
29
{
30
switch
(cell) {
31
case
2:
return
(
mmL
.SetPowerParam(8.4, 6.8, 7.4) ==
MMLower::RESULT::OK
);
break
;
32
case
3:
return
(
mmL
.SetPowerParam(12.6, 10.2, 11.1) ==
MMLower::RESULT::OK
);
break
;
33
case
4:
return
(
mmL
.SetPowerParam(16.8, 13.6, 14.8) ==
MMLower::RESULT::OK
);
break
;
34
case
5:
return
(
mmL
.SetPowerParam(21.0, 17.0, 18.5) ==
MMLower::RESULT::OK
);
break
;
35
case
6:
return
(
mmL
.SetPowerParam(25.2, 20.4, 22.2) ==
MMLower::RESULT::OK
);
break
;
36
default
:
return
false
;
break
;
37
}
38
}
39
45
float
getBattVoltage
(
void
)
46
{
47
float
voltage = 0, perc = 0;
48
if
(
mmL
.GetPowerInfo(voltage, perc) ==
MMLower::RESULT::OK
)
49
return
voltage;
50
else
51
return
0;
52
}
53
59
float
getBattPercentage
(
void
)
60
{
61
float
voltage = 0, perc = 0;
62
if
(
mmL
.GetPowerInfo(voltage, perc) ==
MMLower::RESULT::OK
)
63
return
perc;
64
else
65
return
0;
66
}
67
68
private
:
69
};
70
71
#endif
// MINIR4POWER_H
mmL
MMLower mmL(8, 9, 57600)
MMLower.h
Handling the Lower MCU (STM32) communication.
MMLower::RESULT::OK
@ OK
Definition
MMLower.h:256
MiniR4Power::setBattCell
bool setBattCell(uint8_t cell)
Sets the battery parameters based on the number of cells.
Definition
MiniR4Power.h:28
MiniR4Power::MiniR4Power
MiniR4Power()
Definition
MiniR4Power.h:20
MiniR4Power::getBattPercentage
float getBattPercentage(void)
Retrieves the current battery percentage.
Definition
MiniR4Power.h:59
MiniR4Power::getBattVoltage
float getBattVoltage(void)
Retrieves the current battery voltage.
Definition
MiniR4Power.h:45
MatrixMiniR4_DOX
src
Modules
MiniR4Power.h
Generated by
1.13.2