Skip to content

Commit

Permalink
v203: inline some functions
Browse files Browse the repository at this point in the history
saves enough flash to build again
  • Loading branch information
tridge committed Dec 8, 2024
1 parent abb7edd commit dc3369b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Mcu/v203/Inc/blutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static inline bool gpio_read(uint32_t pin)
*/
static inline void bl_timer_init(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);
RCC->APB2PCENR |= RCC_APB2Periph_TIM1;

TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
Expand All @@ -103,17 +103,20 @@ static inline void bl_timer_init(void)
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(BL_TIMER, &TIM_TimeBaseStructure);
TIM_SetCounter(BL_TIMER, 0);
TIM_ARRPreloadConfig(BL_TIMER, ENABLE);

TIM_Cmd(BL_TIMER, ENABLE);
// enable preload
BL_TIMER->CTLR1 |= TIM_ARPE;

// enable timer
BL_TIMER->CTLR1 |= TIM_CEN;
}

/*
disable timer ready for app start
*/
static inline void bl_timer_disable(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, DISABLE);
RCC->APB2PCENR &= ~RCC_APB2Periph_TIM1;
}

static inline uint16_t bl_timer_us(void)
Expand Down

0 comments on commit dc3369b

Please sign in to comment.