pikapython/package/ESP32/ESP32_common.c

27 lines
448 B
C
Raw Normal View History

2022-06-27 15:36:12 +08:00
#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;
}