stm32: timer: Remove TIMER_IS_ADVANCED() checks

The ADVANCED_TIMERS define/check was added in 523943a as part of adding L1
support. The runtime checks against TIM1/TIM8 already existed. Since L1
doesn't have TIM1/TIM8, those names are undefined, resulting in a compilation
error until ifdeffed out.

Since I throw out all TIM1/TIM8 checks, there's no references to those names
left, thus no need to keep the ifdef either.

As for the registers themselves, l1/timer.h pulls in common/timer_common_all.h
which defines macros for the superset of all timers, so e.g. TIM_BDTR() is
still available regardless of whether or not the particular chip we're building
for has any timers with a BDTR register.
This commit is contained in:
Vegard Storheil Eriksen 2017-10-12 21:18:40 +02:00 committed by Karl Palsson
parent bf882caf4d
commit ef07b970f3

View File

@ -114,18 +114,6 @@ knob.
#include <libopencm3/stm32/timer.h> #include <libopencm3/stm32/timer.h>
#include <libopencm3/stm32/rcc.h> #include <libopencm3/stm32/rcc.h>
#if (defined(TIM1_BASE) || defined(TIM8_BASE))
#define ADVANCED_TIMERS 1
#else
#define ADVANCED_TIMERS 0
#endif
#if defined(TIM8)
#define TIMER_IS_ADVANCED(periph) (((periph) == TIM1) || ((periph) == TIM8))
#else
#define TIMER_IS_ADVANCED(periph) ((periph) == TIM1)
#endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Reset a Timer. /** @brief Reset a Timer.
@ -247,12 +235,6 @@ bool timer_interrupt_source(uint32_t timer_peripheral, uint32_t flag)
(flag > TIM_SR_BIF)) { (flag > TIM_SR_BIF)) {
return false; return false;
} }
/* Only an interrupt source for advanced timers */
#if ADVANCED_TIMERS
if ((flag == TIM_SR_BIF) || (flag == TIM_SR_COMIF)) {
return TIMER_IS_ADVANCED(timer_peripheral);
}
#endif
return true; return true;
} }
@ -549,15 +531,8 @@ output control values.
void timer_set_output_idle_state(uint32_t timer_peripheral, uint32_t outputs) void timer_set_output_idle_state(uint32_t timer_peripheral, uint32_t outputs)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_CR2(timer_peripheral) |= outputs & TIM_CR2_OIS_MASK; TIM_CR2(timer_peripheral) |= outputs & TIM_CR2_OIS_MASK;
} }
#else
(void)timer_peripheral;
(void)outputs;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Set Timer Output Idle States Low. /** @brief Set Timer Output Idle States Low.
@ -576,15 +551,8 @@ tim_x_cr2_ois
void timer_reset_output_idle_state(uint32_t timer_peripheral, uint32_t outputs) void timer_reset_output_idle_state(uint32_t timer_peripheral, uint32_t outputs)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_CR2(timer_peripheral) &= ~(outputs & TIM_CR2_OIS_MASK); TIM_CR2(timer_peripheral) &= ~(outputs & TIM_CR2_OIS_MASK);
} }
#else
(void)timer_peripheral;
(void)outputs;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Set Timer 1 Input to XOR of Three Channels. /** @brief Set Timer 1 Input to XOR of Three Channels.
@ -676,14 +644,8 @@ tim_reg_base
void timer_enable_compare_control_update_on_trigger(uint32_t timer_peripheral) void timer_enable_compare_control_update_on_trigger(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_CR2(timer_peripheral) |= TIM_CR2_CCUS; TIM_CR2(timer_peripheral) |= TIM_CR2_CCUS;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Disable Timer Capture/Compare Control Update with Trigger. /** @brief Disable Timer Capture/Compare Control Update with Trigger.
@ -701,14 +663,8 @@ tim_reg_base
void timer_disable_compare_control_update_on_trigger(uint32_t timer_peripheral) void timer_disable_compare_control_update_on_trigger(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_CR2(timer_peripheral) &= ~TIM_CR2_CCUS; TIM_CR2(timer_peripheral) &= ~TIM_CR2_CCUS;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Enable Timer Capture/Compare Control Preload. /** @brief Enable Timer Capture/Compare Control Preload.
@ -725,14 +681,8 @@ tim_reg_base
void timer_enable_preload_complementry_enable_bits(uint32_t timer_peripheral) void timer_enable_preload_complementry_enable_bits(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_CR2(timer_peripheral) |= TIM_CR2_CCPC; TIM_CR2(timer_peripheral) |= TIM_CR2_CCPC;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Disable Timer Capture/Compare Control Preload. /** @brief Disable Timer Capture/Compare Control Preload.
@ -748,14 +698,8 @@ tim_reg_base
void timer_disable_preload_complementry_enable_bits(uint32_t timer_peripheral) void timer_disable_preload_complementry_enable_bits(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_CR2(timer_peripheral) &= ~TIM_CR2_CCPC; TIM_CR2(timer_peripheral) &= ~TIM_CR2_CCPC;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Set the Value for the Timer Prescaler. /** @brief Set the Value for the Timer Prescaler.
@ -787,15 +731,8 @@ tim_reg_base
void timer_set_repetition_counter(uint32_t timer_peripheral, uint32_t value) void timer_set_repetition_counter(uint32_t timer_peripheral, uint32_t value)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_RCR(timer_peripheral) = value; TIM_RCR(timer_peripheral) = value;
} }
#else
(void)timer_peripheral;
(void)value;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Timer Set Period /** @brief Timer Set Period
@ -1215,23 +1152,6 @@ void timer_set_oc_polarity_high(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC4: case TIM_OC4:
TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC4P; TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC4P;
break; break;
case TIM_OC1N:
case TIM_OC2N:
case TIM_OC3N:
/* Ignoring as this option applies to TIM1 and TIM8 only. */
break;
}
/* Acting for TIM1 and TIM8 only from here onwards. */
#if ADVANCED_TIMERS
if (!TIMER_IS_ADVANCED(timer_peripheral)) {
return;
}
#else
return;
#endif
switch (oc_id) {
case TIM_OC1N: case TIM_OC1N:
TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC1NP; TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC1NP;
break; break;
@ -1241,12 +1161,6 @@ void timer_set_oc_polarity_high(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC3N: case TIM_OC3N:
TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC3NP; TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC3NP;
break; break;
case TIM_OC1:
case TIM_OC2:
case TIM_OC3:
case TIM_OC4:
/* Ignoring as this option was already set above. */
break;
} }
} }
@ -1277,23 +1191,6 @@ void timer_set_oc_polarity_low(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC4: case TIM_OC4:
TIM_CCER(timer_peripheral) |= TIM_CCER_CC4P; TIM_CCER(timer_peripheral) |= TIM_CCER_CC4P;
break; break;
case TIM_OC1N:
case TIM_OC2N:
case TIM_OC3N:
/* Ignoring as this option applies to TIM1 and TIM8 only. */
break;
}
/* Acting for TIM1 and TIM8 only from here onwards. */
#if ADVANCED_TIMERS
if (!TIMER_IS_ADVANCED(timer_peripheral)) {
return;
}
#else
return;
#endif
switch (oc_id) {
case TIM_OC1N: case TIM_OC1N:
TIM_CCER(timer_peripheral) |= TIM_CCER_CC1NP; TIM_CCER(timer_peripheral) |= TIM_CCER_CC1NP;
break; break;
@ -1303,12 +1200,6 @@ void timer_set_oc_polarity_low(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC3N: case TIM_OC3N:
TIM_CCER(timer_peripheral) |= TIM_CCER_CC3NP; TIM_CCER(timer_peripheral) |= TIM_CCER_CC3NP;
break; break;
case TIM_OC1:
case TIM_OC2:
case TIM_OC3:
case TIM_OC4:
/* Ignoring as this option was already set above. */
break;
} }
} }
@ -1339,23 +1230,6 @@ void timer_enable_oc_output(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC4: case TIM_OC4:
TIM_CCER(timer_peripheral) |= TIM_CCER_CC4E; TIM_CCER(timer_peripheral) |= TIM_CCER_CC4E;
break; break;
case TIM_OC1N:
case TIM_OC2N:
case TIM_OC3N:
/* Ignoring as this option applies to TIM1 and TIM8 only. */
break;
}
/* Acting for TIM1 and TIM8 only from here onwards. */
#if ADVANCED_TIMERS
if (!TIMER_IS_ADVANCED(timer_peripheral)) {
return;
}
#else
return;
#endif
switch (oc_id) {
case TIM_OC1N: case TIM_OC1N:
TIM_CCER(timer_peripheral) |= TIM_CCER_CC1NE; TIM_CCER(timer_peripheral) |= TIM_CCER_CC1NE;
break; break;
@ -1365,12 +1239,6 @@ void timer_enable_oc_output(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC3N: case TIM_OC3N:
TIM_CCER(timer_peripheral) |= TIM_CCER_CC3NE; TIM_CCER(timer_peripheral) |= TIM_CCER_CC3NE;
break; break;
case TIM_OC1:
case TIM_OC2:
case TIM_OC3:
case TIM_OC4:
/* Ignoring as this option was already set above. */
break;
} }
} }
@ -1401,23 +1269,6 @@ void timer_disable_oc_output(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC4: case TIM_OC4:
TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC4E; TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC4E;
break; break;
case TIM_OC1N:
case TIM_OC2N:
case TIM_OC3N:
/* Ignoring as this option applies to TIM1 and TIM8 only. */
break;
}
/* Acting for TIM1 and TIM8 only from here onwards. */
#if ADVANCED_TIMERS
if (!TIMER_IS_ADVANCED(timer_peripheral)) {
return;
}
#else
return;
#endif
switch (oc_id) {
case TIM_OC1N: case TIM_OC1N:
TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC1NE; TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC1NE;
break; break;
@ -1427,12 +1278,6 @@ void timer_disable_oc_output(uint32_t timer_peripheral, enum tim_oc_id oc_id)
case TIM_OC3N: case TIM_OC3N:
TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC3NE; TIM_CCER(timer_peripheral) &= ~TIM_CCER_CC3NE;
break; break;
case TIM_OC1:
case TIM_OC2:
case TIM_OC3:
case TIM_OC4:
/* Ignoring as this option was already set above. */
break;
} }
} }
@ -1454,12 +1299,6 @@ tim_reg_base
void timer_set_oc_idle_state_set(uint32_t timer_peripheral, void timer_set_oc_idle_state_set(uint32_t timer_peripheral,
enum tim_oc_id oc_id) enum tim_oc_id oc_id)
{ {
#if ADVANCED_TIMERS
/* Acting for TIM1 and TIM8 only. */
if (!TIMER_IS_ADVANCED(timer_peripheral)) {
return;
}
switch (oc_id) { switch (oc_id) {
case TIM_OC1: case TIM_OC1:
TIM_CR2(timer_peripheral) |= TIM_CR2_OIS1; TIM_CR2(timer_peripheral) |= TIM_CR2_OIS1;
@ -1483,10 +1322,6 @@ void timer_set_oc_idle_state_set(uint32_t timer_peripheral,
TIM_CR2(timer_peripheral) |= TIM_CR2_OIS4; TIM_CR2(timer_peripheral) |= TIM_CR2_OIS4;
break; break;
} }
#else
(void)timer_peripheral;
(void)oc_id;
#endif
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -1507,12 +1342,6 @@ tim_reg_base
void timer_set_oc_idle_state_unset(uint32_t timer_peripheral, void timer_set_oc_idle_state_unset(uint32_t timer_peripheral,
enum tim_oc_id oc_id) enum tim_oc_id oc_id)
{ {
#if ADVANCED_TIMERS
/* Acting for TIM1 and TIM8 only. */
if (!TIMER_IS_ADVANCED(timer_peripheral)) {
return;
}
switch (oc_id) { switch (oc_id) {
case TIM_OC1: case TIM_OC1:
TIM_CR2(timer_peripheral) &= ~TIM_CR2_OIS1; TIM_CR2(timer_peripheral) &= ~TIM_CR2_OIS1;
@ -1536,10 +1365,6 @@ void timer_set_oc_idle_state_unset(uint32_t timer_peripheral,
TIM_CR2(timer_peripheral) &= ~TIM_CR2_OIS4; TIM_CR2(timer_peripheral) &= ~TIM_CR2_OIS4;
break; break;
} }
#else
(void)timer_peripheral;
(void)oc_id;
#endif
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -1597,14 +1422,8 @@ TIM8
void timer_enable_break_main_output(uint32_t timer_peripheral) void timer_enable_break_main_output(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= TIM_BDTR_MOE; TIM_BDTR(timer_peripheral) |= TIM_BDTR_MOE;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Disable Output in Break /** @brief Disable Output in Break
@ -1620,14 +1439,8 @@ TIM8
void timer_disable_break_main_output(uint32_t timer_peripheral) void timer_disable_break_main_output(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_MOE; TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_MOE;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Enable Automatic Output in Break /** @brief Enable Automatic Output in Break
@ -1644,14 +1457,8 @@ TIM8
void timer_enable_break_automatic_output(uint32_t timer_peripheral) void timer_enable_break_automatic_output(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= TIM_BDTR_AOE; TIM_BDTR(timer_peripheral) |= TIM_BDTR_AOE;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Disable Automatic Output in Break /** @brief Disable Automatic Output in Break
@ -1668,14 +1475,8 @@ TIM8
void timer_disable_break_automatic_output(uint32_t timer_peripheral) void timer_disable_break_automatic_output(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_AOE; TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_AOE;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Activate Break when Input High /** @brief Activate Break when Input High
@ -1690,14 +1491,8 @@ TIM8
void timer_set_break_polarity_high(uint32_t timer_peripheral) void timer_set_break_polarity_high(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= TIM_BDTR_BKP; TIM_BDTR(timer_peripheral) |= TIM_BDTR_BKP;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Activate Break when Input Low /** @brief Activate Break when Input Low
@ -1712,14 +1507,8 @@ TIM8
void timer_set_break_polarity_low(uint32_t timer_peripheral) void timer_set_break_polarity_low(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_BKP; TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_BKP;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Enable Break /** @brief Enable Break
@ -1734,14 +1523,8 @@ TIM8
void timer_enable_break(uint32_t timer_peripheral) void timer_enable_break(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= TIM_BDTR_BKE; TIM_BDTR(timer_peripheral) |= TIM_BDTR_BKE;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Disable Break /** @brief Disable Break
@ -1756,14 +1539,8 @@ TIM8
void timer_disable_break(uint32_t timer_peripheral) void timer_disable_break(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_BKE; TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_BKE;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Enable Off-State in Run Mode /** @brief Enable Off-State in Run Mode
@ -1782,14 +1559,8 @@ TIM8
void timer_set_enabled_off_state_in_run_mode(uint32_t timer_peripheral) void timer_set_enabled_off_state_in_run_mode(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= TIM_BDTR_OSSR; TIM_BDTR(timer_peripheral) |= TIM_BDTR_OSSR;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Disable Off-State in Run Mode /** @brief Disable Off-State in Run Mode
@ -1807,14 +1578,8 @@ TIM8
void timer_set_disabled_off_state_in_run_mode(uint32_t timer_peripheral) void timer_set_disabled_off_state_in_run_mode(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_OSSR; TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_OSSR;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Enable Off-State in Idle Mode /** @brief Enable Off-State in Idle Mode
@ -1831,14 +1596,8 @@ TIM8
void timer_set_enabled_off_state_in_idle_mode(uint32_t timer_peripheral) void timer_set_enabled_off_state_in_idle_mode(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= TIM_BDTR_OSSI; TIM_BDTR(timer_peripheral) |= TIM_BDTR_OSSI;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Disable Off-State in Idle Mode /** @brief Disable Off-State in Idle Mode
@ -1854,14 +1613,8 @@ TIM8
void timer_set_disabled_off_state_in_idle_mode(uint32_t timer_peripheral) void timer_set_disabled_off_state_in_idle_mode(uint32_t timer_peripheral)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_OSSI; TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_OSSI;
} }
#else
(void)timer_peripheral;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Set Lock Bits /** @brief Set Lock Bits
@ -1879,15 +1632,8 @@ TIM8
void timer_set_break_lock(uint32_t timer_peripheral, uint32_t lock) void timer_set_break_lock(uint32_t timer_peripheral, uint32_t lock)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= lock; TIM_BDTR(timer_peripheral) |= lock;
} }
#else
(void)timer_peripheral;
(void)lock;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Set Deadtime /** @brief Set Deadtime
@ -1911,15 +1657,8 @@ above.
void timer_set_deadtime(uint32_t timer_peripheral, uint32_t deadtime) void timer_set_deadtime(uint32_t timer_peripheral, uint32_t deadtime)
{ {
#if ADVANCED_TIMERS
if (TIMER_IS_ADVANCED(timer_peripheral)) {
TIM_BDTR(timer_peripheral) |= deadtime; TIM_BDTR(timer_peripheral) |= deadtime;
} }
#else
(void)timer_peripheral;
(void)deadtime;
#endif
}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/** @brief Force generate a timer event. /** @brief Force generate a timer event.