diff options
Diffstat (limited to 'Mussel/Mussel.h')
-rw-r--r-- | Mussel/Mussel.h | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/Mussel/Mussel.h b/Mussel/Mussel.h deleted file mode 100644 index ba063c2..0000000 --- a/Mussel/Mussel.h +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Amal Mazrah <mazrah@ruc.dk> -// SPDX-FileCopyrightText: 2025 Jonas Smedegaard <dr@jones.dk> -// SPDX-FileCopyrightText: 2025 Mennatullah Hatim Kassim <stud-mennatulla@ruc.dk> -// SPDX-FileCopyrightText: 2025 Noor Ahmad <noora@ruc.dk> -// SPDX-FileCopyrightText: 2025 Tanishka Suwalka <tanishkas@ruc.dk> -// SPDX-License-Identifier: GPL-3.0-or-later - -/// Mussel - a small library for Arduino to emulate a mussel biosensor -/// -/// @version 0.0.2 -/// @see <https://app.radicle.xyz/nodes/seed.radicle.garden/rad:z2tFBF4gN7ziG9oXtUytVQNYe3VhQ/tree/Mussel/README.md> -/// @see <https://moodle.ruc.dk/course/view.php?id=23504> - -#ifndef Mussel_h -#define Mussel_h -#include "Arduino.h" - -// seconds -#define MUSSEL_NORMAL_PACE 50U -#define MUSSEL_STRESS_PACE 10U -#define MUSSEL_VOTE_TIME_AHEAD 60000U // 1 minute -#define MUSSEL_VOTE_TIME_BEHIND 120000U // 2 minutes - -// milliseconds -#define MUSSEL_DEBOUNCE_DELAY 50U - -// Limited size NOW!! can be transformed into infinite array -#define STACK_SIZE 1000 - -struct Vote { - String id; - unsigned long timestamp; - int measure; -}; - -class Mussel { - public: - - // Default constructor - Mussel(const int attitude); - - // Constructor for attitudes using an input pin - Mussel(const int attitude, const uint8_t pin); - - // Constructor for attitudes using an input pin and a sensor type - Mussel( - const int attitude, - const uint8_t pin, - const uint8_t type); - - void begin(); - String desc(); - int read(); - String debug(); - bool push(String id, unsigned long timestamp, int measure); - void printStack(); - bool qualifyVote(Vote vote, unsigned long currentTime); - - private: - int _attitude; - int _pin; - bool _boolState; - byte _count; - unsigned long _time; -#ifdef DHT_H - DHT mussel_dht; -#endif - - // Array to store ID strings - String idStack[STACK_SIZE]; - unsigned long timeStack[STACK_SIZE]; - int measureStack[STACK_SIZE]; - - // Index of the top element in the stack, -1 means stack is empty - int top = -1; -}; - -#endif |