Program Listing for File Relay8Module.hpp

Return to documentation for file (doc/include/Relay8Module.hpp)

/****************************************************************************
 * @defgroup PackageName Modules
 * @file Relay8Module.hpp
 * @brief
 * @author info@pickdata.net
 ***************************************************************************/
#ifndef RELAY8_MODULE_HPP_
#define RELAY8_MODULE_HPP_

#include "Module.hpp"
#include "Relay8Module.h"

// Forward declaration
class RelayFunctions;

class Relay8Module : public Module {
protected:
    RelayFunctions* relays;

    EmodRet initFunctions();

public:
    // Constants
    static constexpr uint8_t kRelay1 = Relay8Module_RELAY1;
    static constexpr uint8_t kRelay2 = Relay8Module_RELAY2;
    static constexpr uint8_t kRelay3 = Relay8Module_RELAY3;
    static constexpr uint8_t kRelay4 = Relay8Module_RELAY4;
    static constexpr uint8_t kRelay5 = Relay8Module_RELAY5;
    static constexpr uint8_t kRelay6 = Relay8Module_RELAY6;
    static constexpr uint8_t kRelay7 = Relay8Module_RELAY7;
    static constexpr uint8_t kRelay8 = Relay8Module_RELAY8;
    static constexpr uint8_t kRelayAll = Relay8Module_ALL_RELAY;
    static constexpr uint8_t kNumberOfRelays = Relay8Module_NUMBER_OF_RELAYS;

    // Constructor, destructor and init methods
    Relay8Module();
    ~Relay8Module();

    EmodRet init(const uint8_t variant = 1);

    // Relay methods

    EmodRet configPulseWidth(const uint8_t relay_mask, const uint32_t width_ms);

    EmodRet configAllPulseWidth(const uint32_t width_ms);

    EmodRet activate(const uint8_t relay_mask);

    EmodRet deactivate(const uint8_t relay_mask);

    EmodRet activateAll();

    EmodRet deactivateAll();

    EmodRet getRelayStatus(const uint8_t relay_mask, uint8_t* status);

    EmodRet getAllRelayStatus(uint8_t* status);
};

#endif  // RELAY8_MODULE_HPP_