Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

ddi_bc_Status_t ddi_bc_SetNewPeriodAndSlope ( uint32_t  u32StateMachinePeriod,
uint16_t  u16CurrentRampSlope 

Set the battery charger state machine period.


This function sets a new state machine period. The Period and Slope should be coordinated to achieve the minimal ramp step current which will minimize transients on the system.

[in] u32StateMachinePeriod (in milliseconds)
[in] u16CurrentRampSlope (in mA/s)
Return values:
SUCCESS If all goes well
ERROR_DDI_BCM_NOT_INITIALIZED If the Battery Charger is not yet initialized.

Definition at line 443 of file ddi_bc_api.c.

References ddi_bc_SetDisable(), ddi_bc_SetEnable(), DDI_BC_STATE_DISABLED, DDI_BC_STATE_UNINITIALIZED, DDI_BC_STATUS_NOT_INITIALIZED, DDI_BC_STATUS_SUCCESS, g_ddi_bc_State, _ddi_bc_Cfg::u16CurrentRampSlope, and _ddi_bc_Cfg::u32StateMachinePeriod.

      // Check if we've been initialized yet.
      bool bDisableRequired;

      if (g_ddi_bc_State == DDI_BC_STATE_UNINITIALIZED) {
            return (DDI_BC_STATUS_NOT_INITIALIZED);

      if (g_ddi_bc_State == DDI_BC_STATE_DISABLED)
            bDisableRequired = false;
      else {
            bDisableRequired = true;

      // Looking at the code, changing the period while the battery charger is running
      // doesn't seem to have a negative affect.  One could wrap this in the mutex
      // or implement further coordination if it did.
      g_ddi_bc_Configuration.u32StateMachinePeriod = u32StateMachinePeriod;
      g_ddi_bc_Configuration.u16CurrentRampSlope = u16CurrentRampSlope;

      if (bDisableRequired)

      return (DDI_BC_STATUS_SUCCESS);


Generated by  Doxygen 1.6.0   Back to index