** Function name: getBattery() ** Description: Delivers the battery value from 1-100 ***************************************************************************************/
| 22 | ** Description: Delivers the battery value from 1-100 |
| 23 | ***************************************************************************************/ |
| 24 | int getBattery() { |
| 25 | int percent = 0; |
| 26 | float b = axp192.GetBatVoltage(); |
| 27 | percent = ((b - 3.0) / 1.2) * 100; |
| 28 | |
| 29 | return (percent < 0) ? 0 : (percent >= 100) ? 100 : percent; |
| 30 | } |
| 31 | |
| 32 | /********************************************************************* |
| 33 | ** Function: setBrightness |
nothing calls this directly
no test coverage detected