Skip to content

A Hardware Hacking Tool with Web-Based CLI That Speaks Every Protocol

add end method for two wire

Geo566e2561a5c8
diff --git a/src/Services/TwoWireService.cpp b/src/Services/TwoWireService.cpp
index 454c8624..5e7d0135 100644
--- a/src/Services/TwoWireService.cpp
+++ b/src/Services/TwoWireService.cpp
@@ -19,6 +19,20 @@ void TwoWireService::configure(uint8_t clk, uint8_t io, uint8_t rst) {
gpio_set_level((gpio_num_t)ioPin, 1); // release
}
+void TwoWireService::end() {
+ gpio_set_level((gpio_num_t)clkPin, 0);
+ gpio_set_level((gpio_num_t)rstPin, 0);
+
+ gpio_set_direction((gpio_num_t)clkPin, GPIO_MODE_INPUT);
+ gpio_set_pull_mode((gpio_num_t)clkPin, GPIO_FLOATING);
+
+ gpio_set_direction((gpio_num_t)rstPin, GPIO_MODE_INPUT);
+ gpio_set_pull_mode((gpio_num_t)rstPin, GPIO_FLOATING);
+
+ gpio_set_direction((gpio_num_t)ioPin, GPIO_MODE_INPUT);
+ gpio_set_pull_mode((gpio_num_t)ioPin, GPIO_FLOATING);
+}
+
void TwoWireService::setRST(bool level) {
gpio_set_level((gpio_num_t)rstPin, level ? 1 : 0);
}
diff --git a/src/Services/TwoWireService.h b/src/Services/TwoWireService.h
index 5cc30c5a..092b82c5 100644
--- a/src/Services/TwoWireService.h
+++ b/src/Services/TwoWireService.h
@@ -6,6 +6,7 @@
class TwoWireService {
public:
void configure(uint8_t clkPin, uint8_t ioPin, uint8_t rstPin);
+ void end();
void setRST(bool level);
void setCLK(bool level);