本文整理汇总了C++中HAL_ENABLE_INTERRUPTS函数的典型用法代码示例。如果您正苦于以下问题:C++ HAL_ENABLE_INTERRUPTS函数的具体用法?C++ HAL_ENABLE_INTERRUPTS怎么用?C++ HAL_ENABLE_INTERRUPTS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HAL_ENABLE_INTERRUPTS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/**************************************************************************************************
* @fn main
*
* @brief Start of application.
*
* @param none
*
* @return none
**************************************************************************************************
*/
int main(void)
{
/* Initialize hardware */
HAL_BOARD_INIT();
/* Initialze the HAL driver */
HalDriverInit();
/* Initialize NV system */
osal_snv_init();
/* Initialize LL */
/* Initialize the operating system */
osal_init_system();
/* Enable interrupts */
HAL_ENABLE_INTERRUPTS();
/* Setup Keyboard callback */
HalKeyConfig(false, MSA_Main_KeyCallback);
/* Blink LED on startup */
HalLedSet (HAL_LED_4, HAL_LED_MODE_ON);
/* Start OSAL */
osal_start_system(); // No Return from here
return 0;
}
示例2: main
int main( void )
{
halInit();
moduleInit();
printf("\r\n****************************************************\r\n");
printf("Fragmentation Example - ROUTER - using AFZDO\r\n");
buttonIsr = &handleButtonPress;
#define MODULE_START_DELAY_IF_FAIL_MS 5000
/* See basic communications examples for more information about module startup. */
struct moduleConfiguration defaultConfiguration = DEFAULT_MODULE_CONFIGURATION_ROUTER;
start:
while ((result = startModule(&defaultConfiguration, GENERIC_APPLICATION_CONFIGURATION)) != MODULE_SUCCESS)
{
printf("Module start unsuccessful. Error Code 0x%02X. Retrying...\r\n", result);
delayMs(MODULE_START_DELAY_IF_FAIL_MS);
}
printf("On Network!\r\n");
setLed(0);
/* On network, display info about this network */
#ifdef DISPLAY_NETWORK_INFORMATION //excluded to reduce code size
displayNetworkConfigurationParameters();
displayDeviceInformation();
#endif
HAL_ENABLE_INTERRUPTS();
/* Now the network is running - send a message to the coordinator every few seconds.*/
#define TEST_CLUSTER 0x77
/* Fill test message buffer with an incrementing counter */
int i = 0;
for (i=0; i<MESSAGE_LENGTH; i++)
{
testMessage[i] = i;
}
printf("Sending the following message:\r\n");
uint8_t counter = 0;
while (1)
{
printf("Sending Message #%u L%u to Short Address 0x0000 (Coordinator) ", counter++, MESSAGE_LENGTH);
/* Send an extended length message to a short address */
moduleResult_t result = afSendDataExtendedShort(DEFAULT_ENDPOINT, DEFAULT_ENDPOINT, 0, TEST_CLUSTER, testMessage, MESSAGE_LENGTH); //a short message - coordinator will receive an AF_INCOMING_MSG_EXT
if (result == MODULE_SUCCESS)
{
printf("Success\r\n");
} else {
printf("ERROR %i ", result);
#ifdef RESTART_AFTER_ZM_FAILURE
printf("\r\nRestarting\r\n");
goto start;
#else
printf("stopping\r\n");
while(1);
#endif
}
delayMs(2000);
}
}
示例3: main
/**
* @brief Start of application.
*/
int main(void)
{
/* Initialize hardware */
HAL_BOARD_INIT();
// Initialize board I/O
InitBoard( OB_COLD );
/* Initialze the HAL driver */
HalDriverInit();
/* Initialize NV system */
osal_snv_init();
/* Initialize LL */
/* Initialize the operating system */
osal_init_system();
/* Enable interrupts */
HAL_ENABLE_INTERRUPTS();
// Final board initialization
InitBoard( OB_READY );
osal_pwrmgr_device( PWRMGR_ALWAYS_ON );
HCI_EXT_ClkDivOnHaltCmd(HCI_EXT_DISABLE_CLK_DIVIDE_ON_HALT);
/* Start OSAL */
osal_start_system(); // No Return from here
return 0;
}
示例4: Read_Data
/*************************************************************
* @fn Write_Data
*
* @brief This func for read data form slave device
*
* @param uint8 - Address of slave device
*
* @return uint8 - The byte read form the Addr
*/
uint8 Read_Data(uint8 Addr)
{
uint8 Value;
HAL_DISABLE_INTERRUPTS();
I2c_Start(); //make the I2C bus begin
//if((Addr != Last_Addr + 1) || (Addr & 0xFF))
//{
I2c_Write_Byte(0xC8 ); // write address 1100100 and make the R/w with 0
I2c_Ack();
I2c_Write_Byte(Addr);// write register to slaver
I2c_Ack();
I2c_Start(); //repeat make the I2C bus begin
I2c_Write_Byte(0xC9);// write address 1100100 and make the R/w with 1
I2c_Ack();
Value = I2c_Read_Byte(); // we recive the content from slaver
I2c_Stop();
HAL_ENABLE_INTERRUPTS();
return Value;
}
示例5: HAL_ISR_FUNCTION
HAL_ISR_FUNCTION(port1Isr, P1INT_VECTOR)
#endif
{
HAL_ENTER_ISR();
#endif
PxIFG = 0;
PxIF = 0;
spiRdyIsr = 1;
#if !defined HAL_SPI_MASTER
if (spiTxLen == 0)
{
#if !defined HAL_SBL_BOOT_CODE
CLEAR_SLEEP_MODE();
UxDBUF = 0x00;
SPI_SET_RDY_OUT();
#endif
SPI_CLR_RDY_OUT(); /* SPI_RDYOut = 1 */
}
#endif
#if !defined HAL_SBL_BOOT_CODE
CLEAR_SLEEP_MODE();
HAL_EXIT_ISR();
#endif
HAL_ENABLE_INTERRUPTS();
}
示例6: sblExec
/**************************************************************************************************
* @fn sblExec
*
* @brief Infinite SBL execute loop that returns upon receiving a code enable.
*
* input parameters
*
* None.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
static void sblExec(void)
{
uint32 dlyCnt = 0;
vddWait(VDD_MIN_NV);
HAL_ENABLE_INTERRUPTS();
while (1)
{
if (dlyCnt++ & 0x4000)
{
SB_TOGGLE_LED1();
}
HalUARTPollUSB();
if (sbExec())
{
break;
}
}
SB_TURN_ON_LED1();
SB_TURN_ON_LED2();
// Delay to allow the SB_ENABLE_CMD response to be flushed.
for (dlyCnt = 0; dlyCnt < 0x40000; dlyCnt++)
{
HalUARTPollUSB();
}
}
示例7: handle_pending_hsrs
void handle_pending_hsrs(void)
{
extern int32_t sched_lock;
int nr;
list_head_t *list, *node;
hsr_t *hsr;
if (sched_lock > 0)
return;
// just only to prevent hisrs to schedule
++sched_lock;
while (1) {
nr = HAL_FIND_FIRST_SET(hsr_bitmap);
if (nr < 0)
break;
list = hsr_array + nr;
node = LIST_FIRST(list);
BUG_ON(NULL == node);
hsr = LIST_ENTRY(node, hsr_t, node);
hsr->function(hsr->data);
HAL_DISABLE_INTERRUPTS();
--hsr->count;
if (hsr->count <= 0)
LIST_DEL(node);
if (LIST_EMPTY(list))
hsr_bitmap &= ~(1 << nr);
HAL_ENABLE_INTERRUPTS();
}
--sched_lock;
}
示例8: main
/*---------------------------------------------------------------------------
* main
*-------------------------------------------------------------------------*/
int main(void)
{
/* Initialize hardware */
HAL_BOARD_INIT();
// Initialize board I/O
InitBoard( OB_COLD );
/* PCB specific initialization */
cbHW_init();
/* Initialze the HAL driver */
HalDriverInit();
/* Initialize NV system */
osal_snv_init();
/* Initialize the operating system */
osal_init_system();
/* Enable interrupts */
HAL_ENABLE_INTERRUPTS();
/* Final board initialization */
InitBoard( OB_READY );
#if defined ( POWER_SAVING )
osal_pwrmgr_device( PWRMGR_BATTERY );
#endif
/* Start OSAL */
osal_start_system(); // No Return from here
return 0;
}
示例9: main
/**************************************************************************************************
* @fn main
*
* @brief Start of application.
*
* @param none
*
* @return none
**************************************************************************************************
*/
int main(void)
{
/* Initialize hardware */
HAL_BOARD_INIT();
/* Initialze the HAL driver */
HalDriverInit();
/* Initialize NV system */
osal_snv_init();
/* Initialize the operating system */
osal_init_system();
/* Enable interrupts */
HAL_ENABLE_INTERRUPTS();
#if defined POWER_SAVING
osal_pwrmgr_device( PWRMGR_BATTERY );
#endif
/* Start OSAL */
osal_start_system(); // No Return from here
return 0;
}
示例10: cyg_user_start
/****************************************************************************
Function: cyg_user_start
Description: This routine is the entry point of the application task.
Inputs: none
Returns: none
****************************************************************************/
void cyg_user_start(void)
{
/* Turn all led's on */
P4205_LED_ON(P4205_BOARD_CNTL_STATUS, P4205_FP_LED_ALL);
#ifdef CYGPKG_KERNEL /* Using eCos kernel */
/* Create a dacMode Thread */
cyg_thread_create(10, /* Thread priority */
(cyg_thread_entry_t *)TskFunc_dacMode, /* Entry function */
0, /* Thread function arg */
"dacMode", /* Thread name */
stThread_dacMode, /* Thread Stack Base */
CYGNUM_HAL_STACK_SIZE_TYPICAL, /* Thread Stack Size */
&hThread_dacMode, /* Thread Handle */
&oThread_dacMode); /* Thread Housekeeping Info */
/* Take thread out of suspended state */
cyg_thread_resume(hThread_dacMode);
#else /* No eCos kernel */
/* Enable Processor Interrupts - not required but enables gdb/insight
* for stopping an executing program using the stop button or Ctrl-C.
*/
HAL_ENABLE_INTERRUPTS();
/* Invoke application directly */
TskFunc_dacMode();
#endif
} /* end cyg_user_start() */
示例11: main
int main( void )
{
halInit();
moduleInit();
printf("\r\nWriting NV Items\r\n");
result = moduleReset();
if (result == MODULE_SUCCESS)
{
displaySysResetInd(); // Display the contents of the received SYS_RESET_IND message
} else {
printf("Module Reset ERROR 0x%02X\r\n", result);
}
debugConsoleIsr = &handleDebugConsoleInterrupt; //call method handleDebugConsoleInterrupt() when a byte is received
HAL_ENABLE_INTERRUPTS(); //Enable Interrupts
while (1)
{
uint8_t whichNvItem = getWhichNvItemToWrite();
if (whichNvItem != NO_CHARACTER_RECEIVED)
{
uint8_t nvItemSize = getNvItemSize(whichNvItem);
printf("\r\nWriting to NV item %u, L%u:", whichNvItem, nvItemSize);
printHexBytes(dataToWrite, nvItemSize);
result = sysNvWrite(whichNvItem, dataToWrite);
if (result != MODULE_SUCCESS)
{
printf("sysNvWrite ERROR 0x%02X\r\n", result);
}
}
}
}
示例12: main
int main( void )
{
halInit();
printf("\r\n****************************************************\r\n");
printf("Simple Application Example - COORDINATOR - using AFZDO\r\n");
HAL_ENABLE_INTERRUPTS();
startZnp(COORDINATOR);
printf("On Network!\r\n");
/* On network, display info about this network */
getNetworkConfigurationParameters();
getDeviceInformation();
/* Now the network is running - wait for any received messages from the ZNP */
#ifdef VERBOSE_MESSAGE_DISPLAY
printAfIncomingMsgHeaderNames();
#endif
while (1)
{
while (SRDY_IS_HIGH()); //wait until SRDY goes low indicating a message has been received.
displayMessages();
}
}
示例13: main
/**************************************************************************************************
* @fn main
*
* @brief Start of application.
*
* @param none
*
* @return none
**************************************************************************************************
*/
int main(void)
{
/* Initialize hardware */
HAL_BOARD_INIT();
/* Initialze the HAL driver */
HalDriverInit();
/* Initialize MAC */
MAC_Init();
/* Initialize the operating system */
osal_init_system();
/* Enable interrupts */
HAL_ENABLE_INTERRUPTS();
/* Setup OSAL Timer */
HalTimerConfig ( OSAL_TIMER, // 16bit timer3
HAL_TIMER_MODE_CTC, // Clear Timer on Compare
HAL_TIMER_CHANNEL_SINGLE, // Channel 1 - default
HAL_TIMER_CH_MODE_OUTPUT_COMPARE, // Output Compare mode
FALSE, // Use interrupt
MSA_Main_TimerCallBack); // Channel Mode
/* Setup Keyboard callback */
HalKeyConfig(MSA_KEY_INT_ENABLED, MSA_Main_KeyCallback);
/* Initialize UART */
UartCnfg.baudRate = HAL_UART_BR_9600;
UartCnfg.callBackFunc = HalUARTCBack;
UartCnfg.flowControl = FALSE;
UartCnfg.flowControlThreshold = 0; /* max Buffer Size in Byte*/
UartCnfg.idleTimeout = 200;
/*
* halUARTOpen provvederà tramite la funzione halUartAllocBuffers ad allocare e inizializzare
* le strutture dati RxUART e TxUART.
*/
UartCnfg.rx = RxUART;
UartCnfg.tx = TxUART;
UartCnfg.rx.maxBufSize = UART_MAX_BUFFER_SIZE;
UartCnfg.tx.maxBufSize = UART_MAX_BUFFER_SIZE;
UartCnfg.intEnable = TRUE ; /* enable or disable the interrupts */
UartCnfg.configured = TRUE;
uint8 status = HalUARTOpen(HAL_UART_PORT, &UartCnfg); /* passo l'indirizzo di memoria della struttura dati
UartCnfg, Passaggio per riferimento!!!*/
/* Start OSAL */
osal_start_system(); // No Return from here
return 0;
}
示例14: main
/**************************************************************************************************
* @fn main
*
* @brief Start of application.
*
* @param none
*
* @return none
**************************************************************************************************
*/
int main(void)
{
/* Initialize hardware */
HAL_BOARD_INIT();
// Initialize board I/O
InitBoard( OB_COLD );
/* Initialze the HAL driver */
HalDriverInit();
/* Initialize NV system */
osal_snv_init();
/* Initialize LL */
/* Initialize the operating system */
osal_init_system();
/* Enable interrupts */
HAL_ENABLE_INTERRUPTS();
// Final board initialization
InitBoard( OB_READY );
#if defined ( POWER_SAVING )
osal_pwrmgr_device( PWRMGR_BATTERY );
#endif
#if 0
P0DIR |= 0x32;
P0_1 = 0;
P0_4 = 0;
P0_5 = 0;
#endif
#if 0
P1DIR |= 0x08;
P1_3 = 0;
P2DIR |= 0x01;
P2_0 = 1;
#endif
// E009_Init();
// E009_ActivatePwrKey();
//HalLedSet(HAL_LED1_G,HAL_LED_MODE_ON);
/* Start OSAL */
osal_start_system(); // No Return from here
return 0;
}
示例15: sblWait
/**************************************************************************************************
* @fn sblWait
*
* @brief A timed-out wait loop that exits early upon receiving a force code/sbl byte.
*
* input parameters
*
* None.
*
* output parameters
*
* None.
*
* @return TRUE to run the code image, FALSE to run the SBL.
**************************************************************************************************
*/
static uint8 sblWait(void)
{
uint32 dlyCnt = 0x260000;
uint8 rtrn = FALSE;
HAL_ENABLE_INTERRUPTS();
while (1)
{
uint8 ch;
HalUARTPollUSB();
if (HalUARTRx(&ch, 1))
{
if (ch == SB_FORCE_BOOT)
{
break;
}
else if (ch == SB_FORCE_RUN)
{
dlyCnt = 0;
}
}
if (SB1_PRESS)
{
break;
}
if (SB2_PRESS || (dlyCnt-- == 0))
{
rtrn = TRUE;
break;
}
// RR-xing LED display while waiting.
if (dlyCnt & 0x2000)
{
SB_TURN_OFF_LED2();
SB_TURN_ON_LED1();
}
else
{
SB_TURN_OFF_LED1();
SB_TURN_ON_LED2();
}
}
HAL_DISABLE_INTERRUPTS();
SB_TURN_OFF_LED1();
SB_TURN_OFF_LED2();
return rtrn;
}