mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
mcpwm: support non-varg version of generator functions
Closes https://github.com/espressif/esp-idf/issues/10449
This commit is contained in:
parent
490216a2ac
commit
ae7c8de4a7
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -88,7 +88,22 @@ typedef struct {
|
|||||||
(mcpwm_gen_timer_event_action_t) { .event = MCPWM_TIMER_EVENT_INVALID }
|
(mcpwm_gen_timer_event_action_t) { .event = MCPWM_TIMER_EVENT_INVALID }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set generator actions on different MCPWM timer events
|
* @brief Set generator action on MCPWM timer event
|
||||||
|
*
|
||||||
|
* @param[in] gen MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
||||||
|
* @param[in] ev_act MCPWM timer event action, can be constructed by `MCPWM_GEN_TIMER_EVENT_ACTION` helper macro
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: Set generator action successfully
|
||||||
|
* - ESP_ERR_INVALID_ARG: Set generator action failed because of invalid argument
|
||||||
|
* - ESP_ERR_INVALID_STATE: Set generator action failed because of timer is not connected to operator
|
||||||
|
* - ESP_FAIL: Set generator action failed because of other error
|
||||||
|
*/
|
||||||
|
esp_err_t mcpwm_generator_set_action_on_timer_event(mcpwm_gen_handle_t gen, mcpwm_gen_timer_event_action_t ev_act);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set generator actions on multiple MCPWM timer events
|
||||||
|
*
|
||||||
|
* @note This is an aggregation version of `mcpwm_generator_set_action_on_timer_event`, which allows user to set multiple actions in one call.
|
||||||
*
|
*
|
||||||
* @param[in] gen MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
* @param[in] gen MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
||||||
* @param[in] ev_act MCPWM timer event action list, must be terminated by `MCPWM_GEN_TIMER_EVENT_ACTION_END()`
|
* @param[in] ev_act MCPWM timer event action list, must be terminated by `MCPWM_GEN_TIMER_EVENT_ACTION_END()`
|
||||||
@ -118,7 +133,21 @@ typedef struct {
|
|||||||
(mcpwm_gen_compare_event_action_t) { .comparator = NULL }
|
(mcpwm_gen_compare_event_action_t) { .comparator = NULL }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set generator actions on different MCPWM compare events
|
* @brief Set generator action on MCPWM compare event
|
||||||
|
*
|
||||||
|
* @param[in] generator MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
||||||
|
* @param[in] ev_act MCPWM compare event action, can be constructed by `MCPWM_GEN_COMPARE_EVENT_ACTION` helper macro
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: Set generator action successfully
|
||||||
|
* - ESP_ERR_INVALID_ARG: Set generator action failed because of invalid argument
|
||||||
|
* - ESP_FAIL: Set generator action failed because of other error
|
||||||
|
*/
|
||||||
|
esp_err_t mcpwm_generator_set_action_on_compare_event(mcpwm_gen_handle_t generator, mcpwm_gen_compare_event_action_t ev_act);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set generator actions on multiple MCPWM compare events
|
||||||
|
*
|
||||||
|
* @note This is an aggregation version of `mcpwm_generator_set_action_on_compare_event`, which allows user to set multiple actions in one call.
|
||||||
*
|
*
|
||||||
* @param[in] generator MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
* @param[in] generator MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
||||||
* @param[in] ev_act MCPWM compare event action list, must be terminated by `MCPWM_GEN_COMPARE_EVENT_ACTION_END()`
|
* @param[in] ev_act MCPWM compare event action list, must be terminated by `MCPWM_GEN_COMPARE_EVENT_ACTION_END()`
|
||||||
@ -147,7 +176,21 @@ typedef struct {
|
|||||||
(mcpwm_gen_brake_event_action_t) { .brake_mode = MCPWM_OPER_BRAKE_MODE_INVALID }
|
(mcpwm_gen_brake_event_action_t) { .brake_mode = MCPWM_OPER_BRAKE_MODE_INVALID }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set generator actions on different MCPWM brake events
|
* @brief Set generator action on MCPWM brake event
|
||||||
|
*
|
||||||
|
* @param[in] generator MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
||||||
|
* @param[in] ev_act MCPWM brake event action, can be constructed by `MCPWM_GEN_BRAKE_EVENT_ACTION` helper macro
|
||||||
|
* @return
|
||||||
|
* - ESP_OK: Set generator action successfully
|
||||||
|
* - ESP_ERR_INVALID_ARG: Set generator action failed because of invalid argument
|
||||||
|
* - ESP_FAIL: Set generator action failed because of other error
|
||||||
|
*/
|
||||||
|
esp_err_t mcpwm_generator_set_action_on_brake_event(mcpwm_gen_handle_t generator, mcpwm_gen_brake_event_action_t ev_act);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set generator actions on multiple MCPWM brake events
|
||||||
|
*
|
||||||
|
* @note This is an aggregation version of `mcpwm_generator_set_action_on_brake_event`, which allows user to set multiple actions in one call.
|
||||||
*
|
*
|
||||||
* @param[in] generator MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
* @param[in] generator MCPWM generator handle, allocated by `mcpwm_new_generator()`
|
||||||
* @param[in] ev_act MCPWM brake event action list, must be terminated by `MCPWM_GEN_BRAKE_EVENT_ACTION_END()`
|
* @param[in] ev_act MCPWM brake event action list, must be terminated by `MCPWM_GEN_BRAKE_EVENT_ACTION_END()`
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -148,6 +148,28 @@ esp_err_t mcpwm_generator_set_force_level(mcpwm_gen_handle_t gen, int level, boo
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t mcpwm_generator_set_action_on_timer_event(mcpwm_gen_handle_t gen, mcpwm_gen_timer_event_action_t ev_act)
|
||||||
|
{
|
||||||
|
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
|
ESP_RETURN_ON_FALSE(ev_act.event != MCPWM_TIMER_EVENT_INVALID, ESP_ERR_INVALID_ARG, TAG, "invalid event");
|
||||||
|
mcpwm_oper_t *oper = gen->oper;
|
||||||
|
mcpwm_group_t *group = oper->group;
|
||||||
|
mcpwm_timer_t *timer = oper->timer;
|
||||||
|
ESP_RETURN_ON_FALSE(timer, ESP_ERR_INVALID_STATE, TAG, "no timer is connected to the operator");
|
||||||
|
bool invalid_utep = (timer->count_mode == MCPWM_TIMER_COUNT_MODE_UP_DOWN) &&
|
||||||
|
(ev_act.direction == MCPWM_TIMER_DIRECTION_UP) &&
|
||||||
|
(ev_act.event == MCPWM_TIMER_EVENT_FULL);
|
||||||
|
bool invalid_dtez = (timer->count_mode == MCPWM_TIMER_COUNT_MODE_UP_DOWN) &&
|
||||||
|
(ev_act.direction == MCPWM_TIMER_DIRECTION_DOWN) &&
|
||||||
|
(ev_act.event == MCPWM_TIMER_EVENT_EMPTY);
|
||||||
|
if (invalid_utep || invalid_dtez) {
|
||||||
|
ESP_RETURN_ON_FALSE(false, ESP_ERR_INVALID_ARG, TAG, "UTEP and DTEZ can't be reached under MCPWM_TIMER_COUNT_MODE_UP_DOWN mode");
|
||||||
|
}
|
||||||
|
mcpwm_ll_generator_set_action_on_timer_event(group->hal.dev, oper->oper_id, gen->gen_id,
|
||||||
|
ev_act.direction, ev_act.event, ev_act.action);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t mcpwm_generator_set_actions_on_timer_event(mcpwm_gen_handle_t gen, mcpwm_gen_timer_event_action_t ev_act, ...)
|
esp_err_t mcpwm_generator_set_actions_on_timer_event(mcpwm_gen_handle_t gen, mcpwm_gen_timer_event_action_t ev_act, ...)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
@ -179,6 +201,17 @@ esp_err_t mcpwm_generator_set_actions_on_timer_event(mcpwm_gen_handle_t gen, mcp
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t mcpwm_generator_set_action_on_compare_event(mcpwm_gen_handle_t gen, mcpwm_gen_compare_event_action_t ev_act)
|
||||||
|
{
|
||||||
|
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
|
ESP_RETURN_ON_FALSE(ev_act.comparator, ESP_ERR_INVALID_ARG, TAG, "invalid comparator");
|
||||||
|
mcpwm_oper_t *oper = gen->oper;
|
||||||
|
mcpwm_group_t *group = oper->group;
|
||||||
|
mcpwm_ll_generator_set_action_on_compare_event(group->hal.dev, oper->oper_id, gen->gen_id,
|
||||||
|
ev_act.direction, ev_act.comparator->cmpr_id, ev_act.action);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t mcpwm_generator_set_actions_on_compare_event(mcpwm_gen_handle_t gen, mcpwm_gen_compare_event_action_t ev_act, ...)
|
esp_err_t mcpwm_generator_set_actions_on_compare_event(mcpwm_gen_handle_t gen, mcpwm_gen_compare_event_action_t ev_act, ...)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
@ -196,6 +229,17 @@ esp_err_t mcpwm_generator_set_actions_on_compare_event(mcpwm_gen_handle_t gen, m
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t mcpwm_generator_set_action_on_brake_event(mcpwm_gen_handle_t gen, mcpwm_gen_brake_event_action_t ev_act)
|
||||||
|
{
|
||||||
|
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
|
ESP_RETURN_ON_FALSE(ev_act.brake_mode != MCPWM_OPER_BRAKE_MODE_INVALID, ESP_ERR_INVALID_ARG, TAG, "invalid brake mode");
|
||||||
|
mcpwm_oper_t *oper = gen->oper;
|
||||||
|
mcpwm_group_t *group = oper->group;
|
||||||
|
mcpwm_ll_generator_set_action_on_brake_event(group->hal.dev, oper->oper_id, gen->gen_id,
|
||||||
|
ev_act.direction, ev_act.brake_mode, ev_act.action);
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t mcpwm_generator_set_actions_on_brake_event(mcpwm_gen_handle_t gen, mcpwm_gen_brake_event_action_t ev_act, ...)
|
esp_err_t mcpwm_generator_set_actions_on_brake_event(mcpwm_gen_handle_t gen, mcpwm_gen_brake_event_action_t ev_act, ...)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
ESP_RETURN_ON_FALSE(gen, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -117,9 +117,8 @@ TEST_CASE("mcpwm_generator_force_level_recovery", "[mcpwm]")
|
|||||||
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_force_level(generator, 0, false));
|
TEST_ESP_OK(mcpwm_generator_set_force_level(generator, 0, false));
|
||||||
TEST_ASSERT_EQUAL(0, gpio_get_level(gen_gpio));
|
TEST_ASSERT_EQUAL(0, gpio_get_level(gen_gpio));
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(generator,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(generator,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
// generator should output high level on tez event, the previous force level should disappear
|
// generator should output high level on tez event, the previous force level should disappear
|
||||||
TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP));
|
TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP));
|
||||||
vTaskDelay(pdMS_TO_TICKS(200));
|
vTaskDelay(pdMS_TO_TICKS(200));
|
||||||
@ -129,9 +128,8 @@ TEST_CASE("mcpwm_generator_force_level_recovery", "[mcpwm]")
|
|||||||
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_force_level(generator, 1, false));
|
TEST_ESP_OK(mcpwm_generator_set_force_level(generator, 1, false));
|
||||||
TEST_ASSERT_EQUAL(1, gpio_get_level(gen_gpio));
|
TEST_ASSERT_EQUAL(1, gpio_get_level(gen_gpio));
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(generator,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(generator,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
// generator should output low level on tez event, the previous force level should disappear
|
// generator should output low level on tez event, the previous force level should disappear
|
||||||
TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP));
|
TEST_ESP_OK(mcpwm_timer_start_stop(timer, MCPWM_TIMER_START_NO_STOP));
|
||||||
vTaskDelay(pdMS_TO_TICKS(200));
|
vTaskDelay(pdMS_TO_TICKS(200));
|
||||||
@ -270,34 +268,26 @@ static void mcpwm_gen_action_test_template(uint32_t timer_resolution, uint32_t p
|
|||||||
|
|
||||||
static void single_edge_active_high(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void single_edge_active_high(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(genb,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void single_edge_active_low(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void single_edge_active_low(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH),
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW)));
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(genb,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pulse_placement(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void pulse_placement(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
@ -442,12 +432,10 @@ static void mcpwm_deadtime_test_template(uint32_t timer_resolution, uint32_t per
|
|||||||
|
|
||||||
static void ahc_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void ahc_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ahc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void ahc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -465,12 +453,10 @@ static void ahc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
|||||||
|
|
||||||
static void alc_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void alc_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void alc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void alc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -489,12 +475,10 @@ static void alc_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
|||||||
|
|
||||||
static void ah_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void ah_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ah_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void ah_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -511,12 +495,10 @@ static void ah_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
|||||||
|
|
||||||
static void al_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void al_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void al_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void al_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -534,18 +516,14 @@ static void al_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
|||||||
|
|
||||||
static void reda_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void reda_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(genb,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reda_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void reda_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -563,18 +541,14 @@ static void reda_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t
|
|||||||
|
|
||||||
static void fedb_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void fedb_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(genb,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void fedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -593,18 +567,14 @@ static void fedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t
|
|||||||
|
|
||||||
static void redfedb_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void redfedb_only_set_generator_actions(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gena,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(genb,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void redfedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void redfedb_only_set_dead_time(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -684,12 +654,10 @@ TEST_CASE("mcpwm_duty_empty_full", "[mcpwm]")
|
|||||||
TEST_ESP_OK(mcpwm_new_generator(oper, &gen_config, &gen));
|
TEST_ESP_OK(mcpwm_new_generator(oper, &gen_config, &gen));
|
||||||
|
|
||||||
printf("set generator actions on timer and compare events\r\n");
|
printf("set generator actions on timer and compare events\r\n");
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gen,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gen,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
printf("start timer\r\n");
|
printf("start timer\r\n");
|
||||||
TEST_ESP_OK(mcpwm_timer_enable(timer));
|
TEST_ESP_OK(mcpwm_timer_enable(timer));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -144,12 +144,10 @@ TEST_CASE("mcpwm_comparator_iram_safe", "[mcpwm]")
|
|||||||
TEST_ESP_OK(mcpwm_new_generator(oper, &gen_config, &gen));
|
TEST_ESP_OK(mcpwm_new_generator(oper, &gen_config, &gen));
|
||||||
|
|
||||||
printf("set generator actions on timer and compare events\r\n");
|
printf("set generator actions on timer and compare events\r\n");
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_compare_event(gen,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_compare_event(gen,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
printf("register compare event callback\r\n");
|
printf("register compare event callback\r\n");
|
||||||
mcpwm_comparator_event_callbacks_t cbs = {
|
mcpwm_comparator_event_callbacks_t cbs = {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -83,9 +83,8 @@ TEST_CASE("mcpwm_operator_carrier", "[mcpwm]")
|
|||||||
mcpwm_gen_handle_t generator = NULL;
|
mcpwm_gen_handle_t generator = NULL;
|
||||||
TEST_ESP_OK(mcpwm_new_generator(oper, &generator_config, &generator));
|
TEST_ESP_OK(mcpwm_new_generator(oper, &generator_config, &generator));
|
||||||
|
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(generator,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(generator,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_TOGGLE),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_TOGGLE)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
printf("add carrier to PWM wave\r\n");
|
printf("add carrier to PWM wave\r\n");
|
||||||
mcpwm_carrier_config_t carrier_config = {
|
mcpwm_carrier_config_t carrier_config = {
|
||||||
@ -202,20 +201,16 @@ TEST_CASE("mcpwm_operator_brake_on_gpio_fault", "[mcpwm]")
|
|||||||
TEST_ESP_OK(mcpwm_new_generator(oper, &generator_config, &gen_b));
|
TEST_ESP_OK(mcpwm_new_generator(oper, &generator_config, &gen_b));
|
||||||
|
|
||||||
printf("set generator actions on timer event\r\n");
|
printf("set generator actions on timer event\r\n");
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen_a,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_a,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_b,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen_b,
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
printf("set generator actions on brake event\r\n");
|
printf("set generator actions on brake event\r\n");
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_brake_event(gen_a,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_a,
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_b,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_brake_event(gen_b,
|
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH),
|
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
printf("enable and start timer\r\n");
|
printf("enable and start timer\r\n");
|
||||||
TEST_ESP_OK(mcpwm_timer_enable(timer));
|
TEST_ESP_OK(mcpwm_timer_enable(timer));
|
||||||
@ -312,20 +307,16 @@ TEST_CASE("mcpwm_operator_brake_on_soft_fault", "[mcpwm]")
|
|||||||
TEST_ESP_OK(mcpwm_new_generator(oper, &generator_config, &gen_b));
|
TEST_ESP_OK(mcpwm_new_generator(oper, &generator_config, &gen_b));
|
||||||
|
|
||||||
printf("set generator actions on timer event\r\n");
|
printf("set generator actions on timer event\r\n");
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen_a,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_a,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_timer_event(gen_b,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_timer_event(gen_b,
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
printf("set generator actions on brake event\r\n");
|
printf("set generator actions on brake event\r\n");
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_brake_event(gen_a,
|
TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_a,
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION_END()));
|
TEST_ESP_OK(mcpwm_generator_set_action_on_brake_event(gen_b,
|
||||||
TEST_ESP_OK(mcpwm_generator_set_actions_on_brake_event(gen_b,
|
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_OST, MCPWM_GEN_ACTION_HIGH),
|
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
printf("enable and start timer\r\n");
|
printf("enable and start timer\r\n");
|
||||||
TEST_ESP_OK(mcpwm_timer_enable(timer));
|
TEST_ESP_OK(mcpwm_timer_enable(timer));
|
||||||
|
@ -261,6 +261,8 @@ There's a helper macro :c:macro:`MCPWM_GEN_TIMER_EVENT_ACTION` to simplify the c
|
|||||||
|
|
||||||
Please note, the argument list of :cpp:func:`mcpwm_generator_set_actions_on_timer_event` **must** be terminated by :c:macro:`MCPWM_GEN_TIMER_EVENT_ACTION_END`.
|
Please note, the argument list of :cpp:func:`mcpwm_generator_set_actions_on_timer_event` **must** be terminated by :c:macro:`MCPWM_GEN_TIMER_EVENT_ACTION_END`.
|
||||||
|
|
||||||
|
You can also set the timer action one by one by calling :cpp:func:`mcpwm_generator_set_action_on_timer_event` without varargs.
|
||||||
|
|
||||||
Set Generator Action on Compare Event
|
Set Generator Action on Compare Event
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
@ -274,6 +276,8 @@ There's a helper macro :c:macro:`MCPWM_GEN_COMPARE_EVENT_ACTION` to simplify the
|
|||||||
|
|
||||||
Please note, the argument list of :cpp:func:`mcpwm_generator_set_actions_on_compare_event` **must** be terminated by :c:macro:`MCPWM_GEN_COMPARE_EVENT_ACTION_END`.
|
Please note, the argument list of :cpp:func:`mcpwm_generator_set_actions_on_compare_event` **must** be terminated by :c:macro:`MCPWM_GEN_COMPARE_EVENT_ACTION_END`.
|
||||||
|
|
||||||
|
You can also set the compare action one by one by calling :cpp:func:`mcpwm_generator_set_action_on_compare_event` without varargs.
|
||||||
|
|
||||||
Classical PWM Waveforms and Generator Configurations
|
Classical PWM Waveforms and Generator Configurations
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
@ -293,18 +297,14 @@ Asymmetric Single Edge Active High
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(genb,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Asymmetric Single Edge Active Low
|
Asymmetric Single Edge Active Low
|
||||||
@ -316,18 +316,14 @@ Asymmetric Single Edge Active Low
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_HIGH),
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW)));
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(genb,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_FULL, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_HIGH),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Asymmetric Pulse Placement
|
Asymmetric Pulse Placement
|
||||||
@ -436,12 +432,10 @@ Active High Complementary
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -466,12 +460,10 @@ Active Low Complementary
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -497,12 +489,10 @@ Active High
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -526,12 +516,10 @@ Active Low
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -556,18 +544,14 @@ Rising Delay on PWMA, Bypass deadtime for PWMB
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(genb,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -592,18 +576,14 @@ Falling Delay on PWMB, Bypass deadtime for PWMA
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(genb,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -629,18 +609,14 @@ Rising and Falling Delay on PWMB, Bypass deadtime for PWMA
|
|||||||
|
|
||||||
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
static void gen_action_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb, mcpwm_cmpr_handle_t cmpa, mcpwm_cmpr_handle_t cmpb)
|
||||||
{
|
{
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(gena,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(gena,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(gena,
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(gena,
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpa, MCPWM_GEN_ACTION_LOW),
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(genb,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(genb,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(genb,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(genb,
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, cmpb, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
static void dead_time_config(mcpwm_gen_handle_t gena, mcpwm_gen_handle_t genb)
|
||||||
@ -699,6 +675,8 @@ There's a helper macro :c:macro:`MCPWM_GEN_BRAKE_EVENT_ACTION` to simplify the c
|
|||||||
|
|
||||||
Please note, the argument list of :cpp:func:`mcpwm_generator_set_actions_on_brake_event` **must** be terminated by :c:macro:`MCPWM_GEN_BRAKE_EVENT_ACTION_END`.
|
Please note, the argument list of :cpp:func:`mcpwm_generator_set_actions_on_brake_event` **must** be terminated by :c:macro:`MCPWM_GEN_BRAKE_EVENT_ACTION_END`.
|
||||||
|
|
||||||
|
You can also set the brake action one by one by calling :cpp:func:`mcpwm_generator_set_action_on_brake_event` without varargs.
|
||||||
|
|
||||||
Register Fault Event Callbacks
|
Register Fault Event Callbacks
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -256,18 +256,14 @@ void app_main(void)
|
|||||||
|
|
||||||
ESP_LOGI(TAG, "Set generator actions");
|
ESP_LOGI(TAG, "Set generator actions");
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparators[i], MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparators[i], MCPWM_GEN_ACTION_LOW),
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_brake_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_LOW)));
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_brake_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_brake_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION_END()));
|
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_brake_event(generators[i][BLDC_MCPWM_GEN_INDEX_HIGH],
|
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_OPER_BRAKE_MODE_CBC, MCPWM_GEN_ACTION_LOW),
|
|
||||||
MCPWM_GEN_BRAKE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Setup deadtime");
|
ESP_LOGI(TAG, "Setup deadtime");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -66,13 +66,11 @@ void app_main(void)
|
|||||||
|
|
||||||
ESP_LOGI(TAG, "Set generator action on timer and compare event");
|
ESP_LOGI(TAG, "Set generator action on timer and compare event");
|
||||||
// go high on counter empty
|
// go high on counter empty
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(generator,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(generator,
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
|
||||||
// go low on compare threshold
|
// go low on compare threshold
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(generator,
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(generator,
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparator, MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Enable and start timer");
|
ESP_LOGI(TAG, "Enable and start timer");
|
||||||
ESP_ERROR_CHECK(mcpwm_timer_enable(timer));
|
ESP_ERROR_CHECK(mcpwm_timer_enable(timer));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
@ -175,14 +175,12 @@ void app_main(void)
|
|||||||
|
|
||||||
ESP_LOGI(TAG, "Set generator actions on timer and compare event");
|
ESP_LOGI(TAG, "Set generator actions on timer and compare event");
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_timer_event(generators[i],
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_timer_event(generators[i],
|
||||||
// when the timer value is zero, and is counting up, set output to high
|
// when the timer value is zero, and is counting up, set output to high
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH),
|
MCPWM_GEN_TIMER_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, MCPWM_TIMER_EVENT_EMPTY, MCPWM_GEN_ACTION_HIGH)));
|
||||||
MCPWM_GEN_TIMER_EVENT_ACTION_END()));
|
ESP_ERROR_CHECK(mcpwm_generator_set_action_on_compare_event(generators[i],
|
||||||
ESP_ERROR_CHECK(mcpwm_generator_set_actions_on_compare_event(generators[i],
|
|
||||||
// when compare event happens, and timer is counting up, set output to low
|
// when compare event happens, and timer is counting up, set output to low
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparators[i], MCPWM_GEN_ACTION_LOW),
|
MCPWM_GEN_COMPARE_EVENT_ACTION(MCPWM_TIMER_DIRECTION_UP, comparators[i], MCPWM_GEN_ACTION_LOW)));
|
||||||
MCPWM_GEN_COMPARE_EVENT_ACTION_END()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGI(TAG, "Start timers one by one, so they are not synced");
|
ESP_LOGI(TAG, "Start timers one by one, so they are not synced");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user