static void read_continuous(t_hydra_console *con, uint16_t *gpio, int period) { int port, pin; bool result; cprintf(con, "Interrupt by pressing user button.\r\n"); for (port = 0; port < 3; port++) { for (pin = 0; pin < 16; pin++) { if (gpio[port] & (1 << pin)) cprintf(con, "P%c%d%s ", port + 'A', pin, pin < 10 ? " " : ""); } } cprint(con, "\r\n", 2); while (!USER_BUTTON) { for (port = 0; port < 3; port++) { for (pin = 0; pin < 16; pin++) { if (!(gpio[port] & (1 << pin))) continue; result = bsp_gpio_pin_read(ports[port], pin); cprintf(con, "%d ", result); } } cprint(con, "\r\n", 2); chThdSleepMilliseconds(period); } }
uint8_t threewire_read_bit_clock(t_hydra_console *con) { mode_config_proto_t* proto = &con->mode->proto; uint8_t bit; threewire_clk_high(con); bit = bsp_gpio_pin_read(BSP_GPIO_PORTB, proto->config.rawwire.sdi_pin); threewire_clk_low(con); return bit; }
static void read_once(t_hydra_console *con, uint16_t *gpio) { int port, pin; bool result; for (port = 0; port < 3; port++) { for (pin = 0; pin < 16; pin++) { if (!(gpio[port] & (1 << pin))) continue; result = bsp_gpio_pin_read(ports[port], pin); cprintf(con, "P%c%d\t%d\r\n", port + 'A', pin, result); } } }
uint8_t threewire_read_bit(t_hydra_console *con) { mode_config_proto_t* proto = &con->mode->proto; return bsp_gpio_pin_read(BSP_GPIO_PORTB, proto->config.rawwire.sdi_pin); }