mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
re-enable hardware i2c; update NVIC priority to use define from CMSIS instead of magic 0x500 number
This commit is contained in:
parent
09b7268ec1
commit
0028fa2ce4
3 changed files with 3 additions and 4 deletions
|
@ -272,7 +272,7 @@ typedef struct baro_t {
|
||||||
#define BEEP_ON ;
|
#define BEEP_ON ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SOFT_I2C // enable to test software i2c
|
// #define SOFT_I2C // enable to test software i2c
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
|
@ -285,7 +285,7 @@ void i2cInit(I2C_TypeDef *I2C)
|
||||||
I2C_Cmd(I2Cx, ENABLE);
|
I2C_Cmd(I2Cx, ENABLE);
|
||||||
I2C_Init(I2Cx, &I2C_InitStructure);
|
I2C_Init(I2Cx, &I2C_InitStructure);
|
||||||
|
|
||||||
NVIC_PriorityGroupConfig(0x500);
|
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
|
||||||
|
|
||||||
// I2C ER Interrupt
|
// I2C ER Interrupt
|
||||||
NVIC_InitStructure.NVIC_IRQChannel = I2C2_ER_IRQn;
|
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_IRQChannel = I2C2_EV_IRQn;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
||||||
NVIC_Init(&NVIC_InitStructure);
|
NVIC_Init(&NVIC_InitStructure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t i2cGetErrorCounter(void)
|
uint16_t i2cGetErrorCounter(void)
|
||||||
|
|
|
@ -139,7 +139,7 @@ void timerNVICConfigure(uint8_t irq)
|
||||||
NVIC_InitTypeDef NVIC_InitStructure;
|
NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
NVIC_InitStructure.NVIC_IRQChannel = irq;
|
NVIC_InitStructure.NVIC_IRQChannel = irq;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||||
NVIC_Init(&NVIC_InitStructure);
|
NVIC_Init(&NVIC_InitStructure);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue