/* require "wmgpio" ret=wmgpio.init(PORTB, 8, GPIO_OUT, FLOATING) if ret==0 then wmgpio.out(PORTB, 8, HIGH) wmgpio.out(PORTB, 8, LOW) else print("GPIO init failed") end val=wmgpio.in(PORTB, 8) // read io print(val)  */
static int get_pin_index(char *port, int offset)
/* require "wmgpio" ret=wmgpio.init(PORTB, 8, GPIO_OUT, FLOATING) if ret==0 then wmgpio.out(PORTB, 8, HIGH) wmgpio.out(PORTB, 8, LOW) else print("GPIO init failed") end val=wmgpio.in(PORTB, 8) // read io print(val)  */
static int get_pin_index(char *port, int offset)
{
	int pin_index = 0;
	if (strstr(port, "PA") != NULL) {
		pin_index = 0;
	} else if (strstr(port, "PB") != NULL) {
		pin_index = 16;
	} else {
		return -1;
	}
	return pin_index+offset;
}