?? on_off.c
字號:
#include "demohs.h"
#include <batt.h>
#include <pio.h>
/*
enterDeepSleepAsap
Disconnect everything and disable all you can to enable to chip
to go into deep sleep as soon as possible
*/
void enterDeepSleepAsap(void)
{
hsState.turnOffHs = 1;
/* Disable battery monitoring completely */
BattInit(VM_ADC_TEST_A, D_NEVER);
if (hsState.connectState == idle)
{
/* Cancel the flashing LEDs */
changeFlash();
}
else if (hsState.connectState == connectingAsMaster ||
hsState.connectState == connectingAsSlave ||
hsState.connectState == pairing)
{
/*
Check the current state and cancel it
NOTE this button only works if the headset is not already connected
Entering idle state will call changeFlash() and stop the LEDs
*/
cancelOperation();
if (hsState.connectState == pairing)
hsState.pairingPending = 1;
}
else
{
/*
Reset this flag otherwise the headset will turn off as soon
as the AG drops the connections and that can be confusing
to the user. This way the headset will go into idle mode
and the off button can then be pressed to switch off
everything else
*/
hsState.turnOffHs = 0;
}
}
/*
enterActiveStateAsap
Re-enable everything so headset can operate as before. The flashing LEDs
will be re-enabled when the headset changes state.
*/
void enterActiveStateAsap(void)
{
hsState.turnOffHs = 0;
/* enable battery monitoring */
BattInit(VM_ADC_TEST_A, BATT_MONITOR_PERIOD);
/* Power up into idle mode */
updateHsConnectState(idle);
/*
If we were in pairing mode before the power down go back
into it as all pairing info has been reset anyway. Otherwise
become connectable.
*/
if (hsState.pairingPending)
pairButton();
else
talkButton();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -