#include "Dezibot.h"

Dezibot dezibot = Dezibot();
void setup() {
  // put your setup code here, to run once:
  dezibot.begin();
}

float i_3v3;
float i_bat;
float bat_chargePercent;
float bat_coloumbs;
float bat_voltage;
bool isUSBPowered;
bool isCharging;
bool isFullyCharged;

char i3v3_line[26];
char ibat_line[26];
char bat_chargePercent_line[26];
char bat_coloumbs_line[26];
char bat_voltage_line[26];
char isUSBPowered_line[26];
char isCharging_line[26];
char isFullyCharged_line[26];

void loop() {
  i_3v3 = dezibot.power.getCurrentCurrent();
  i_bat = dezibot.power.getBatteryCurrent();
  bat_chargePercent = dezibot.power.getBatteryChargePercent();
  bat_coloumbs = dezibot.power.getBatteryChargeCoulombs();
  bat_voltage = dezibot.power.getBatteryVoltage();
  isUSBPowered = dezibot.power.isUSBPowered();
  isCharging = dezibot.power.isBatteryCharging();
  isFullyCharged = dezibot.power.isBatteryFullyCharged();

  sprintf(i3v3_line, "i_3v3: %.1f mA", i_3v3);
  sprintf(ibat_line, "i_bat: %.1f mA", i_bat);
  sprintf(bat_chargePercent_line, "CHG: %.2f %%", bat_chargePercent);
  sprintf(bat_coloumbs_line, "CHG: %.2f C", bat_coloumbs);
  sprintf(bat_voltage_line, "U: %.2f3V", bat_voltage);
  sprintf(isUSBPowered_line, "USBPower: %d", isUSBPowered);
  sprintf(isCharging_line, "Charging: %d", isCharging);
  sprintf(isFullyCharged_line, "Full: %d", isFullyCharged);

  dezibot.display.clear();
  dezibot.display.println(i3v3_line);
  dezibot.display.println(ibat_line);
  dezibot.display.println(bat_chargePercent_line);
  dezibot.display.println(bat_coloumbs_line);
  dezibot.display.println(bat_voltage_line);
  dezibot.display.println(isUSBPowered_line);
  dezibot.display.println(isCharging_line);
  dezibot.display.println(isFullyCharged_line);
  delay(1000);
}