Initialisation depot
This commit is contained in:
59
ESP32/DCC-Bench/include/RelayController.h
Normal file
59
ESP32/DCC-Bench/include/RelayController.h
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @file RelayController.h
|
||||
* @brief Relay control for switching between 2-rail and 3-rail track configurations
|
||||
*
|
||||
* Controls a relay module to switch track wiring between:
|
||||
* - 2-rail mode: Standard DC/DCC operation
|
||||
* - 3-rail mode: Center rail + outer rails configuration
|
||||
*
|
||||
* @author Locomotive Test Bench Project
|
||||
* @date 2025
|
||||
*/
|
||||
|
||||
#ifndef RELAY_CONTROLLER_H
|
||||
#define RELAY_CONTROLLER_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// Pin definition for relay control
|
||||
#define RELAY_PIN 4 ///< Relay control pin (active HIGH)
|
||||
|
||||
/**
|
||||
* @class RelayController
|
||||
* @brief Controls relay for track configuration switching
|
||||
*
|
||||
* Simple relay control for switching between 2-rail and 3-rail modes.
|
||||
* Relay energized = 3-rail mode
|
||||
* Relay de-energized = 2-rail mode
|
||||
*/
|
||||
class RelayController {
|
||||
public:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
RelayController();
|
||||
|
||||
/**
|
||||
* @brief Initialize relay controller hardware
|
||||
*
|
||||
* Configures GPIO pin and sets to default 2-rail mode.
|
||||
*/
|
||||
void begin();
|
||||
|
||||
/**
|
||||
* @brief Set rail mode
|
||||
* @param is3Rail true = 3-rail mode, false = 2-rail mode
|
||||
*/
|
||||
void setRailMode(bool is3Rail);
|
||||
|
||||
/**
|
||||
* @brief Get current rail mode
|
||||
* @return true if 3-rail mode, false if 2-rail mode
|
||||
*/
|
||||
bool is3RailMode() { return is3Rail; }
|
||||
|
||||
private:
|
||||
bool is3Rail; ///< Current rail mode state
|
||||
};
|
||||
|
||||
#endif // RELAY_CONTROLLER_H
|
||||
Reference in New Issue
Block a user