Set all pin designations and directions in one call for nanofury and don't bother storing their values in the info struct.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/driver-bitfury.c b/driver-bitfury.c
index ee45f97..6d0f790 100644
--- a/driver-bitfury.c
+++ b/driver-bitfury.c
@@ -280,11 +280,13 @@ out_close:
static void nf1_close(struct cgpu_info *bitfury)
{
+ struct gpio_pin gp;
int i;
/* Set all pins to input mode, ignoring return code */
for (i = 0; i < 9; i++)
- mcp2210_set_gpio_input(bitfury, i);
+ gp.pin[i] = MCP2210_GPIO_INPUT;
+ mcp2210_set_gpio_pindirs(bitfury, &gp);
}
static void spi_clear_buf(struct bitfury_info *info)
@@ -486,20 +488,20 @@ static bool nf1_detect_one(struct cgpu_info *bitfury, struct bitfury_info *info)
{
char buf[MCP2210_BUFFER_LENGTH];
unsigned int length;
+ struct gpio_pin gp;
bool ret = false;
int i, val;
/* Set all pins to GPIO mode */
for (i = 0; i < 9; i++)
- info->mcp.designation.pin[i] = MCP2210_PIN_GPIO;
- if (!mcp2210_set_gpio_pin_designations(bitfury, &info->mcp.designation))
+ gp.pin[i] = MCP2210_PIN_GPIO;
+ if (!mcp2210_set_gpio_pin_designations(bitfury, &gp))
goto out;
/* Set all pins to input mode */
- for (i = 0; i < 9; i++) {
- if (!mcp2210_set_gpio_input(bitfury, i))
- goto out;
- }
+ for (i = 0; i < 9; i++)
+ gp.pin[i] = MCP2210_GPIO_INPUT;
+ if (!mcp2210_set_gpio_pindirs(bitfury, &gp))
/* Set LED and PWR pins to output and high */
if (!mcp2210_set_gpio_output(bitfury, NF1_PIN_LED, MCP2210_GPIO_PIN_HIGH))
diff --git a/driver-bitfury.h b/driver-bitfury.h
index 55eb32e..c5cb9ba 100644
--- a/driver-bitfury.h
+++ b/driver-bitfury.h
@@ -32,9 +32,6 @@ extern int opt_bxf_temp_target;
#define NF1_SPIBUF_SIZE 16384
struct mcp_settings {
- struct gpio_pin designation;
- struct gpio_pin value;
- struct gpio_pin direction;
unsigned int bitrate, icsv, acsv, cstdd, ldbtcsd, sdbd, bpst, spimode;
};