Provide an mcp 2210 set gpio input helper function that sets a pin to gpio and input.
diff --git a/mcp2210.c b/mcp2210.c
index e505c18..aef94bd 100644
--- a/mcp2210.c
+++ b/mcp2210.c
@@ -184,6 +184,16 @@ bool mcp2210_set_gpio_output(struct cgpu_info *cgpu, int pin, int val)
return true;
}
+/* Set one pin to gpio input */
+bool mcp2210_set_gpio_input(struct cgpu_info *cgpu, int pin)
+{
+ if (!mcp2210_set_gpio_pindes(cgpu, pin, MCP2210_PIN_GPIO))
+ return false;
+ if (!mcp2210_set_gpio_pindir(cgpu, pin, MCP2210_GPIO_INPUT))
+ return false;
+ return true;
+}
+
/* Get one pindir */
bool mcp2210_get_gpio_pindir(struct cgpu_info *cgpu, int pin, int *dir)
{
diff --git a/mcp2210.h b/mcp2210.h
index a0ad2f0..2dc75a6 100644
--- a/mcp2210.h
+++ b/mcp2210.h
@@ -51,6 +51,7 @@ bool mcp2210_set_gpio_pindes(struct cgpu_info *cgpu, int pin, int des);
bool mcp2210_get_gpio_pinval(struct cgpu_info *cgpu, int pin, int *val);
bool mcp2210_set_gpio_pinval(struct cgpu_info *cgpu, int pin, int val);
bool mcp2210_set_gpio_output(struct cgpu_info *cgpu, int pin, int val);
+bool mcp2210_set_gpio_input(struct cgpu_info *cgpu, int pin);
bool mcp2210_get_gpio_pindir(struct cgpu_info *cgpu, int pin, int *dir);
bool mcp2210_set_gpio_pindir(struct cgpu_info *cgpu, int pin, int dir);
bool mcp2210_spi_cancel(struct cgpu_info *cgpu);