kendryte / kendryte-standalone-sdk

Standalone SDK for kendryte K210
https://kendryte.com
Apache License 2.0
440 stars 161 forks source link

Can't assign GPIO0 to pin 0 #74

Closed GitJer closed 5 years ago

GitJer commented 5 years ago

When I try to assign FUNC_GPIO0 to pin 0, an error is raised in gpio.h line 32. Code:

#include <gpio.h>
#include <fpioa.h>

int main() {
    fpioa_set_function(0 , FUNC_GPIO0);
    gpio_set_drive_mode(0 , GPIO_DM_OUTPUT);
    while (1) {
        gpio_set_pin(0, GPIO_PV_HIGH);
        gpio_set_pin(0, GPIO_PV_LOW);
    }
}

Error: ...kendryte-standalone-sdk/lib/drivers/gpio.c:32) io_number > 0

The code that raises the error: configASSERT(io_number > 0);

If I change that line into: configASSERT(io_number >= 0); everything works fine.

Is there a reason why pin 0 cannot be assigned the FUNC_GPIO0?