Changing interrupt priorities

pull/2/head
Andy CA6JAU 9 years ago
parent ee01691dc4
commit ace3e75c09

@ -135,7 +135,7 @@ void CIO::Init()
RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5); RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE); RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
EXTI_InitTypeDef EXTI_InitStructure; EXTI_InitTypeDef EXTI_InitStructure;
@ -283,8 +283,8 @@ void CIO::startInt()
NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn; NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
#endif #endif
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); NVIC_Init(&NVIC_InitStructure);
} }

@ -174,8 +174,8 @@ void InitUSART1(int speed)
// USART IRQ init // USART IRQ init
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn; NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
NVIC_Init(&NVIC_InitStructure); NVIC_Init(&NVIC_InitStructure);
// Configure USART as alternate function // Configure USART as alternate function
@ -238,6 +238,11 @@ void WriteUSART1(const uint8_t* data, uint16_t length)
#endif #endif
#if defined(SERIAL_REPEATER) #if defined(SERIAL_REPEATER)
extern "C" {
void USART2_IRQHandler();
}
/* ************* USART2 ***************** */ /* ************* USART2 ***************** */
volatile uint32_t intcount2; volatile uint32_t intcount2;
@ -312,6 +317,7 @@ uint8_t TXSerialfifoput2(uint8_t next)
void USART2_IRQHandler() void USART2_IRQHandler()
{ {
uint8_t c; uint8_t c;
io.DEB_pin(HIGH);
if (USART_GetITStatus(USART2, USART_IT_RXNE)) { if (USART_GetITStatus(USART2, USART_IT_RXNE)) {
c = (uint8_t) USART_ReceiveData(USART2); c = (uint8_t) USART_ReceiveData(USART2);
@ -363,8 +369,8 @@ void InitUSART2(int speed)
// USART IRQ init // USART IRQ init
NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn; NVIC_InitStructure.NVIC_IRQChannel = USART2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
NVIC_Init(&NVIC_InitStructure); NVIC_Init(&NVIC_InitStructure);
// Configure USART as alternate function // Configure USART as alternate function

Loading…
Cancel
Save

Powered by TurnKey Linux.