Ejemplo n.º 1
0
void CheckBattery(void)
{
  BatterySenseCycle();

  if (!ClipOn())
  {
    ChargeStatus = CHARGE_STATUS_OFF;
    CheckBatteryLow();
  }
  else if (ChargeEnable) ChargingControl();
  
  PrintDecimal(Read(BATTERY)); PrintString(CR);
}
Ejemplo n.º 2
0
/*! Read the voltage of the battery. This provides power good, battery charging,
 * battery voltage, and battery voltage average.
 *
 * \param tHostMsg* pMsg is unused
 *
 */
static void ReadBatteryVoltageHandler(void)
{
  tMessage Msg;
  SetupMessageAndAllocateBuffer(&Msg, VBatRespMsg, MSG_OPT_NONE);
  Msg.Length = 6;

  Msg.pBuffer[0] = ClipOn();
  Msg.pBuffer[1] = Charging();
  Msg.pBuffer[2] = BatteryPercentage();

  unsigned int bv = Read(BATTERY);
  Msg.pBuffer[4] = bv & 0xFF;
  Msg.pBuffer[5] = (bv >> 8) & 0xFF;

  RouteMsg(&Msg);
}
Ejemplo n.º 3
0
unsigned char CheckClip(void)
{
  static unsigned char Last = CLIP_INIT;
  unsigned char Changed = pdFALSE;

  unsigned char Clip = ClipOn();

  if (Clip != Last)
  {
    /* change the mux settings accordingly */
    ChangeMuxMode(Clip);
    EnableDebugUart(Clip);

    if (Clip == CLIP_ON) PrintString2("- Atch", CR);
    
    Changed = pdTRUE;
    Last = Clip;
  }
  return Changed;
}
Ejemplo n.º 4
0
void SetMuxMode(unsigned char MuxMode)
{
  niMuxMode = MuxMode;
  ChangeMuxMode(ClipOn());
}