note: - модбас не моделируется, в s-function просто передаются константы режимов. - лишние файлы убраны в outdate. - два канала одной фазы переключаются немного криво: на один такт симуляции проскакивает высокий уровень предыдущего канала и только потом включается текущий канал
90 lines
2.4 KiB
C
90 lines
2.4 KiB
C
// TRACE SETTINGS
|
|
|
|
#define TRACE_MB_UART_ENABLE 14
|
|
//#define TRACE_MB_TIM_ENABLE 15
|
|
#define TRACE_TIM_PWM_ENABLE 15
|
|
//#define TRACE_PWM_REINIT_ENABLE 15
|
|
//#define TRACE_TIM_DEAD_TIME_ENABLE 14
|
|
//#define TRACE_TIM_CTRL_ENABLE 15
|
|
|
|
|
|
#define TRACE_GPIO_ENTER(_gpio_,_pin_) (_gpio_)->BSRR = (1<<(_pin_))
|
|
#define TRACE_GPIO_EXIT(_gpio_,_pin_) (_gpio_)->BSRR = (1<<((_pin_)+16))
|
|
|
|
#ifdef TRACE_MB_UART_ENABLE
|
|
#define Trace_MB_UART_Enter() TRACE_GPIO_ENTER(GPIOD, TRACE_MB_UART_ENABLE)
|
|
#define Trace_MB_UART_Exit() TRACE_GPIO_EXIT(GPIOD, TRACE_MB_UART_ENABLE)
|
|
#endif
|
|
#ifdef TRACE_MB_TIM_ENABLE
|
|
#define Trace_MB_TIM_Enter() TRACE_GPIO_ENTER(GPIOD, TRACE_MB_TIM_ENABLE)
|
|
#define Trace_MB_TIM_Exit() TRACE_GPIO_EXIT(GPIOD, TRACE_MB_TIM_ENABLE)
|
|
#endif
|
|
|
|
|
|
#ifdef TRACE_TIM_PWM_ENABLE
|
|
#define Trace_PWM_TIM_Enter() TRACE_GPIO_ENTER(GPIOD, TRACE_TIM_PWM_ENABLE)
|
|
#define Trace_PWM_TIM_Exit() TRACE_GPIO_EXIT(GPIOD, TRACE_TIM_PWM_ENABLE)
|
|
#endif
|
|
#ifdef TRACE_PWM_REINIT_ENABLE
|
|
#define Trace_PWM_reInit_Enter() TRACE_GPIO_ENTER(GPIOD, TRACE_PWM_REINIT_ENABLE)
|
|
#define Trace_PWM_reInit_Exit() TRACE_GPIO_EXIT(GPIOD, TRACE_PWM_REINIT_ENABLE)
|
|
#endif
|
|
#ifdef TRACE_TIM_DEAD_TIME_ENABLE
|
|
#define Trace_PWM_DeadTime_Enter() TRACE_GPIO_ENTER(GPIOD, TRACE_TIM_DEAD_TIME_ENABLE)
|
|
#define Trace_PWM_DeadTime_Exit() TRACE_GPIO_EXIT(GPIOD, TRACE_TIM_DEAD_TIME_ENABLE)
|
|
#endif
|
|
|
|
#ifdef TRACE_TIM_CTRL_ENABLE
|
|
#define Trace_CTRL_TIM_Enter() TRACE_GPIO_ENTER(GPIOD, TRACE_TIM_CTRL_ENABLE)
|
|
#define Trace_CTRL_TIM_Exit() TRACE_GPIO_EXIT(GPIOD, TRACE_TIM_CTRL_ENABLE)
|
|
#endif
|
|
|
|
|
|
#ifndef Trace_MB_UART_Enter
|
|
#define Trace_MB_UART_Enter()
|
|
#endif
|
|
|
|
#ifndef Trace_MB_UART_Exit
|
|
#define Trace_MB_UART_Exit()
|
|
#endif
|
|
|
|
#ifndef Trace_MB_TIM_Enter
|
|
#define Trace_MB_TIM_Enter()
|
|
#endif
|
|
|
|
#ifndef Trace_MB_TIM_Exit
|
|
#define Trace_MB_TIM_Exit()
|
|
#endif
|
|
|
|
#ifndef Trace_PWM_TIM_Enter
|
|
#define Trace_PWM_TIM_Enter()
|
|
#endif
|
|
|
|
#ifndef Trace_PWM_TIM_Exit
|
|
#define Trace_PWM_TIM_Exit()
|
|
#endif
|
|
|
|
#ifndef Trace_CTRL_TIM_Enter
|
|
#define Trace_CTRL_TIM_Enter()
|
|
#endif
|
|
|
|
#ifndef Trace_CTRL_TIM_Exit
|
|
#define Trace_CTRL_TIM_Exit()
|
|
#endif
|
|
|
|
|
|
#ifndef Trace_PWM_reInit_Enter
|
|
#define Trace_PWM_reInit_Enter()
|
|
#endif
|
|
|
|
#ifndef Trace_PWM_reInit_Exit
|
|
#define Trace_PWM_reInit_Exit()
|
|
#endif
|
|
|
|
#ifndef Trace_PWM_DeadTime_Enter
|
|
#define Trace_PWM_DeadTime_Enter()
|
|
#endif
|
|
|
|
#ifndef Trace_PWM_DeadTime_Exit
|
|
#define Trace_PWM_DeadTime_Exit()
|
|
#endif |