mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
27 lines
448 B
C
27 lines
448 B
C
#include "ESP32_common.h"
|
|
#include "dataStrs.h"
|
|
|
|
int getGpioPin(char *pin)
|
|
{
|
|
int num = -1;
|
|
sscanf(pin, "P%d\n", &num);
|
|
return num;
|
|
}
|
|
|
|
uint32_t getPinMode(char *mode)
|
|
{
|
|
if (strEqu(mode, "out"))
|
|
{
|
|
return GPIO_MODE_OUTPUT;
|
|
}
|
|
else if (strEqu(mode, "in"))
|
|
{
|
|
return GPIO_MODE_INPUT;
|
|
}
|
|
else if (strEqu(mode, "out_od"))
|
|
{
|
|
return GPIO_MODE_OUTPUT_OD;
|
|
}
|
|
|
|
return GPIO_MODE_DISABLE;
|
|
} |