Parking Garage Control System
ESP32 Parking Garage – ESP-IDF/FreeRTOS
Loading...
Searching...
No Matches
Gate Class Reference

Concrete gate implementation using GPIO. More...

#include <Gate.h>

Inheritance diagram for Gate:
Collaboration diagram for Gate:

Public Member Functions

 Gate (gpio_num_t lightBarrierPin, gpio_num_t motorPin, ledc_channel_t ledcChannel)
 Construct a gate with GPIO pins (without button)
 
 Gate (gpio_num_t buttonPin, uint32_t buttonDebounceMs, gpio_num_t lightBarrierPin, gpio_num_t motorPin, ledc_channel_t ledcChannel)
 Construct a gate with GPIO pins and button.
 
void open () override
 Open the barrier.
 
void close () override
 Close the barrier.
 
bool isOpen () const override
 Check if barrier is currently open.
 
bool isCarDetected () const override
 Check if car is detected in light barrier.
 
bool hasButton () const
 Check if gate has a button.
 
EspGpioInput & getButton ()
 Get button for interrupt configuration.
 
EspGpioInput & getLightBarrier ()
 Get light barrier for interrupt configuration.
 
- Public Member Functions inherited from IGate
virtual ~IGate ()=default
 

Detailed Description

Concrete gate implementation using GPIO.

Creates and manages light barrier, motor, and optional button hardware

Constructor & Destructor Documentation

◆ Gate() [1/2]

Gate::Gate ( gpio_num_t  lightBarrierPin,
gpio_num_t  motorPin,
ledc_channel_t  ledcChannel 
)

Construct a gate with GPIO pins (without button)

Parameters
lightBarrierPinGPIO pin for light barrier sensor
motorPinGPIO pin for barrier motor (servo)
ledcChannelLEDC channel for servo PWM

◆ Gate() [2/2]

Gate::Gate ( gpio_num_t  buttonPin,
uint32_t  buttonDebounceMs,
gpio_num_t  lightBarrierPin,
gpio_num_t  motorPin,
ledc_channel_t  ledcChannel 
)

Construct a gate with GPIO pins and button.

Parameters
buttonPinGPIO pin for entry button
buttonDebounceMsButton debounce time in milliseconds
lightBarrierPinGPIO pin for light barrier sensor
motorPinGPIO pin for barrier motor (servo)
ledcChannelLEDC channel for servo PWM

Member Function Documentation

◆ close()

void Gate::close ( )
overridevirtual

Close the barrier.

Implements IGate.

◆ getButton()

EspGpioInput & Gate::getButton ( )
inline

Get button for interrupt configuration.

Returns
Reference to button (only valid if hasButton() returns true)

◆ getLightBarrier()

EspGpioInput & Gate::getLightBarrier ( )
inline

Get light barrier for interrupt configuration.

Returns
Reference to light barrier

◆ hasButton()

bool Gate::hasButton ( ) const
inline

Check if gate has a button.

◆ isCarDetected()

bool Gate::isCarDetected ( ) const
overridevirtual

Check if car is detected in light barrier.

Returns
true if car is blocking light barrier, false otherwise

Implements IGate.

◆ isOpen()

bool Gate::isOpen ( ) const
overridevirtual

Check if barrier is currently open.

Returns
true if barrier is open, false otherwise

Implements IGate.

◆ open()

void Gate::open ( )
overridevirtual

Open the barrier.

Implements IGate.


The documentation for this class was generated from the following files:
Coverage