aboutsummaryrefslogtreecommitdiff
path: root/puzzle/smoketest
diff options
context:
space:
mode:
Diffstat (limited to 'puzzle/smoketest')
-rw-r--r--puzzle/smoketest/main.cpp17
-rw-r--r--puzzle/smoketest/mod.c4
2 files changed, 11 insertions, 10 deletions
diff --git a/puzzle/smoketest/main.cpp b/puzzle/smoketest/main.cpp
index dc15e5f..6b4d7d0 100644
--- a/puzzle/smoketest/main.cpp
+++ b/puzzle/smoketest/main.cpp
@@ -3,15 +3,10 @@
#include "lib/pbdrv/pb-mod.h"
#define EXTERNAL_LED_PIN 13
-#define BUTTON_PIN 10 // Define the pin where the external button is connected
+#define BUTTON_PIN 10
pb_global_state_t state = PB_GS_NOINIT;
-void setup() {
- pinMode(EXTERNAL_LED_PIN, OUTPUT);
- pinMode(BUTTON_PIN, INPUT_PULLUP);
-}
-
pb_global_state_t pb_hook_mod_state_read() {
return state;
}
@@ -20,9 +15,15 @@ void pb_hook_mod_state_write(pb_global_state_t _state) {
state = _state;
}
+void setup() {
+ pinMode(EXTERNAL_LED_PIN, OUTPUT);
+ pinMode(BUTTON_PIN, INPUT_PULLUP);
+}
+
void loop() {
digitalWrite(EXTERNAL_LED_PIN, state == PB_GS_PLAYING);
- if (!digitalRead(BUTTON_PIN)) return;
- state = PB_GS_SOLVED;
+ if (!digitalRead(BUTTON_PIN)) // button is inverted
+ state = PB_GS_SOLVED;
}
+
diff --git a/puzzle/smoketest/mod.c b/puzzle/smoketest/mod.c
index bae8a3d..a1e2843 100644
--- a/puzzle/smoketest/mod.c
+++ b/puzzle/smoketest/mod.c
@@ -1,6 +1,6 @@
#include "pb.h"
#include "pb-mod.h"
-const char * PB_MOD_NAME = "vault";
-const i2c_addr_t PB_MOD_ADDR = PB_ADDR_MOD_VAULT;
+const char * PB_MOD_NAME = "smoketest";
+const i2c_addr_t PB_MOD_ADDR = PB_ADDR_MOD_SMOKETEST;