⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 headset_pio.c

📁 BlueLab 3.5.2 单声道耳机源码
💻 C
字号:
/****************************************************************************Copyright (C) Cambridge Silicon Radio Ltd. 2004-2006Part of BlueLab 3.6.2-releaseFILE NAME    headset_LEDs.c    DESCRIPTION*/#include "headset_pio.h"#include "headset_private.h"#include <pio.h>#ifdef DEBUG_PIO#define PIO_DEBUG(x)  DEBUG (x)#else#define PIO_DEBUG(x) #endif/****************************************************************************NAME		LEDManagerSetPowerPinDESCRIPTION    controls the internal regulators to latch / remove the power on state    RETURNS	void*/void PioSetPowerPin ( hsTaskData * pApp , PowerPin_t pEnable ) {    bool lVal = (bool) pEnable ;        if ( pApp->features.PowerOnSMPS)    {        /*this is the power regulator PIO*/        PioSetPsuRegulator ( lVal ) ;         PIO_DEBUG(("PIO : PowerOnSMPS\n")) ;    }        if  ( pApp->features.PowerOnLDO)    {        PioSetInternalLDO ( lVal ) ;        PIO_DEBUG(("PIO : PowerOn LDO\n")) ;    }    }void PioSetLedPin ( LedTaskData * pLedTask , uint16 pPIO , bool pOnOrOff ) {   /*special LED pins are special cases*/    if ( pPIO == 14)            {        PioSetLed0 ( pOnOrOff ) ;        pLedTask->gLED_0_STATE = pOnOrOff ;    }    else if (pPIO == 15 )    {        PioSetLed1 ( pOnOrOff ) ;        pLedTask->gLED_1_STATE = pOnOrOff ;    }    else    {        PioSetPin (pPIO , pOnOrOff) ;    }}/****************************************************************************NAME		LEDManagerUpdateLEDDESCRIPTION    Fn to change an individual LED state     RETURNS	void*/void PioSetPin ( uint16 pPIO , bool pOnOrOff  ) {    uint16 lPinVals = 0 ;        uint16 lWhichPin  = 1 << pPIO ;        PIO_DEBUG(("PIO : set[%d][%d] [%x]\n",pPIO, pOnOrOff ,lWhichPin)) ;        if ( pOnOrOff == TRUE )        {        lPinVals = lWhichPin  ;    }    else    {        lPinVals = 0x0000;            /*clr the corresponding bit*/    }        PIO_DEBUG(("PIO : set[%x][%x]\n",lWhichPin , lPinVals)) ;        PioSetPinAsOutput(pPIO) ;            PioSet (  lWhichPin , lPinVals ) ;     }bool PioGetLedPin ( LedTaskData * pLedTask , uint16 pPIO ) {    bool lState = FALSE ;        /*special LED pins are special cases*/    if ( pPIO == 14)            {        lState = pLedTask->gLED_0_STATE ;    }    else if (pPIO == 15 )    {        lState =    pLedTask->gLED_1_STATE ;    }    else    {        lState = PioGetPin( pPIO ) ;    }        return lState ;}/****************************************************************************NAME		LEDManagerGetLEDStateDESCRIPTION    Fn to get the state of an individual LED         RETURNS	bool On or OFF*/bool PioGetPin (  uint16 pPIO ){    bool lState = FALSE ;    uint16 lMask  = 0;        lMask = PioGet ( ) ;        PIO_DEBUG(("PIO : g[%d] p[%d] [%d] ",lMask , pPIO , (lMask & (1<<pPIO)))) ;        if ( lMask & (1<<pPIO) )    {        lState = TRUE ;    }        PIO_DEBUG(("PIO :get[%d]l[%d]\n" , pPIO,lState)) ;            return lState ;}/****************************************************************************NAME		PioSetPinAsOutputDESCRIPTION    Fn to set a PIO as an output pin ( DDR)        RETURNS	void*/void PioSetPinAsOutput ( uint16 pPIO ){        /*(mask,bits) setting bit to a '1' sets the corresponding port as an output*/    uint16 lMask = (1<<pPIO) ;    PioSetDir(lMask,lMask);   }/****************************************************************************NAME		PioSetInternalLDODESCRIPTION    Fn to set the internal LDO pin      RETURNS	void*/void PioSetInternalLDO ( bool pEnable){    PioSetMicBias ( pEnable ) ;    PIO_DEBUG(("PIO : InternalLDO[%c]\n", pEnable ? 'T' :'F')) ;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -