1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

re-enable hardware i2c; update NVIC priority to use define from CMSIS instead of magic 0x500 number

This commit is contained in:
dongie 2014-05-28 17:29:06 +09:00
parent 09b7268ec1
commit 0028fa2ce4
3 changed files with 3 additions and 4 deletions

View file

@ -272,7 +272,7 @@ typedef struct baro_t {
#define BEEP_ON ;
#endif
#define SOFT_I2C // enable to test software i2c
// #define SOFT_I2C // enable to test software i2c
#include "utils.h"

View file

@ -285,7 +285,7 @@ void i2cInit(I2C_TypeDef *I2C)
I2C_Cmd(I2Cx, ENABLE);
I2C_Init(I2Cx, &I2C_InitStructure);
NVIC_PriorityGroupConfig(0x500);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
// I2C ER Interrupt
NVIC_InitStructure.NVIC_IRQChannel = I2C2_ER_IRQn;
@ -298,7 +298,6 @@ void i2cInit(I2C_TypeDef *I2C)
NVIC_InitStructure.NVIC_IRQChannel = I2C2_EV_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_Init(&NVIC_InitStructure);
}
uint16_t i2cGetErrorCounter(void)

View file

@ -139,7 +139,7 @@ void timerNVICConfigure(uint8_t irq)
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannel = irq;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);