kopia lustrzana https://github.com/espressif/esp-idf
pcnt/driver: Add module reset before enabling
rodzic
5c560e0cd1
commit
a418b603d0
|
@ -58,6 +58,11 @@ esp_err_t pcnt_unit_config(const pcnt_config_t *pcnt_config)
|
|||
PCNT_CHECK((pcnt_config->pos_mode < PCNT_COUNT_MAX) && (pcnt_config->neg_mode < PCNT_COUNT_MAX), PCNT_COUNT_MODE_ERR_STR, ESP_ERR_INVALID_ARG);
|
||||
PCNT_CHECK((pcnt_config->hctrl_mode < PCNT_MODE_MAX) && (pcnt_config->lctrl_mode < PCNT_MODE_MAX), PCNT_CTRL_MODE_ERR_STR, ESP_ERR_INVALID_ARG);
|
||||
/*Enalbe hardware module*/
|
||||
static bool pcnt_enable = false;
|
||||
if (pcnt_enable == false) {
|
||||
periph_module_reset(PERIPH_PCNT_MODULE);
|
||||
pcnt_enable = true;
|
||||
}
|
||||
periph_module_enable(PERIPH_PCNT_MODULE);
|
||||
/*Set counter range*/
|
||||
pcnt_set_event_value(unit, PCNT_EVT_H_LIM, pcnt_config->counter_h_lim);
|
||||
|
|
Ładowanie…
Reference in New Issue