English
Language : 

AN92584 Datasheet, PDF (10/42 Pages) Ramtron International Corporation – Designing for Low Power and Estimating Battery Life for BLE Applications
Designing for Low Power and Estimating Battery Life for BLE Applications
 [C6] Call the ManageApplicationPower() function to manage the power mode transitions for the
application-specific, non-BLE components.
 [C7] Call the ManageSystemPower()function. The function checks both the application power mode and the
BLESS power mode to put the entire system into the Sleep or Deep-Sleep mode.
int main()
{
/* Variable declarations */
CYBLE_LP_MODE_T lpMode;
CYBLE_BLESS_STATE_T blessState;
uint8 interruptStatus;
/* Enable global interrupts */
CyGlobalIntEnable;
/* C1. Stop the ILO to reduce current consumption */
CySysClkIloStop();
/* C2. Configure the divider values for the ECO, so that a 3-MHz ECO divided
clock can be provided to the CPU in Sleep mode */
CySysClkWriteEcoDiv(CY_SYS_CLK_ECO_DIV8);
/* Start the BLE Component and register the generic event handler */
apiResult = CyBle_Start(AppCallBack);
/* Wait for BLE Component to initialize */
while (CyBle_GetState() == CYBLE_STATE_INITIALIZING)
{
CyBle_ProcessEvents();
}
/*Application-specific Component and other initialization code below */
applicationPower = ACTIVE;
/* main while loop of the application */
while(1)
{
/* Process all pending BLE events in the stack */
CyBle_ProcessEvents();
/* C3. Call the function that manages the BLESS power modes */
CyBle_EnterLPM(CYBLE_BLESS_DEEPSLEEP);
/*C4. Run your application specific code here */
if(applicationPower == ACTIVE)
{
RunApplication();
}
/*C6. Manage Application power mode */
ManageApplicationPower();
/*C7. Manage System power mode */
ManageSystemPower();
}
}
/****************************************************************************
* C5. Function Name: RunApplication()
*****************************************************************************
*
* Summary:
* This function is a template to run Application-specific code.
www.cypress.com
Document No. 001-92584 Rev. *A
10