void CheckBattery(void) { BatterySenseCycle(); if (!ClipOn()) { ChargeStatus = CHARGE_STATUS_OFF; CheckBatteryLow(); } else if (ChargeEnable) ChargingControl(); PrintDecimal(Read(BATTERY)); PrintString(CR); }
/*! 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); }
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; }
void SetMuxMode(unsigned char MuxMode) { niMuxMode = MuxMode; ChangeMuxMode(ClipOn()); }