Whitespace cleanup
Misplaced whitespace fixed, no functional changes
This commit is contained in:
parent
bfe2410e1c
commit
57c308538f
|
@ -110,7 +110,6 @@ serialPort_t *uartOpen(USART_TypeDef *USARTx, serialReceiveCallbackPtr callback,
|
||||||
|
|
||||||
uartReconfigure(s);
|
uartReconfigure(s);
|
||||||
|
|
||||||
|
|
||||||
// Receive DMA or IRQ
|
// Receive DMA or IRQ
|
||||||
DMA_InitTypeDef DMA_InitStructure;
|
DMA_InitTypeDef DMA_InitStructure;
|
||||||
if ((mode & MODE_RX) || (mode & MODE_BIDIR)) {
|
if ((mode & MODE_RX) || (mode & MODE_BIDIR)) {
|
||||||
|
|
|
@ -381,7 +381,7 @@ void timerChOvrHandlerInit(timerOvrHandlerRec_t *self, timerOvrHandlerCallback *
|
||||||
|
|
||||||
// update overflow callback list
|
// update overflow callback list
|
||||||
// some synchronization mechanism is neccesary to avoid disturbing other channels (BASEPRI used now)
|
// some synchronization mechanism is neccesary to avoid disturbing other channels (BASEPRI used now)
|
||||||
static void timerChConfig_UpdateOverflow(timerConfig_t *cfg, TIM_TypeDef* tim) {
|
static void timerChConfig_UpdateOverflow(timerConfig_t *cfg, TIM_TypeDef *tim) {
|
||||||
timerOvrHandlerRec_t **chain = &cfg->overflowCallbackActive;
|
timerOvrHandlerRec_t **chain = &cfg->overflowCallbackActive;
|
||||||
ATOMIC_BLOCK(NVIC_PRIO_TIMER) {
|
ATOMIC_BLOCK(NVIC_PRIO_TIMER) {
|
||||||
for(int i = 0; i < CC_CHANNELS_PER_TIMER; i++)
|
for(int i = 0; i < CC_CHANNELS_PER_TIMER; i++)
|
||||||
|
@ -396,7 +396,7 @@ static void timerChConfig_UpdateOverflow(timerConfig_t *cfg, TIM_TypeDef* tim) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// config edge and overflow callback for channel. Try to avoid overflowCallback, it is a bit expensive
|
// config edge and overflow callback for channel. Try to avoid overflowCallback, it is a bit expensive
|
||||||
void timerChConfigCallbacks(const timerHardware_t* timHw, timerCCHandlerRec_t *edgeCallback, timerOvrHandlerRec_t *overflowCallback)
|
void timerChConfigCallbacks(const timerHardware_t *timHw, timerCCHandlerRec_t *edgeCallback, timerOvrHandlerRec_t *overflowCallback)
|
||||||
{
|
{
|
||||||
uint8_t timerIndex = lookupTimerIndex(timHw->tim);
|
uint8_t timerIndex = lookupTimerIndex(timHw->tim);
|
||||||
if (timerIndex >= USED_TIMER_COUNT) {
|
if (timerIndex >= USED_TIMER_COUNT) {
|
||||||
|
@ -418,7 +418,7 @@ void timerChConfigCallbacks(const timerHardware_t* timHw, timerCCHandlerRec_t *e
|
||||||
// configure callbacks for pair of channels (1+2 or 3+4).
|
// configure callbacks for pair of channels (1+2 or 3+4).
|
||||||
// Hi(2,4) and Lo(1,3) callbacks are specified, it is not important which timHw channel is used.
|
// Hi(2,4) and Lo(1,3) callbacks are specified, it is not important which timHw channel is used.
|
||||||
// This is intended for dual capture mode (each channel handles one transition)
|
// This is intended for dual capture mode (each channel handles one transition)
|
||||||
void timerChConfigCallbacksDual(const timerHardware_t* timHw, timerCCHandlerRec_t *edgeCallbackLo, timerCCHandlerRec_t *edgeCallbackHi, timerOvrHandlerRec_t *overflowCallback)
|
void timerChConfigCallbacksDual(const timerHardware_t *timHw, timerCCHandlerRec_t *edgeCallbackLo, timerCCHandlerRec_t *edgeCallbackHi, timerOvrHandlerRec_t *overflowCallback)
|
||||||
{
|
{
|
||||||
uint8_t timerIndex = lookupTimerIndex(timHw->tim);
|
uint8_t timerIndex = lookupTimerIndex(timHw->tim);
|
||||||
if (timerIndex >= USED_TIMER_COUNT) {
|
if (timerIndex >= USED_TIMER_COUNT) {
|
||||||
|
@ -453,24 +453,24 @@ void timerChConfigCallbacksDual(const timerHardware_t* timHw, timerCCHandlerRec_
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable/disable IRQ for low channel in dual configuration
|
// enable/disable IRQ for low channel in dual configuration
|
||||||
void timerChITConfigDualLo(const timerHardware_t* timHw, FunctionalState newState) {
|
void timerChITConfigDualLo(const timerHardware_t *timHw, FunctionalState newState) {
|
||||||
TIM_ITConfig(timHw->tim, TIM_IT_CCx(timHw->channel&~TIM_Channel_2), newState);
|
TIM_ITConfig(timHw->tim, TIM_IT_CCx(timHw->channel&~TIM_Channel_2), newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable or disable IRQ
|
// enable or disable IRQ
|
||||||
void timerChITConfig(const timerHardware_t* timHw, FunctionalState newState)
|
void timerChITConfig(const timerHardware_t *timHw, FunctionalState newState)
|
||||||
{
|
{
|
||||||
TIM_ITConfig(timHw->tim, TIM_IT_CCx(timHw->channel), newState);
|
TIM_ITConfig(timHw->tim, TIM_IT_CCx(timHw->channel), newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear Compare/Capture flag for channel
|
// clear Compare/Capture flag for channel
|
||||||
void timerChClearCCFlag(const timerHardware_t* timHw)
|
void timerChClearCCFlag(const timerHardware_t *timHw)
|
||||||
{
|
{
|
||||||
TIM_ClearFlag(timHw->tim, TIM_IT_CCx(timHw->channel));
|
TIM_ClearFlag(timHw->tim, TIM_IT_CCx(timHw->channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure timer channel GPIO mode
|
// configure timer channel GPIO mode
|
||||||
void timerChConfigGPIO(const timerHardware_t* timHw, GPIO_Mode mode)
|
void timerChConfigGPIO(const timerHardware_t *timHw, GPIO_Mode mode)
|
||||||
{
|
{
|
||||||
gpio_config_t cfg;
|
gpio_config_t cfg;
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ static unsigned getFilter(unsigned ticks)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure input captupre
|
// Configure input captupre
|
||||||
void timerChConfigIC(const timerHardware_t* timHw, bool polarityRising, unsigned inputFilterTicks)
|
void timerChConfigIC(const timerHardware_t *timHw, bool polarityRising, unsigned inputFilterTicks)
|
||||||
{
|
{
|
||||||
TIM_ICInitTypeDef TIM_ICInitStructure;
|
TIM_ICInitTypeDef TIM_ICInitStructure;
|
||||||
|
|
||||||
|
@ -517,7 +517,7 @@ void timerChConfigIC(const timerHardware_t* timHw, bool polarityRising, unsigned
|
||||||
|
|
||||||
// configure dual channel input channel for capture
|
// configure dual channel input channel for capture
|
||||||
// polarity is for Low channel (capture order is always Lo - Hi)
|
// polarity is for Low channel (capture order is always Lo - Hi)
|
||||||
void timerChConfigICDual(const timerHardware_t* timHw, bool polarityRising, unsigned inputFilterTicks)
|
void timerChConfigICDual(const timerHardware_t *timHw, bool polarityRising, unsigned inputFilterTicks)
|
||||||
{
|
{
|
||||||
TIM_ICInitTypeDef TIM_ICInitStructure;
|
TIM_ICInitTypeDef TIM_ICInitStructure;
|
||||||
bool directRising = (timHw->channel & TIM_Channel_2) ? !polarityRising : polarityRising;
|
bool directRising = (timHw->channel & TIM_Channel_2) ? !polarityRising : polarityRising;
|
||||||
|
@ -537,9 +537,7 @@ void timerChConfigICDual(const timerHardware_t* timHw, bool polarityRising, unsi
|
||||||
TIM_ICInit(timHw->tim, &TIM_ICInitStructure);
|
TIM_ICInit(timHw->tim, &TIM_ICInitStructure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void timerChICPolarity(const timerHardware_t *timHw, bool polarityRising)
|
||||||
|
|
||||||
void timerChICPolarity(const timerHardware_t* timHw, bool polarityRising)
|
|
||||||
{
|
{
|
||||||
timCCER_t tmpccer = timHw->tim->CCER;
|
timCCER_t tmpccer = timHw->tim->CCER;
|
||||||
tmpccer &= ~(TIM_CCER_CC1P << timHw->channel);
|
tmpccer &= ~(TIM_CCER_CC1P << timHw->channel);
|
||||||
|
@ -547,19 +545,19 @@ void timerChICPolarity(const timerHardware_t* timHw, bool polarityRising)
|
||||||
timHw->tim->CCER = tmpccer;
|
timHw->tim->CCER = tmpccer;
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile timCCR_t* timerChCCRHi(const timerHardware_t* timHw)
|
volatile timCCR_t* timerChCCRHi(const timerHardware_t *timHw)
|
||||||
{
|
{
|
||||||
return (volatile timCCR_t*)((volatile char*)&timHw->tim->CCR1 + (timHw->channel | TIM_Channel_2));
|
return (volatile timCCR_t*)((volatile char*)&timHw->tim->CCR1 + (timHw->channel | TIM_Channel_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile timCCR_t* timerChCCRLo(const timerHardware_t* timHw)
|
volatile timCCR_t* timerChCCRLo(const timerHardware_t *timHw)
|
||||||
{
|
{
|
||||||
return (volatile timCCR_t*)((volatile char*)&timHw->tim->CCR1 + (timHw->channel & ~TIM_Channel_2));
|
return (volatile timCCR_t*)((volatile char*)&timHw->tim->CCR1 + (timHw->channel & ~TIM_Channel_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
volatile timCCR_t* timerChCCR(const timerHardware_t* timHw)
|
volatile timCCR_t* timerChCCR(const timerHardware_t *timHw)
|
||||||
{
|
{
|
||||||
return (volatile timCCR_t*)((volatile char*)&timHw->tim->CCR1 + timHw->channel);
|
return (volatile timCCR_t*)((volatile char*)&timHw->tim->CCR1 + timHw->channel);
|
||||||
}
|
}
|
||||||
|
@ -599,7 +597,7 @@ void timerChConfigOC(const timerHardware_t* timHw, bool outEnable, bool stateHig
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void timCCxHandler(TIM_TypeDef *tim, timerConfig_t* timerConfig)
|
static void timCCxHandler(TIM_TypeDef *tim, timerConfig_t *timerConfig)
|
||||||
{
|
{
|
||||||
uint16_t capture;
|
uint16_t capture;
|
||||||
unsigned tim_status;
|
unsigned tim_status;
|
||||||
|
|
|
@ -96,10 +96,6 @@
|
||||||
#define USE_I2C
|
#define USE_I2C
|
||||||
#define I2C_DEVICE (I2CDEV_2)
|
#define I2C_DEVICE (I2CDEV_2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #define SOFT_I2C // enable to test software i2c
|
// #define SOFT_I2C // enable to test software i2c
|
||||||
// #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
|
// #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
|
||||||
// #define SOFT_I2C_PB67
|
// #define SOFT_I2C_PB67
|
||||||
|
|
Loading…
Reference in New Issue