Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rmtDeinit missing? #2585

Closed
yanzixiang opened this issue Mar 15, 2019 · 2 comments
Closed

rmtDeinit missing? #2585

yanzixiang opened this issue Mar 15, 2019 · 2 comments

Comments

@yanzixiang
Copy link

yanzixiang commented Mar 15, 2019

rmtDeinit is defined in esp32-hal-rmt.c,
but it is not defined in esp32-hal-rmt.h,
can someone explain the reason ?

bool rmtDeinit(rmt_obj_t *rmt)
{
    if (!rmt) {
        return false;
    }

    // sanity check
    if (rmt != &(g_rmt_objects[rmt->channel])) {
        return false;
    }

    size_t from = rmt->channel;
    size_t to = rmt->buffers + rmt->channel;
    size_t i;

#if !CONFIG_DISABLE_HAL_LOCKS
    if(g_rmt_objlocks[from] != NULL) {
        vSemaphoreDelete(g_rmt_objlocks[from]);
    }
#endif

    if (g_rmt_objects[from].data_alloc) {
        free(g_rmt_objects[from].data_ptr);
    }
    
    for (i = from; i < to; i++) {
        g_rmt_objects[i].allocated = false;
    }

    g_rmt_objects[from].channel = 0;
    g_rmt_objects[from].buffers = 0;

    return true;
}

how to use the function
rmt_rx_start() and rmt_rx_stop()
at here
https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/rmt.html?highlight=rmt#

@lbernstone
Copy link
Contributor

lbernstone commented Mar 15, 2019

The arduino and esp-idf RMT drivers should probably not be used interchangeably, as there may be some state information that will not cross over. Choose one, and stick with it. The arduino version is recent and may still have some issues (eg, a missing rmtDeinit). The esp-idf version has examples linked in the docs location you posted.

@atanisoft
Copy link
Collaborator

also note that the arduino driver has a few debug statements in it that will alter the state of a few pins at runtime!!!

me-no-dev pushed a commit that referenced this issue Apr 9, 2019
* Added rmtDeinit to header. Fixes #2585

* oops.  missing ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants