Motor Driver Evaluation Kit NEVB-MTR1-t01-1.3.1
Firmware for NEVB-MTR1-KIT1 for trapezoidal control of BLDC motors using Hall-effect sensors
Loading...
Searching...
No Matches

These defines are derived from the user settable defines. More...

Collaboration diagram for Derived Defines:

Macros

#define TIM4_PRESCALER_DIV_PATTERN(tim4Prescaler)
 Timer 4 clock select bits based on pre-scaler value.
 
#define TIM4_TOP(tim4Freq)
 
#define TIM4_TOP_MAX   0x03ff
 Maximum top value for Timer 4.
 
#define DT_PRESCALER_DIV_PATTERN(dtPrescaler)
 Deadtime generator pre-scaler selection bits based on pre-scaler value.
 
#define DEAD_TIME_HALF(deadTime)
 This value specifies half the dead time in number of clock cycles. Divide by frequency to get duration.
 
#define TIM3_TOP   (((F_CPU / TIM3_FREQ / 3) >> 4) - 1)
 Calculated top value for Timer 3.
 
#define TIM3_TOP_MAX   0xffff
 Maximum top value for Timer 3.
 
#define MAX_I_TERM   PID_MAX_I_TERM
 PID integrator clamp value passed to the PID controller.
 

Detailed Description

These defines are derived from the user settable defines.

Macro Definition Documentation

◆ DEAD_TIME_HALF

#define DEAD_TIME_HALF ( deadTime)
Value:
(((uint8_t)(ceil((double)deadTime * F_HST / ((double)CHOOSE_DT_PRESCALER(deadTime) * 1000000000)))))
#define F_HST
High-speed system clock frequency.
Definition config.h:750
#define CHOOSE_DT_PRESCALER(deadTime)
Macro to choose Timer4 dead time pre-scaler based on the dead time.
Definition config.h:912

This value specifies half the dead time in number of clock cycles. Divide by frequency to get duration.

Definition at line 1323 of file config.h.

◆ DT_PRESCALER_DIV_PATTERN

#define DT_PRESCALER_DIV_PATTERN ( dtPrescaler)
Value:
((dtPrescaler) == 1 ? DT_PRESCALER_DIV_1 : (dtPrescaler) == 2 ? DT_PRESCALER_DIV_2 \
: (dtPrescaler) == 4 ? DT_PRESCALER_DIV_4 \
: (dtPrescaler) == 8 ? DT_PRESCALER_DIV_8 \
: 0)
#define DT_PRESCALER_DIV_8
Deadtime generator pre-scaler - division factor 8.
Definition config.h:1005
#define DT_PRESCALER_DIV_2
Deadtime generator pre-scaler - division factor 2.
Definition config.h:1001
#define DT_PRESCALER_DIV_4
Deadtime generator pre-scaler - division factor 4.
Definition config.h:1003
#define DT_PRESCALER_DIV_1
Deadtime generator pre-scaler - division factor 1.
Definition config.h:999

Deadtime generator pre-scaler selection bits based on pre-scaler value.

This macro generates the deadtime generator pre-scaler selection bits pattern based on the chosen pre-scaler value.

Definition at line 1313 of file config.h.

1313#define DT_PRESCALER_DIV_PATTERN(dtPrescaler) \
1314 ((dtPrescaler) == 1 ? DT_PRESCALER_DIV_1 : (dtPrescaler) == 2 ? DT_PRESCALER_DIV_2 \
1315 : (dtPrescaler) == 4 ? DT_PRESCALER_DIV_4 \
1316 : (dtPrescaler) == 8 ? DT_PRESCALER_DIV_8 \
1317 : 0)

◆ MAX_I_TERM

#define MAX_I_TERM   PID_MAX_I_TERM

PID integrator clamp value passed to the PID controller.

Translates the user-settable PID_MAX_I_TERM into the MAX_I_TERM symbol consumed by pid.h. The guard ensures that if pid.h is ever compiled without config.h in scope it falls back to its own safe default.

Definition at line 1351 of file config.h.

◆ TIM3_TOP

#define TIM3_TOP   (((F_CPU / TIM3_FREQ / 3) >> 4) - 1)

Calculated top value for Timer 3.

Formula: TIM3_TOP = (F_CPU / (TIM3_FREQ * TIM3_PRESCALER * 6)) - 1, where TIM3_PRESCALER = 8 and 6 is the number of commutations in a complete cycle.

Definition at line 1331 of file config.h.

◆ TIM3_TOP_MAX

#define TIM3_TOP_MAX   0xffff

Maximum top value for Timer 3.

Definition at line 1334 of file config.h.

◆ TIM4_PRESCALER_DIV_PATTERN

#define TIM4_PRESCALER_DIV_PATTERN ( tim4Prescaler)
Value:
((tim4Prescaler) == 1 ? TIM4_PRESCALER_DIV_1 : (tim4Prescaler) == 2 ? TIM4_PRESCALER_DIV_2 \
: (tim4Prescaler) == 4 ? TIM4_PRESCALER_DIV_4 \
: 0)
#define TIM4_PRESCALER_DIV_2
Timer4 pre-scaler - division factor 2.
Definition config.h:1044
#define TIM4_PRESCALER_DIV_1
Timer4 pre-scaler - division factor 1.
Definition config.h:1042
#define TIM4_PRESCALER_DIV_4
Timer4 pre-scaler - division factor 4.
Definition config.h:1046

Timer 4 clock select bits based on pre-scaler value.

This macro generates the timer 4 clock select bits pattern based on the chosen pre-scaler value. It is used to configure the timer's clock division.

Definition at line 1295 of file config.h.

1295#define TIM4_PRESCALER_DIV_PATTERN(tim4Prescaler) \
1296 ((tim4Prescaler) == 1 ? TIM4_PRESCALER_DIV_1 : (tim4Prescaler) == 2 ? TIM4_PRESCALER_DIV_2 \
1297 : (tim4Prescaler) == 4 ? TIM4_PRESCALER_DIV_4 \
1298 : 0)

◆ TIM4_TOP

#define TIM4_TOP ( tim4Freq)
Value:
(((F_HST / ((uint32_t)tim4Freq * CHOOSE_TIM4_PRESCALER(tim4Freq))) >> 1) - 1)
#define CHOOSE_TIM4_PRESCALER(tim4Freq)
Macro to choose Timer4 pre-scaler.
Definition config.h:894

Calculate top value for Timer 4. Formula: TIM4_TOP = (F_HST / (F_MOSFET * TIM4_PRESCALER * 2)).

Definition at line 1302 of file config.h.

◆ TIM4_TOP_MAX

#define TIM4_TOP_MAX   0x03ff

Maximum top value for Timer 4.

Definition at line 1305 of file config.h.