本文整理汇总了C++中NVIC_GetPriorityGrouping函数的典型用法代码示例。如果您正苦于以下问题:C++ NVIC_GetPriorityGrouping函数的具体用法?C++ NVIC_GetPriorityGrouping怎么用?C++ NVIC_GetPriorityGrouping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NVIC_GetPriorityGrouping函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INTERRUPT_Init
/*
* API to initialize the INTERRUPT APP
*/
INTERRUPT_STATUS_t INTERRUPT_Init(const INTERRUPT_t *const handler)
{
XMC_ASSERT("INTERRUPT_Init:HandlePtr NULL", (handler != NULL));
#if(UC_FAMILY == XMC4)
NVIC_SetPriority(handler->node,
NVIC_EncodePriority(NVIC_GetPriorityGrouping(),
handler->priority,
handler->subpriority));
if (handler->enable_at_init == true)
{
INTERRUPT_Enable(handler);
}
#endif
#if(UC_FAMILY == XMC1)
NVIC_SetPriority(handler->node, handler->priority);
#if (UC_SERIES == XMC14)
XMC_SCU_SetInterruptControl((uint8_t)handler->node, (XMC_SCU_IRQCTRL_t)((handler->node << 8) | handler->irqctrl));
#endif
/* Enable the interrupt if enable_at_init is enabled */
if (handler->enable_at_init == true)
{
INTERRUPT_Enable(handler);
}
#endif
return (INTERRUPT_STATUS_SUCCESS);
}
示例2: PIN_INTERRUPT_Init
/*
* API to initialize the PIN_INTERRUPT APP ERU Event Trigger Logic, Output Gating Unit Hardware initialization
* and NVIC node configuration.
*/
PIN_INTERRUPT_STATUS_t PIN_INTERRUPT_Init(const PIN_INTERRUPT_t *const handle)
{
XMC_ASSERT("PIN_INTERRUPT_Init: PIN_INTERRUPT APP handle function pointer uninitialized", (handle != NULL));
/* Initializes input pin characteristics */
XMC_GPIO_Init(handle->port, handle->pin, &handle->gpio_config);
/* ERU Event Trigger Logic Hardware initialization based on UI */
XMC_ERU_ETL_Init(handle->eru, handle->etl, &handle->etl_config);
/* OGU is configured to generate event on configured trigger edge */
XMC_ERU_OGU_SetServiceRequestMode(handle->eru, handle->ogu, XMC_ERU_OGU_SERVICE_REQUEST_ON_TRIGGER);
#if (UC_FAMILY == XMC1)
/* Configure NVIC node and priority */
NVIC_SetPriority((IRQn_Type)handle->IRQn, handle->irq_priority);
#else
/* Configure NVIC node, priority and subpriority */
NVIC_SetPriority((IRQn_Type)handle->IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),
handle->irq_priority, handle->irq_subpriority));
#endif
#if (UC_SERIES == XMC14)
XMC_SCU_SetInterruptControl((IRQn_Type)handle->IRQn, (XMC_SCU_IRQCTRL_t)handle->irqctrl);
#endif
if (true == handle->enable_at_init)
{
/* Clear pending interrupt before enabling it */
NVIC_ClearPendingIRQ((IRQn_Type)handle->IRQn);
/* Enable NVIC node */
NVIC_EnableIRQ((IRQn_Type)handle->IRQn);
}
return (PIN_INTERRUPT_STATUS_SUCCESS);
}
示例3: SYSTM002_Init
/*
* Initialization function which initializes the App internal data
* structures to default values.
*/
void SYSTM002_Init( void)
{
volatile uint32_t Timer_Status = SYSTM002_TIMER_CONFIGURATION_SUCCESS;
/* <<<DD_SYSTM002 _API_1>>> */
/** Initialize the header of the list */
TimerList = NULL;
/** Initialize timer tracker */
Timer_Status = SysTick_Config((uint32_t)(SYSTM002_SysTickMicroSec( \
SYSTM002_SYSTICK_INTERVAL)));
if(SYSTM002_TIMER_CONFIGURATION_FAILURE == Timer_Status)
{
DBG002_INFO(APP_GID, DBG002_MESSAGEID_LITERAL, \
sizeof("SYSTM002_Init: Timer reload value out of range"), \
"SYSTM002_Init: Timer reload value out of range");
}
else
{
/** setting of Priority and subpriority value for XMC4000 devices */
#if ((__TARGET_DEVICE__ == XMC44) || (__TARGET_DEVICE__ == XMC42) || \
(__TARGET_DEVICE__ == XMC41) || (__TARGET_DEVICE__ == XMC45))
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority( \
NVIC_GetPriorityGrouping(),SYSTM002_PRIORITY,SYSTM002_SUBPRIORITY));
/** setting of Priority value for XMC1000 devices */
#elif ((__TARGET_DEVICE__ == XMC11) || (__TARGET_DEVICE__ == XMC12) \
|| (__TARGET_DEVICE__ == XMC13))
NVIC_SetPriority(SysTick_IRQn, SYSTM002_PRIORITY);
#endif
TimerTracker = 0UL;
}
}
示例4: NVIC_SCU001_Init
/* Function to configure SCU Interrupts based on user configuration.
*
*/
void NVIC_SCU001_Init()
{
FUNCTION_ENTRY(GID_NVIC_SCU001,NVIC_SCU001_FUNC_ENTRY);
NVIC_SetPriority(64, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),63,0));
/* Enable Interrupt */
NVIC_EnableIRQ(64);
FUNCTION_EXIT(GID_NVIC_SCU001,NVIC_SCU001_FUNC_EXIT);
}
示例5: NVIC002_Init
/** Function to initialize the NVIC node parameters based on
* UI configuration.
*/
void NVIC002_Init(void)
{
/*<<<DD_NVIC002_API_1>>>*/
FUNCTION_ENTRY(GID_NVIC002,NVIC002_FUNC_ENTRY);
// Set Interrupt Priority for NVIC 5 Node App Instance 0
NVIC_SetPriority(5, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),63,0));
/* Enable Interrupt */
NVIC_EnableIRQ(5);
FUNCTION_EXIT(GID_NVIC002,NVIC002_FUNC_EXIT);
}
示例6: main
/**
* @brief Main program
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
files (startup_stm32f40_41xxx.s/startup_stm32f427_437xx.s/startup_stm32f429_439xx.s)
before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f4xx.c file
*/
/* NVIC configuration ------------------------------------------------------*/
NVIC_Config();
/* Initialize LEDs mounted on EVAL board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
/* Initialize the KEY/Tamper and Wakeup buttons mounted on EVAL board */
STM_EVAL_PBInit(BUTTON_KEY_TAMPER, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !ubPreemptionPriorityValue, 0));
while (1)
{
if(ubPreemptionOccurred != 0)
{
/* Toggle LED1 */
STM_EVAL_LEDToggle(LED1);
/* Insert delay Time */
Delay(0x5FFFF);
/* Toggle LED2 */
STM_EVAL_LEDToggle(LED2);
Delay(0x5FFFF);
/* Toggle LED3 */
STM_EVAL_LEDToggle(LED3);
Delay(0x5FFFF);
/* Toggle LED4 */
STM_EVAL_LEDToggle(LED4);
Delay(0x5FFFF);
}
}
}
示例7: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f10x_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f10x.c file
*/
/* Initialize LED1..LED4, Key and Wakeup Buttons mounted on STM3210X-EVAL
board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);
/* Configure one bit for preemption priority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* Enable the WAKEUP_BUTTON_EXTI_IRQn Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = WAKEUP_BUTTON_EXTI_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PreemptionPriorityValue;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the KEY_BUTTON_EXTI_IRQn Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = KEY_BUTTON_EXTI_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !PreemptionPriorityValue, 0));
while (1)
{
if(PreemptionOccured != FALSE)
{
STM_EVAL_LEDToggle(LED1);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED2);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED3);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED4);
Delay(0x5FFFF);
}
}
}
示例8: HAL_NVIC_SetPriority
/**
* @brief Sets the priority of an interrupt.
* @param IRQn: External interrupt number.
* This parameter can be an enumerator of IRQn_Type enumeration
* (For the complete STM32 Devices IRQ Channels list, please refer to the appropriate CMSIS device file (stm32f4xxxx.h))
* @param PreemptPriority: The preemption priority for the IRQn channel.
* This parameter can be a value between 0 and 15
* A lower priority value indicates a higher priority
* @param SubPriority: the subpriority level for the IRQ channel.
* This parameter can be a value between 0 and 15
* A lower priority value indicates a higher priority.
* @retval None
*/
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
{
uint32_t prioritygroup = 0x00;
/* Check the parameters */
assert_param(IS_NVIC_SUB_PRIORITY(SubPriority));
assert_param(IS_NVIC_PREEMPTION_PRIORITY(PreemptPriority));
prioritygroup = NVIC_GetPriorityGrouping();
NVIC_SetPriority(IRQn, NVIC_EncodePriority(prioritygroup, PreemptPriority, SubPriority));
}
示例9: SYSTIMER_Init
/*
* Initialization function which initializes the SYSTIMER APP, configures SysTick timer and SysTick exception.
*/
SYSTIMER_STATUS_t SYSTIMER_Init(SYSTIMER_t *handle)
{
SYSTIMER_STATUS_t status = SYSTIMER_STATUS_SUCCESS;
XMC_ASSERT("SYSTIMER_Init: SYSTIMER APP handle pointer uninitialized", (handle != NULL));
/* Check APP initialization status to ensure whether SYSTIMER_Init called or not, initialize SYSTIMER if
* SYSTIMER_Init called first time.
*/
if (false == handle->init_status)
{
#if (UC_FAMILY == XMC4)
/* Initialization of CPU_CTRL_XMC4 APP */
status = (SYSTIMER_STATUS_t)CPU_CTRL_XMC4_Init(CPU_CTRL_HANDLE);
#else
/* Initialization of CPU_CTRL_XMC1 APP */
status = (SYSTIMER_STATUS_t)CPU_CTRL_XMC1_Init(CPU_CTRL_HANDLE);
#endif
if (SYSTIMER_STATUS_FAILURE != status)
{
/* Initialize the header of the list */
g_timer_list = NULL;
/* Initialize SysTick timer */
status = (SYSTIMER_STATUS_t)SysTick_Config((uint32_t)(SYSTIMER_SYSTICK_CLOCK * SYSTIMER_TICK_PERIOD));
if (SYSTIMER_STATUS_FAILURE == status)
{
XMC_DEBUG("SYSTIMER_Init: Timer reload value out of range");
}
else
{
#if (UC_FAMILY == XMC4)
/* setting of First SW Timer period is always and subpriority value for XMC4000 devices */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(
NVIC_GetPriorityGrouping(), SYSTIMER_PRIORITY, SYSTIMER_SUBPRIORITY));
#elif (UC_FAMILY == XMC1)
/* setting of priority value for XMC1000 devices */
NVIC_SetPriority(SysTick_IRQn, SYSTIMER_PRIORITY);
#endif
g_timer_tracker = 0U;
/* Update the Initialization status of the SYSTIMER APP instance */
handle->init_status = true;
status = SYSTIMER_STATUS_SUCCESS;
}
}
}
return (status);
}
示例10: TempUart_init
/*Channel initialization function*/
UART_STATUS_t TempUart_init()
{
UART_STATUS_t status = UART_STATUS_SUCCESS;
/*Configure Receive pin*/
XMC_GPIO_Init((XMC_GPIO_PORT_t *)PORT5_BASE, 0U, &TempUart_rx_pin_config);
/* Initialize USIC channel in UART mode*/
XMC_UART_CH_Init(XMC_UART0_CH0, &TempUart_channel_config);
/*Set input source path*/
XMC_USIC_CH_SetInputSource(XMC_UART0_CH0, XMC_USIC_CH_INPUT_DX0, 3U);
/* Start UART */
XMC_UART_CH_Start(XMC_UART0_CH0);
/* Initialize UART TX pin */
XMC_GPIO_Init((XMC_GPIO_PORT_t *)PORT5_BASE, 1U, &TempUart_tx_pin_config);
/*Set service request for transmit interrupt*/
XMC_USIC_CH_SetInterruptNodePointer(XMC_UART0_CH0, XMC_USIC_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER,
3U);
/*Set service request for receive interrupt*/
XMC_USIC_CH_SetInterruptNodePointer(XMC_UART0_CH0, XMC_USIC_CH_INTERRUPT_NODE_POINTER_RECEIVE,
5U);
XMC_USIC_CH_SetInterruptNodePointer(XMC_UART0_CH0, XMC_USIC_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE,
5U);
/*Set service request for UART protocol events*/
XMC_USIC_CH_SetInterruptNodePointer(XMC_UART0_CH0, XMC_USIC_CH_INTERRUPT_NODE_POINTER_PROTOCOL,
0U);
/*Set priority and enable NVIC node for transmit interrupt*/
NVIC_SetPriority((IRQn_Type)87, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),
18U, 0U));
NVIC_EnableIRQ((IRQn_Type)87);
/*Set priority and enable NVIC node for receive interrupt*/
NVIC_SetPriority((IRQn_Type)89, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),
18U, 0U));
NVIC_EnableIRQ((IRQn_Type)89);
return status;
}
示例11: setISRPriorities
void setISRPriorities() {
__disable_irq();
// set two bits for preemptive data, two bits for priority as the
// structure for the IPRs. Grouping is global withing the IPRs so
// this value should only be changed here.
NVIC_SetPriorityGrouping(5);
uint32_t priorityGrouping = NVIC_GetPriorityGrouping();
// set preemptive priority default to 2 (0..3)
// set priority default to 1 (0..3)
uint32_t defaultPriority = NVIC_EncodePriority(priorityGrouping, 2, 1);
// When the kernel initialzes the PNVIC, all ISRs are set to the
// highest priority, making it impossible to elevate a few over
// the rest, so the default priority is lowered globally for the
// table first.
//
// Consult LPC17xx.h under IRQn_Type for PNVIC ranges, this is LPC1768
// specific
for (uint32_t IRQn = TIMER0_IRQn; IRQn <= CANActivity_IRQn; IRQn++)
NVIC_SetPriority((IRQn_Type)IRQn, defaultPriority);
// reestablish watchdog
NVIC_SetPriority(WDT_IRQn, NVIC_EncodePriority(priorityGrouping, 0, 0));
// make TIMER #2 2nd in line t the watchdog timer
NVIC_SetPriority(TIMER2_IRQn, NVIC_EncodePriority(priorityGrouping, 0, 1));
// this is the timer used in the mbed Ticker library
NVIC_SetPriority(TIMER3_IRQn, NVIC_EncodePriority(priorityGrouping, 0, 2));
// Brown-Out Detect
NVIC_SetPriority(BOD_IRQn, NVIC_EncodePriority(priorityGrouping, 0, 4));
// The I2C interface that's in use
NVIC_SetPriority(I2C2_IRQn, NVIC_EncodePriority(priorityGrouping, 1, 1));
// The SPI interface that's in use.
NVIC_SetPriority(SPI_IRQn, NVIC_EncodePriority(priorityGrouping, 1, 2));
// set UART (console) interrupts to minimal priority
// when debugging radio and other time sensitive operations, this
// interrupt will need to be deferred.
NVIC_SetPriority(UART0_IRQn, NVIC_EncodePriority(priorityGrouping, 1, 4));
__enable_irq();
}
示例12: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/*!< At this stage the microcontroller clock setting is already configured,
this is done through SystemInit() function which is called from startup
file (startup_stm32f10x_xx.s) before to branch to application main.
To reconfigure the default setting of SystemInit() function, refer to
system_stm32f10x.c file
*/
/* NVIC configuration ------------------------------------------------------*/
NVIC_Config();
/* Initialize LED1..LED4, Key and Sel Joystick Buttons mounted on STM3210X-EVAL
board */
STM_EVAL_LEDInit(LED1);
STM_EVAL_LEDInit(LED2);
STM_EVAL_LEDInit(LED3);
STM_EVAL_LEDInit(LED4);
STM_EVAL_PBInit(BUTTON_KEY, BUTTON_MODE_EXTI);
STM_EVAL_PBInit(BUTTON_WAKEUP, BUTTON_MODE_EXTI);
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !PreemptionPriorityValue, 0));
while (1)
{
if(PreemptionOccured != 0)
{
/* Toggel The lED1 */
STM_EVAL_LEDToggle(LED1);
/* Insert delay Time */
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED2);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED3);
Delay(0x5FFFF);
STM_EVAL_LEDToggle(LED4);
Delay(0x5FFFF);
}
}
}
示例13: NVIC_Configuration
/**
* @brief Configures NVIC.
* @param None
* @retval None
*/
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* 1 bits for pre-emption priority and 3 bits for subpriority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* Set Button EXTI Interrupt priority to 0 (highest) */
NVIC_SetPriority(KEY_BUTTON_EXTI_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0,0));
/* Set WWDG interrupt vector Preemption Priority to 1 */
NVIC_InitStructure.NVIC_IRQChannel = WWDG_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
示例14: stm32f4_adc_dma_init
static void
stm32f4_adc_dma_init(ADC_HandleTypeDef* hadc)
{
DMA_HandleTypeDef *hdma;
assert(hadc);
hdma = hadc->DMA_Handle;
stm32f4_adc_clk_enable(hadc);
__HAL_RCC_DMA2_CLK_ENABLE();
HAL_DMA_Init(hdma);
dma_handle[stm32f4_resolve_dma_handle_idx(hdma)] = hdma;
NVIC_SetPriority(stm32f4_resolve_adc_dma_irq(hdma),
NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0));
NVIC_SetVector(stm32f4_resolve_adc_dma_irq(hdma),
stm32f4_resolve_adc_dma_irq_handler(hdma));
NVIC_EnableIRQ(stm32f4_resolve_adc_dma_irq(hdma));
}
示例15: EXTI15_10_IRQHandler
/**
* @brief This function handles External lines 15 to 10 interrupt request.
* @param None
* @retval None
*/
void EXTI15_10_IRQHandler(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
if(EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE) != RESET)
{
PreemptionPriorityValue = !PreemptionPriorityValue;
PreemptionOccured = 0;
/* Modify the WAKEUP_BUTTON_EXTI_IRQn Interrupt Preemption Priority */
NVIC_InitStructure.NVIC_IRQChannel = WAKEUP_BUTTON_EXTI_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = PreemptionPriorityValue;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), !PreemptionPriorityValue, 0));
/* Clear KEY_BUTTON_EXTI_LINE pending bit */
EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE);
}
}