ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
Loading...
Searching...
No Matches
timer.c File Reference
#include "bsp/timer.h"
#include "bsp/error.h"

Go to the source code of this file.

Functions

void MX_TIM1_Init (void)
 Initialize TIM1 for PWM output.
 
void HAL_TIM_PWM_MspInit (TIM_HandleTypeDef *tim_pwmHandle)
 
void HAL_TIM_MspPostInit (TIM_HandleTypeDef *timHandle)
 Post-initialization for TIM1 GPIO.
 
void HAL_TIM_PWM_MspDeInit (TIM_HandleTypeDef *tim_pwmHandle)
 

Variables

TIM_HandleTypeDef htim1
 TIM1 handle (PWM output)
 

Function Documentation

◆ HAL_TIM_MspPostInit()

void HAL_TIM_MspPostInit ( TIM_HandleTypeDef *  htim)

Post-initialization for TIM1 GPIO.

Parameters
[in]htimTimer handle

TIM1 GPIO Configuration PE10 ---—> TIM1_CH2N

< Alternate Function Push Pull Mode

< No Pull-up or Pull-down activation

< Low speed

Definition at line 111 of file timer.c.

Referenced by MX_TIM1_Init().

◆ HAL_TIM_PWM_MspDeInit()

void HAL_TIM_PWM_MspDeInit ( TIM_HandleTypeDef *  tim_pwmHandle)

Definition at line 139 of file timer.c.

◆ HAL_TIM_PWM_MspInit()

void HAL_TIM_PWM_MspInit ( TIM_HandleTypeDef *  tim_pwmHandle)

Definition at line 96 of file timer.c.

◆ MX_TIM1_Init()

void MX_TIM1_Init ( void  )

Initialize TIM1 for PWM output.

Configures TIM1 Channel 2N for PWM:

  • 10kHz PWM frequency
  • 0-999 duty cycle range

< Counter used as up-counter

< Clock division: tDTS=tCK_INT

< TIMx_ARR register is not buffered

< TIMx_EGR.UG bit is used as trigger output (TRGO)

< TIMx_EGR.UG bit is used as trigger output (TRGO2)

< Master/slave mode is selected

< PWM mode 1

< Capture/Compare output polarity

< Capture/Compare complementary output polarity

< Output Compare fast disable

< Output Idle state: OCx=0 when MOE=0

< Complementary output Idle state: OCxN=0 when MOE=0

< Capture/compare channel 2 identifier

< When inactive, OC/OCN outputs are disabled (not controlled any longer by the timer)

< When inactive, OC/OCN outputs are disabled (not controlled any longer by the timer)

< LOCK OFF

< Break input BRK is disabled

< Break input BRK is active high

< Break input BRK2 is disabled

< Break input BRK2 is active high

< MOE can be set only by software

Definition at line 31 of file timer.c.

References Error_Handler(), HAL_TIM_MspPostInit(), and htim1.

Referenced by hal_init().

Variable Documentation

◆ htim1

TIM_HandleTypeDef htim1

TIM1 handle (PWM output)

Definition at line 28 of file timer.c.

Referenced by bsp_pwm_set_duty(), and MX_TIM1_Init().