本文整理汇总了C++中LED_Enable函数的典型用法代码示例。如果您正苦于以下问题:C++ LED_Enable函数的具体用法?C++ LED_Enable怎么用?C++ LED_Enable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LED_Enable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
//Make sure that the general purpose output driver multiplexed with
//the VBUS pin is always consistently configured to be tri-stated in
//USB applications, so as to avoid any possible contention with the host.
//(ex: maintain TRISFbits.TRISF7 = 1 at all times).
TRISFbits.TRISF7 = 1;
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_KEYBOARD_CAPS_LOCK);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_KEYBOARD_KEY);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
default:
break;
}
}
开发者ID:JarrettR,项目名称:USBvil,代码行数:38,代码来源:system.c
示例2: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
//Configure oscillator settings for clock settings compatible with USB
//operation. Note: Proper settings depends on USB speed (full or low).
#if(USB_SPEED_OPTION == USB_FULL_SPEED)
OSCTUNE = 0x80; //3X PLL ratio mode selected
OSCCON = 0x70; //Switch to 16MHz HFINTOSC
OSCCON2 = 0x10; //Enable PLL, SOSC, PRI OSC drivers turned off
while(OSCCON2bits.PLLRDY != 1); //Wait for PLL lock
ACTCON = 0x90; //Enable active clock tuning for USB operation
#endif
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_CUSTOM);
LED_Enable(LED_D2);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_CUSTOM);
ADC_SetConfiguration(ADC_CONFIGURATION_DEFAULT);
ADC_Enable(ADC_CHANNEL_POTENTIOMETER);
ADC_Enable(ADC_CHANNEL_1);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:right-hearted,项目名称:hardkernel-usb-io-pic18f45k50,代码行数:45,代码来源:system.c
示例3: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
//Switch to alternate interrupt vector table for bootloader
INTCON2bits.ALTIVT = 1;
BUTTON_Enable(BUTTON_USB_DEVICE_HID_CUSTOM);
if((BUTTON_IsPressed(BUTTON_USB_DEVICE_HID_CUSTOM)==false) && ((RCON & 0x83) != 0))
{
//Switch to app standare IVT for non boot mode
INTCON2bits.ALTIVT = 0;
__asm__("goto 0x1800");
}
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_CUSTOM);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:kerikun11,项目名称:MPLABXProjects,代码行数:40,代码来源:system.c
示例4: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize(SYSTEM_STATE state) {
switch (state) {
case SYSTEM_STATE_USB_START:
//Configure oscillator settings for clock settings compatible with USB
//operation. Note: Proper settings depends on USB speed (full or low).
#if(USB_SPEED_OPTION == USB_FULL_SPEED)
OSCTUNE = 0x80; //3X PLL ratio mode selected
OSCCON = 0x70; //Switch to 16MHz HFINTOSC
OSCCON2 = 0x10; //Enable PLL, SOSC, PRI OSC drivers turned off
while (OSCCON2bits.PLLRDY != 1); //Wait for PLL lock
ACTCON = 0x90; //Enable active clock tuning for USB operation
#endif
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_POWER_STATE);
LED_On(LED_POWER_STATE);
BUTTON_Enable(BUTTON_LEFT);
BUTTON_Enable(BUTTON_RIGHT);
stepper_motor_enable();
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:robinsonsam,项目名称:USB_STEPPER_MOTOR,代码行数:41,代码来源:system.c
示例5: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_D2);
LED_Enable(LED_D3);
LED_Enable(LED_D4);
BUTTON_Enable(BUTTON_S1);
BUTTON_Enable(BUTTON_S2);
BUTTON_Enable(BUTTON_S3);
ADC_Enable(ADC_CHANNEL_1);
ADC_Enable(ADC_CHANNEL_2);
ADC_Enable(ADC_CHANNEL_3);
ADC_SetConfiguration(ADC_CONFIGURATION_DEFAULT);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:polovik,项目名称:notikeys,代码行数:37,代码来源:system.c
示例6: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
#if defined(USE_INTERNAL_OSC)
//Make sure to turn on active clock tuning for USB full speed
//operation from the INTOSC
OSCCON = 0xFC; //HFINTOSC @ 16MHz, 3X PLL, PLL enabled
ACTCON = 0x90; //Active clock tuning enabled for USB
#endif
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_CUSTOM);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_CUSTOM);
ADC_SetConfiguration(ADC_CONFIGURATION_DEFAULT);
ADC_Enable(ADC_CHANNEL_POTENTIOMETER);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:timwuu,项目名称:PK3SP24,代码行数:39,代码来源:system.c
示例7: SYSTEM_Tasks
/*********************************************************************
* Function: void SYSTEM_Tasks(void)
*
* Overview: Runs system level tasks that keep the system running
*
* PreCondition: System has been initalized with SYSTEM_Initialize()
*
* Input: None
*
* Output: None
*
********************************************************************/
void SYSTEM_Tasks(void)
{
switch(softStartStatus)
{
case SOFT_START_POWER_OFF:
break;
case SOFT_START_POWER_START:
if(USBGetDeviceState() != CONFIGURED_STATE)
{
break;
}
AppPowerEnable();
softStartStatus = SOFT_START_POWER_ENABLED;
break;
case SOFT_START_POWER_ENABLED:
if(AppPowerReady() == true)
{
softStartStatus = SOFT_START_POWER_READY;
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_CUSTOM);
ADC_SetConfiguration(ADC_CONFIGURATION_DEFAULT);
ADC_Enable(ADC_CHANNEL_POTENTIOMETER);
}
break;
case SOFT_START_POWER_READY:
break;
}
}
开发者ID:timwuu,项目名称:PK3SP24,代码行数:45,代码来源:system.c
示例8: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
//On the PIC24FJ64GB004 Family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 32MHz
//operation. On these devices, user firmware needs to manually set the CLKDIV<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
CLKDIVbits.PLLEN = 1;
while(pll_startup_counter--);
}
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_DEVICE_VENDOR_BASIC_DEMO);
BUTTON_Enable(BUTTON_DEVICE_VENDOR_BASIC_DEMO);
break;
default:
break;
}
}
开发者ID:kerikun11,项目名称:MPLABXProjects,代码行数:38,代码来源:system.c
示例9: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
/*ANSELA = 0x0000;
ANSELB = 0x0000;
ANSELC = 0x0000;
ANSELD = 0x0000;
ANSELE = 0x0000;
ANSELG = 0x0000;*/
// Configure the device PLL to obtain 60 MIPS operation. The crystal
// frequency is 8MHz. Divide 8MHz by 2, multiply by 60 and divide by
// 2. This results in Fosc of 120MHz. The CPU clock frequency is
// Fcy = Fosc/2 = 60MHz. Wait for the Primary PLL to lock and then
// configure the auxilliary PLL to provide 48MHz needed for USB
// Operation.
PLLFBD = 58; /* M = 60 */
CLKDIVbits.PLLPOST = 0; /* N1 = 2 */
CLKDIVbits.PLLPRE = 0; /* N2 = 2 */
OSCTUN = 0;
/* Initiate Clock Switch to Primary
* Oscillator with PLL (NOSC= 0x3)*/
__builtin_write_OSCCONH(0x03);
__builtin_write_OSCCONL(0x01);
while (OSCCONbits.COSC != 0x3);
// Configuring the auxiliary PLL, since the primary
// oscillator provides the source clock to the auxiliary
// PLL, the auxiliary oscillator is disabled. Note that
// the AUX PLL is enabled. The input 8MHz clock is divided
// by 2, multiplied by 24 and then divided by 2. Wait till
// the AUX PLL locks.
ACLKCON3 = 0x24C1;
ACLKDIV3 = 0x7;
ACLKCON3bits.ENAPLL = 1;
while(ACLKCON3bits.APLLCK != 1);
ADC_SetConfiguration(ADC_CONFIGURATION_DEFAULT);
ADC_ChannelEnable(ADC_CHANNEL_POTENTIOMETER);
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_CUSTOM);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_CUSTOM);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:media3-0,项目名称:EkoPuszka,代码行数:71,代码来源:system.c
示例10: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
//Make sure that the general purpose output driver multiplexed with
//the VBUS pin is always consistently configured to be tri-stated in
//USB applications, so as to avoid any possible contention with the host.
//(ex: maintain TRISFbits.TRISF7 = 1 at all times).
TRISFbits.TRISF7 = 1;
//Configure clock settings to be compatible with USB operation.
//This could involve doing nothing (ex: if the config bit settings
//already result in a USB compatible clock frequency at bootup), or,
//could involve clock switching and/or turning on the PLL and/or turning
//on the active clock tuning feature.
#if defined(USB_RUN_FROM_EXPLORER_16_8MHZ_CRYSTAL)
//Don't need to do anything, with the default config bit settings for this
//oscillator setting, since the settings will already be USB compatible.
#else
//Assume USB_RUN_FROM_FRCPLL_WITH_ACTIVE_CLOCK_TUNING is selected instead.
CLKDIV = 0x3120; //Set FRC to 4MHz output mode, and CPUDIV to 1:1 (which is a USB compatible setting)
__builtin_write_OSCCONH(0x01); //0x01 = FRCPLL with postscalar
__builtin_write_OSCCONL(OSCCON | 0x0001); //Set the OSWEN bit, to initiate clock switching operation.
//Wait for PLL lock
while(OSCCONbits.LOCK == 0);
//Turn on the active clock tuning for USB operation
OSCTUN = 0x9000; //Enable active clock tuning from USB host reference
//The oscillator settings should now be USB compatible.
#endif
//Configure other USB or application related resources.
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_KEYBOARD_CAPS_LOCK);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_KEYBOARD_KEY);
BUTTON_Enable(BUTTON_USB_DEVICE_REMOTE_WAKEUP);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
default:
break;
}
}
开发者ID:JarrettR,项目名称:USBvil,代码行数:61,代码来源:system.c
示例11: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
//On the PIC24FJ64GB004 Family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 32MHz
//operation. On these devices, user firmware needs to manually set the CLKDIV<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
CLKDIVbits.PLLEN = 1;
while(pll_startup_counter--);
}
switch(state)
{
case SYSTEM_STATE_USB_HOST:
PRINT_SetConfiguration(PRINT_CONFIGURATION_UART);
break;
case SYSTEM_STATE_USB_HOST_HID_KEYBOARD:
LED_Enable(LED_USB_HOST_HID_KEYBOARD_DEVICE_READY);
//also setup UART here
PRINT_SetConfiguration(PRINT_CONFIGURATION_UART);
//timwuu 2015.04.11 LCD_CursorEnable(true);
TIMER_SetConfiguration(TIMER_CONFIGURATION_1MS);
break;
}
}
开发者ID:timwuu,项目名称:PK3SP24,代码行数:45,代码来源:system.c
示例12: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
//In this devices family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 48MHz
//operation. On these devices, user firmware needs to manually set the OSCTUNE<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
OSCTUNEbits.PLLEN = 1; //Enable the PLL and wait 2+ms until the PLL locks before enabling USB module
while(pll_startup_counter--);
}
//Device switches over automatically to PLL output after PLL is locked and ready.
LED_Enable(LED_USB_DEVICE_STATE);
BUTTON_Enable(BUTTON_DEVICE_HID_DIGITIZER_DEMO);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:kerikun11,项目名称:MPLABXProjects,代码行数:40,代码来源:system.c
示例13: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
int value;
switch(state)
{
case SYSTEM_STATE_USB_START:
value = SYSTEMConfigWaitStatesAndPB( 64000000UL );
// Enable the cache for the best performance
CheKseg0CacheOn();
INTEnableSystemMultiVectoredInt();
value = OSCCON;
while (!(value & 0x00000020))
{
value = OSCCON; // Wait for PLL lock to stabilize
}
//Disable JTAG
DDPCONbits.JTAGEN = 0;
LED_Enable(LED_USB_DEVICE_STATE);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_MOUSE);
break;
default:
break;
}
}
开发者ID:sparshgupta1,项目名称:garrulous-octo-funicular,代码行数:43,代码来源:system.c
示例14: SYSTEM_Tasks
/*********************************************************************
* Function: void SYSTEM_Tasks(void)
*
* Overview: Runs system level tasks that keep the system running
*
* PreCondition: System has been initalized with SYSTEM_Initialize()
*
* Input: None
*
* Output: None
*
********************************************************************/
void SYSTEM_Tasks(void)
{
switch(softStartStatus)
{
case SOFT_START_POWER_OFF:
break;
case SOFT_START_POWER_START:
if(USBGetDeviceState() != CONFIGURED_STATE)
{
break;
}
AppPowerEnable();
softStartStatus = SOFT_START_POWER_ENABLED;
break;
case SOFT_START_POWER_ENABLED:
if(AppPowerReady() == true)
{
softStartStatus = SOFT_START_POWER_READY;
LED_Enable(LED_USB_DEVICE_STATE);
}
break;
case SOFT_START_POWER_READY:
break;
}
}
开发者ID:kerikun11,项目名称:MPLABXProjects,代码行数:41,代码来源:system.c
示例15: LED_Wakeup
/*******************************************************************************
* Function Name: LED_Wakeup
********************************************************************************
*
* Summary:
* Restores and enables the user configuration
*
* Parameters:
* None.
*
* Return:
* None.
*
* Global Variables:
* LED_backup - used when non-retention registers are restored.
*
*******************************************************************************/
void LED_Wakeup(void)
{
LED_RestoreConfig();
if(LED_backup.enableState != 0u)
{
LED_Enable();
}
}
开发者ID:e2forlife,项目名称:PSoC-W5100-Driver,代码行数:25,代码来源:LED_PM.c
示例16: SYS_Initialize
/*********************************************************************
* Function: void SYS_Initialize(void)
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
********************************************************************/
void SYS_Initialize()
{
TIMER_SetConfiguration(TIMER_CONFIGURATION_1MS);
ADC_SetConfiguration(ADC_CONFIGURATION_DEFAULT);
LED_Enable(LED_USB_HOST_MSD_DATA_LOGGER);
LED_Off(LED_USB_HOST_MSD_DATA_LOGGER);
BUTTON_Enable(BUTTON_USB_HOST_MSD_DATA_LOGGER);
}
开发者ID:kaipyroami,项目名称:ElektroMobLoggerUSB,代码行数:20,代码来源:system.c
示例17: SYSTEM_Initialize
// *****************************************************************************
// *****************************************************************************
// Section: Macros or Functions
// *****************************************************************************
// *****************************************************************************
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_KEYBOARD_CAPS_LOCK);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_KEYBOARD_KEY);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:kerikun11,项目名称:MPLABXProjects,代码行数:22,代码来源:system.c
示例18: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_HOST:
ANSELA = 0x0000;
ANSELB = 0x0000;
ANSELC = 0x0000;
ANSELD = 0x0000;
ANSELE = 0x0000;
ANSELG = 0x0000;
// Configure the device PLL to obtain 60 MIPS operation. The crystal
// frequency is 8MHz. Divide 8MHz by 2, multiply by 60 and divide by
// 2. This results in Fosc of 120MHz. The CPU clock frequency is
// Fcy = Fosc/2 = 60MHz. Wait for the Primary PLL to lock and then
// configure the auxilliary PLL to provide 48MHz needed for USB
// Operation.
PLLFBD = 58; /* M = 60 */
CLKDIVbits.PLLPOST = 0; /* N1 = 2 */
CLKDIVbits.PLLPRE = 0; /* N2 = 2 */
OSCTUN = 0;
/* Initiate Clock Switch to Primary
* Oscillator with PLL (NOSC= 0x3)*/
__builtin_write_OSCCONH(0x03);
__builtin_write_OSCCONL(0x01);
while (OSCCONbits.COSC != 0x3);
// Configuring the auxiliary PLL, since the primary
// oscillator provides the source clock to the auxiliary
// PLL, the auxiliary oscillator is disabled. Note that
// the AUX PLL is enabled. The input 8MHz clock is divided
// by 2, multiplied by 24 and then divided by 2. Wait till
// the AUX PLL locks.
ACLKCON3 = 0x24C1;
ACLKDIV3 = 0x7;
ACLKCON3bits.ENAPLL = 1;
while(ACLKCON3bits.APLLCK != 1);
PRINT_SetConfiguration(PRINT_CONFIGURATION_LCD);
LED_Enable(LED_USB_HOST_HID_MOUSE_DEVICE_READY);
break;
case SYSTEM_STATE_USB_HOST_HID_MOUSE:
PRINT_SetConfiguration(PRINT_CONFIGURATION_LCD);
LCD_CursorEnable(true);
TIMER_SetConfiguration(TIMER_CONFIGURATION_1MS);
break;
}
}
开发者ID:kerikun11,项目名称:MPLABXProjects,代码行数:69,代码来源:system.c
示例19: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_CUSTOM);
BUTTON_Enable(BUTTON_USB_DEVICE_HID_CUSTOM);
ADC_SetConfiguration(ADC_CONFIGURATION_DEFAULT);
ADC_ChannelEnable(ADC_CHANNEL_POTENTIOMETER);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:timwuu,项目名称:PK3SP24,代码行数:33,代码来源:system.c
示例20: SYSTEM_Initialize
/*********************************************************************
* Function: void SYSTEM_Initialize( SYSTEM_STATE state )
*
* Overview: Initializes the system.
*
* PreCondition: None
*
* Input: SYSTEM_STATE - the state to initialize the system into
*
* Output: None
*
********************************************************************/
void SYSTEM_Initialize( SYSTEM_STATE state )
{
switch(state)
{
case SYSTEM_STATE_USB_START:
//Switch to alternate interrupt vector table for bootloader
INTCON2bits.ALTIVT = 1;
BUTTON_Enable(BUTTON_USB_DEVICE_HID_CUSTOM);
if((BUTTON_IsPressed(BUTTON_USB_DEVICE_HID_CUSTOM)==false) && ((RCON & 0x83) != 0))
{
//Switch to app standare IVT for non boot mode
INTCON2bits.ALTIVT = 0;
__asm__("goto 0x1800");
}
//On the PIC24FJ64GB004 Family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 32MHz
//operation. On these devices, user firmware needs to manually set the CLKDIV<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
CLKDIVbits.PLLEN = 1;
while(pll_startup_counter--);
}
LED_Enable(LED_USB_DEVICE_STATE);
LED_Enable(LED_USB_DEVICE_HID_CUSTOM);
break;
case SYSTEM_STATE_USB_SUSPEND:
break;
case SYSTEM_STATE_USB_RESUME:
break;
}
}
开发者ID:kerikun11,项目名称:MPLABXProjects,代码行数:52,代码来源:system.c
注:本文中的LED_Enable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论