diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-25 12:45:29 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-25 12:45:29 +0200 |
commit | cf55157e92ff82b96527bbb474b3a7df6abf6ac1 (patch) | |
tree | 87c55036cb2ed8a27016835051cb035fc4b8163a /puzzle/smoketest | |
parent | be1b5f0d35544582be1f4fa42aed303184ab27a7 (diff) |
fix smoketest
Diffstat (limited to 'puzzle/smoketest')
-rw-r--r-- | puzzle/smoketest/main.cpp | 17 | ||||
-rw-r--r-- | puzzle/smoketest/mod.c | 4 |
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; |