本文整理汇总了C++中NVIC_PriorityGroupConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ NVIC_PriorityGroupConfig函数的具体用法?C++ NVIC_PriorityGroupConfig怎么用?C++ NVIC_PriorityGroupConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NVIC_PriorityGroupConfig函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: i2cInit
void i2cInit(I2C_TypeDef *I2C)
{
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
I2C_InitTypeDef I2C_InitStructure;
// Init pins
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(GPIOB, &GPIO_InitStructure);
I2Cx = I2C;
// clock out stuff to make sure slaves arent stuck
i2cUnstick();
// Init I2C
I2C_DeInit(I2Cx);
I2C_StructInit(&I2C_InitStructure);
I2C_ITConfig(I2Cx, I2C_IT_EVT | I2C_IT_ERR, DISABLE); //Enable EVT and ERR interrupts - they are enabled by the first request
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = 400000;
I2C_Cmd(I2Cx, ENABLE);
I2C_Init(I2Cx, &I2C_InitStructure);
NVIC_PriorityGroupConfig(0x500);
// I2C ER Interrupt
NVIC_InitStructure.NVIC_IRQChannel = I2C2_ER_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// I2C EV Interrupt
NVIC_InitStructure.NVIC_IRQChannel = I2C2_EV_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:kh4,项目名称:openLRSngRX32_test,代码行数:44,代码来源:drv_i2c.c
示例2: main
int main(void) {
int i = 0;
driver_stat.statusAdc = HALT_ADC;
for(i =0; i < 4;i++) {
driver_stat.gain[i] = 0;
driver_stat.rec_message[i] = 0;
}
driver_stat.is_overload = 0;
driver_stat.enable_monitoring = 0;
driver_stat.mut = 0;
test_stat.statusTest = HALT_TEST;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3);
/* Setup SysTick Timer for 1 ms interrupts */
if (SysTick_Config(SystemCoreClock / 10))
{
/* Capture error */
while (1)
{}
}
initial_spi();
initial_gpio();
initial_adc();
initial_i2c();
initial_mco();
pga2505_write();
driver_stat.enable_monitoring = 1;
while(1)
{
if(test_stat.statusTest != HALT_TEST) {
*spi3 = 100 + i;
__DSB();
*spi3 = 200 + i;
*spi1 = 300 + i;
__DSB();
*spi1 = 400 + i;
i++;
if( i > 100)
i = 0;
if(test_stat.statusTest == DURING_STOP_TEST)
test_stat.statusTest = HALT_TEST;
Delay(2);
}
}
}
开发者ID:korrav,项目名称:analog_stm32f3,代码行数:44,代码来源:main.c
示例3: LEDMatrix_Init
void LEDMatrix_Init(void) { //
//Timer NVIC Configs
NVIC_InitTypeDef NVIC_InitStructure;
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//Timer configs
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2 , ENABLE);
TIM_DeInit(TIM2);
TIM_TimeBaseStructure.TIM_Period=12;
TIM_TimeBaseStructure.TIM_Prescaler=9000;
TIM_TimeBaseStructure.TIM_CounterMode=TIM_CounterMode_Up;
TIM_TimeBaseStructure.TIM_ClockDivision=TIM_CKD_DIV1;
TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);
TIM_ClearFlag(TIM2,TIM_FLAG_Update);
TIM_ITConfig(TIM2,TIM_IT_Update,ENABLE);
TIM_Cmd(TIM2,ENABLE);
//GPIO Configs, there's 2 sets of GPIO that needs to config. One for "common" pins (line) for multiplex. The other set is for the output
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); /*使能LED灯使用的GPIO时钟*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
//GPIO config for output, aka columns
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); /*使能LED灯使用的GPIO时钟*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_SetBits(GPIOB, GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15);
GPIO_SetBits(GPIOC, GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7);
}
开发者ID:applefreak,项目名称:LED-Matrix-Project,代码行数:44,代码来源:LEDMatrix.c
示例4: NVIC_Configuration
/**
* @brief Configures Vector Table base location.
* @param None
* @retval None
*/
void NVIC_Configuration(void)
{
/* Set the Vector Table base address at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0000);
/* Configure and enable ADC interrupt */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
//adc
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//freq
NVIC_InitStructure.NVIC_IRQChannel = TIM5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//DI
NVIC_InitStructure.NVIC_IRQChannel = SysTick_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//-------uart3
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:003900107,项目名称:wpa900-V2-ai-V1.0,代码行数:49,代码来源:bsp.c
示例5: xMBPortTimersInit
/**
* @brief Timer Initialize
* @param None
* @retval None
*/
BOOL
xMBPortTimersInit( USHORT usTimeOut50us )
{
/* TIMx is used as Modbus timer */
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
NVIC_InitTypeDef NVIC_InitStructure;
uint16_t PrescalerValue = 0;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIMx, ENABLE);
/* Timer Config
SystemCoreClock / (PrescalerValue + 1) = 20KHz (50us)
Timer Count Max = usTimeOut50us
*/
/* Compute the prescaler value */
PrescalerValue = (uint16_t) (SystemCoreClock / 20000) - 1;
/* Time base configuration */
TIM_TimeBaseStructure.TIM_Period = (uint16_t) usTimeOut50us;
TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIMx, &TIM_TimeBaseStructure);
TIM_ARRPreloadConfig(TIMx, ENABLE);
/**
* @brief Configure the nested vectored interrupt controller.
* @param None
* @retval None
*/
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* Enable the TIMx Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIMx_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
vMBPortTimersDisable();
return TRUE;
}
开发者ID:zpcaams,项目名称:osm,代码行数:49,代码来源:porttimer.c
示例6: RTCInit
void RTCInit(void) {
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
// Allow access to BKP Domain
PWR_BackupAccessCmd(ENABLE);
// Reset Backup Domain
BKP_DeInit();
// Enable the LSE OSC
RCC_LSEConfig(RCC_LSE_ON);
// Disable the LSI OSC
RCC_LSICmd(DISABLE);
// Select the RTC Clock Source
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
// Enable the RTC Clock
RCC_RTCCLKCmd(ENABLE);
// Wait for RTC registers synchronization
RTC_WaitForSynchro();
// Wait until last write operation on RTC registers has finished
RTC_WaitForLastTask();
// Enable the RTC overflow interrupt
RTC_ITConfig(RTC_IT_SEC, ENABLE);
//Set 32768 prescaler - for one second interupt
RTC_SetPrescaler(0x7FFF);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:cloned67,项目名称:STM32,代码行数:44,代码来源:rtc.c
示例7: NVIC_Configuration
/*******************************************************************************
* Function Name : NVIC_Configuration
* Description : Configures Vector Table base location.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
#ifdef VECT_TAB_RAM
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else /* VECT_TAB_FLASH */
/* Configure one bit for preemption priority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* Enable the USART1 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the USART2 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the TIM2 global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the TIM2 global Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif
}
开发者ID:KISSMonX,项目名称:W7200,代码行数:51,代码来源:main.c
示例8: __gsmInitHardware
/// Init the CPU on chip hardware for the GSM modem.
static void __gsmInitHardware(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10; //uart3
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure); //GSM模块的串口
__gsmDeassertResetPin();
/* GPIO_InitStructure.GPIO_Pin = RESET_GPIO;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(RESET_GPIO_GROUP, &GPIO_InitStructure);*/ //GSM模块的RTS和RESET
GPIO_InitStructure.GPIO_Pin = GSM_RESET_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GSM_RESET_GROUP, &GPIO_InitStructure); //GSM模块的RTS和RESET
GPIO_InitStructure.GPIO_Pin = GSM_STATUS_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GSM_STATUS_GROUP, &GPIO_InitStructure); //GSM模块的STATAS
GPIO_ResetBits(GSM_POWER_GROUP, GSM_POWER_PIN);
GPIO_InitStructure.GPIO_Pin = GSM_POWER_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GSM_POWER_GROUP, &GPIO_InitStructure); //__gsmPowerSupplyOn,29302
GPIO_InitStructure.GPIO_Pin = GSM_RING_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GSM_RING_GROUP, &GPIO_InitStructure); //RING到来标志位
RING_LED(OFF1);
/* GPIO_SetBits(GPIOD, GPIO_Pin_3);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure); */ //判断TCP是否打开
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 14;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:masuchen,项目名称:chargingmachine,代码行数:45,代码来源:gsm.C
示例9: NVIC_Config
void NVIC_Config(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
/*NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;*/
/*NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;*/
/*NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;*/
/*NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;*/
/*NVIC_Init(&NVIC_InitStructure);*/
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel6_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel7_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = I2C1_ER_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = I2C1_EV_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:skt041959,项目名称:stm32-template,代码行数:44,代码来源:main.c
示例10: main
int main()
{
u8 i = 0;
/* 设置NVIC中断分组2:2位抢占优先级,2位响应优先级 */
NVIC_PriorityGroupConfig ( NVIC_PriorityGroup_2 );
BSP_Delay_Init ( 72 );
BSP_USART_Init ( 115200 );
BSP_SERVO_Init ( 1000000 );
while ( true )
{
}
}
开发者ID:liaoqinghai,项目名称:halfDulpexSerial,代码行数:19,代码来源:app.c
示例11: USART2_Config
/*
* 函数名:USART2_Config
* 描述 :USART2 GPIO 配置,工作模式配置
* 输入 :无
* 输出 : 无
* 调用 :外部调用
*/
void USART2_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* config USART2 clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
/* USART2 GPIO config */
/* Configure USART2 Tx (PA.02) as alternate function push-pull */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure USART2 Rx (PA.03) as input floating */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* USART2 mode config */
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART2, &USART_InitStructure);
//Usart2 NVIC
/* Configure one bit for preemption priority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
USART_ITConfig(USART2,USART_IT_RXNE,ENABLE);
USART_Cmd(USART2, ENABLE);
}
开发者ID:huang87975716,项目名称:Version3,代码行数:50,代码来源:usart.c
示例12: dma_nvic_init
void dma_nvic_init()
{
NVIC_InitTypeDef NVIC_InitStructure;
// /*DMA1 open*/
// RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
// // Enable the DMA1_CH5 Interrupt
// NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel5_IRQn;
// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
// NVIC_Init(&NVIC_InitStructure);
// // Enable the DMA1_CH4 Interrupt
// NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel4_IRQn;
// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
// NVIC_Init(&NVIC_InitStructure);
/* Configure DMA controller to manage USART TX and RX DMA request ----------*/
RCC_AHB1PeriphClockCmd(USARTx_DMAx_CLK, ENABLE);
/* Configure two bits for preemption priority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
NVIC_InitStructure.NVIC_IRQChannel = USARTx_DMA_RX_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = USARTx_DMA_TX_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the USARTx Interrupt */
// NVIC_InitStructure.NVIC_IRQChannel = USART6_IRQn;
// NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
// NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
// NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
// NVIC_Init(&NVIC_InitStructure);
}
开发者ID:XHelaoshi,项目名称:USER,代码行数:43,代码来源:hal_uart_dma.c
示例13: ElmeterInit
void ElmeterInit(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
USART_InitStructure.USART_BaudRate = 2400;
USART_InitStructure.USART_WordLength = USART_WordLength_9b;//USART_WordLength_8b
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_Even;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART2, &USART_InitStructure);
USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
USART_Cmd(USART2, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
dir_conf();
}
开发者ID:masuchen,项目名称:chargingmachine,代码行数:43,代码来源:meter.c
示例14: MyExtiNvicInit
/********************************************************************************
* FunctionName: MyExtiNvicInit
*
* Description : 中断优先级初始化
*
* Parameters : None
*
* Returns : None
*******************************************************************************/
void MyExtiNvicInit(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
//NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); //设置中断优先级设置字节方式
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
// USART1中断
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 4;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// USART2中断
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 6;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//外部中断 SI4432
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 5;//占优先级
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; //次优先级
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; //通道中断使能
NVIC_Init(&NVIC_InitStructure); //初始化中断
//Enable DMA Channel7 Interrupt
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel7_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/*Enable DMA Channel6 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel6_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:huang87975716,项目名称:temp,代码行数:52,代码来源:STM32Init.c
示例15: SD_NVIC_Configuration
void SD_NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure the NVIC Preemption Priority Bits */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_InitStructure.NVIC_IRQChannel = SDIO_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// DMA2 STREAMx Interrupt ENABLE
NVIC_InitStructure.NVIC_IRQChannel = SD_SDIO_DMA_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:jssmile,项目名称:Plotter,代码行数:19,代码来源:sdio_debug.c
示例16: BoardInitMcu
void BoardInitMcu( void )
{
if( McuInitialized == false )
{
// We use IRQ priority group 4 for the entire project
// When setting the IRQ, only the preemption priority is used
NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );
// Disable Systick
SysTick->CTRL &= ~SysTick_CTRL_TICKINT_Msk; // Systick IRQ off
SCB->ICSR |= SCB_ICSR_PENDSTCLR_Msk; // Clear SysTick Exception pending flag
I2cInit( &I2c, I2C_SCL, I2C_SDA );
SpiInit( &SX1272.Spi, RADIO_MOSI, RADIO_MISO, RADIO_SCLK, NC );
SX1272IoInit( );
#if defined( USE_DEBUG_PINS )
GpioInit( &DbgPin1, J5_1, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
GpioInit( &DbgPin2, J5_2, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
GpioInit( &DbgPin3, J5_3, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
GpioInit( &DbgPin4, J5_4, PIN_OUTPUT, PIN_PUSH_PULL, PIN_NO_PULL, 0 );
#endif
BoardInitPeriph( );
#if( LOW_POWER_MODE_ENABLE )
TimerSetLowPowerEnable( true );
#else
TimerSetLowPowerEnable( false );
#endif
BoardUnusedIoInit( );
if( TimerGetLowPowerEnable( ) == true )
{
RtcInit( );
}
else
{
TimerHwInit( );
}
McuInitialized = true;
}
}
开发者ID:hhd0918,项目名称:LoRaMac-node,代码行数:43,代码来源:board.c
示例17: NVIC_Configuration
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure; //定义用于配置中断的结构体变量
/* #ifdef...#else...#endif结构的作用是根据预编译条件决定中断向量表起始地址*/
#ifdef VECT_TAB_RAM
/* 中断向量表起始地址从 0x20000000 开始 */
NVIC_SetVectorTable(NVIC_VectTab_RAM , 0x0);
#else /* VECT_TAB_FLASH */
/* 中断向量表起始地址从 0x80000000 开始 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH , 0x0);
#endif
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //中断优先级分组 抢占式优先级别设置为2位;响应优先级占2位
/* 开启 TIM3 中断, 0级先占优先级,0级后占优先级,系统控制周期 */
NVIC_InitStructure.NVIC_IRQChannel = TIM4_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* 开启外部中断, 2级先占优先级,2级后占优先级,nRF信号接收中断 */
NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* 开启外部中断, 0级先占优先级,0级后占优先级,6050数据接收中断 */
NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
//蓝牙的中断
NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel6_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:tqdong,项目名称:flyembedded,代码行数:43,代码来源:main.c
示例18: init
/*********************************************************************************
*Function : void init(void)
*Description : initiale
*Input : none
*Output : none
*Return : none
*author : lz
*date : 6-December-2014
*Others : none
**********************************************************************************/
void init(void)
{
//disable JTAG-DP,release pin 29(PB3),30(PB4),23(PA15)
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO , ENABLE);
#ifdef DFU_BUILD_ENABLE
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x5000); // lz
#endif
#ifdef SWD_JTAG_DISABLE
/* Disable the Serial Wire JTAG Debug Port SWJ-DP */
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
#endif
// Set Systick to 1ms interval, common to all SAM3 variants
if (SysTick_Config(SystemCoreClock / 1000))
{
// Capture error
while (true);
}
/* Configure the SysTick Handler Priority: Preemption priority and subpriority */
NVIC_SetPriority(SysTick_IRQn, SYSTICK_IRQ_PRIORITY);
//digital pin default output low
for (unsigned i = 0; i < FIRST_ANALOG_PIN+TOTAL_ANALOG_PINS; i++)
{
pinMode(i, OUTPUT);
digitalWrite(i, LOW);
}
RTC_Configuration();
DWT_Init();
#ifdef IWDG_RESET_ENABLE
IWDG_Reset_Enable(3 * TIMING_IWDG_RELOAD);
#endif
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
TIM1_Configuration();
TIM_Cmd(TIM1, DISABLE); //定时器关闭
NVIC_DisableIRQ(TIM1_UP_IRQn);
}
开发者ID:HitszChen,项目名称:intorobot-firmware,代码行数:53,代码来源:variant.cpp
示例19: NVIC_Configuration
/**
* @brief Configures the nested vectored interrupt controller.
* @param None
* @retval None
*/
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure the NVIC Preemption Priority Bits */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
/* Enable the USARTy Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USARTy_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Enable the USARTz Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = USARTz_IRQn;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
开发者ID:WaelG,项目名称:Thinner-Client,代码行数:24,代码来源:main.c
示例20: USB_OTG_BSP_EnableInterrupt
/**
* @brief USB_OTG_BSP_EnableInterrupt
* Enabele USB Global interrupt
* @param None
* @retval None
*/
void USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/*NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = OTG_FS_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);*/
}
开发者ID:mcu786,项目名称:KFly_STM32F4,代码行数:25,代码来源:usb_bsp.c
注:本文中的NVIC_PriorityGroupConfig函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论