Skip to content

Commit

Permalink
pwm timer 4 added for buzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
Akashem06 committed Apr 1, 2024
1 parent 1abf8cc commit b0924fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions libraries/ms-common/inc/arm/pwm_mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ typedef enum {
PWM_TIMER_1 = 0,
// PWM_TIMER_2, // Requisitioned to back the soft_timer module.
PWM_TIMER_3,
PWM_TIMER_4,
PWM_TIMER_14,
PWM_TIMER_15,
PWM_TIMER_16,
Expand Down
1 change: 1 addition & 0 deletions libraries/ms-common/inc/x86/pwm_mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ typedef enum {
PWM_TIMER_1 = 0,
// PWM_TIMER_2, // Requisitioned to back the soft_timer module.
PWM_TIMER_3,
PWM_TIMER_4,
PWM_TIMER_14,
PWM_TIMER_15,
PWM_TIMER_16,
Expand Down
5 changes: 5 additions & 0 deletions libraries/ms-common/src/arm/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ typedef enum APBClk {
static uint16_t s_period_us[NUM_PWM_TIMERS] = {
[PWM_TIMER_1] = 0, //
[PWM_TIMER_3] = 0, //
[PWM_TIMER_4] = 0, // This timer is typically used by I2C
[PWM_TIMER_14] = 0, //
[PWM_TIMER_15] = 0, //
[PWM_TIMER_16] = 0, //
Expand All @@ -25,6 +26,7 @@ static uint16_t s_period_us[NUM_PWM_TIMERS] = {
static TIM_TypeDef *s_timer_def[NUM_PWM_TIMERS] = {
[PWM_TIMER_1] = TIM1, //
[PWM_TIMER_3] = TIM3, //
[PWM_TIMER_4] = TIM4, // Typically used for I2C
[PWM_TIMER_14] = TIM14, //
[PWM_TIMER_15] = TIM15, //
[PWM_TIMER_16] = TIM16, //
Expand All @@ -39,6 +41,9 @@ static APBClk prv_enable_periph_clock(PwmTimer timer) {
case PWM_TIMER_3:
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
return APB1;
case PWM_TIMER_4:
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
return APB1;
case PWM_TIMER_14:
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM14, ENABLE);
return APB1;
Expand Down

0 comments on commit b0924fc

Please sign in to comment.