diff options
-rw-r--r-- | lib/pbdrv/pb.h | 2 | ||||
-rw-r--r-- | puzzle/smoketest/main.cpp | 17 | ||||
-rw-r--r-- | puzzle/smoketest/mod.c | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/lib/pbdrv/pb.h b/lib/pbdrv/pb.h index cef04d8..c73f8d9 100644 --- a/lib/pbdrv/pb.h +++ b/lib/pbdrv/pb.h @@ -37,6 +37,8 @@ #define PB_ADDR_MOD_VAULT 0x24 //! Automation puzzle module I2C address #define BUSADDR_MOD_AUTOMATION 0x25 +//! Smoketest puzzle module I2C address +#define PB_ADDR_MOD_SMOKETEST 0x26 //! Dummy puzzle module I2C address #define PB_ADDR_MOD_DUMMY 0x69 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; |