| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- #ifndef SHUTTER_CONTROLLER_H
- #define SHUTTER_CONTROLLER_H
- /// <summary>
- /// Interface for camera shutter control operations.
- /// Defines the contract for controlling camera focus and shutter functionality.
- /// </summary>
- class IShutterController
- {
- public:
- virtual ~IShutterController() = default;
-
- /// <summary>
- /// Performs a half press of the shutter to initiate focus.
- /// This is equivalent to pressing the shutter button halfway down.
- /// </summary>
- virtual void halfPress() = 0;
-
- /// <summary>
- /// Performs a full press of the shutter to take a photo.
- /// Automatically calls halfPress() if not already pressed.
- /// </summary>
- virtual void fullPress() = 0;
-
- /// <summary>
- /// Releases the shutter and returns to neutral position.
- /// Resets focus state and shutter pin to LOW.
- /// </summary>
- virtual void unPress() = 0;
-
- /// <summary>
- /// Presses the shutter fully, waits for specified delay, then releases.
- /// </summary>
- /// <param name="ms">Delay in milliseconds between full press and release</param>
- virtual void pressFullWithDelay(int ms) = 0;
-
- /// <summary>
- /// Takes multiple photos in sequence with configurable timing.
- /// </summary>
- /// <param name="ms">Duration of each full press in milliseconds</param>
- /// <param name="count">Number of photos to take</param>
- /// <param name="delayMs">Delay between consecutive shots in milliseconds</param>
- virtual void multipleShoot(int ms, int count, int delayMs) = 0;
- };
- /// <summary>
- /// Implementation of camera shutter control for Minolta remote.
- /// Controls focus and shutter via GPIO pins to simulate button presses.
- /// </summary>
- class ShutterController : public IShutterController
- {
- private:
- /// <summary>GPIO pin number for focus control</summary>
- uint8_t focusPin;
-
- /// <summary>GPIO pin number for shutter control</summary>
- uint8_t shutterPin;
-
- /// <summary>Flag indicating whether focus is currently pressed</summary>
- bool isFocusPressed;
-
- public:
- /// <summary>
- /// Constructs a ShutterController instance.
- /// </summary>
- /// <param name="focusPin">GPIO pin for focus control (e.g., D1/GPIO5)</param>
- /// <param name="shutterPin">GPIO pin for shutter control (e.g., D2/GPIO4)</param>
- ShutterController(uint8_t focusPin, uint8_t shutterPin);
-
- /// <summary>
- /// Performs a half press of the shutter to initiate focus.
- /// </summary>
- void halfPress() override;
-
- /// <summary>
- /// Performs a full press of the shutter to take a photo.
- /// </summary>
- void fullPress() override;
-
- /// <summary>
- /// Releases the shutter and returns to neutral position.
- /// </summary>
- void unPress() override;
-
- /// <summary>
- /// Presses the shutter fully, waits for specified delay, then releases.
- /// </summary>
- /// <param name="ms">Delay in milliseconds between full press and release</param>
- void pressFullWithDelay(int ms) override;
-
- /// <summary>
- /// Takes multiple photos in sequence with configurable timing.
- /// </summary>
- /// <param name="ms">Duration of each full press in milliseconds</param>
- /// <param name="count">Number of photos to take</param>
- /// <param name="delayMs">Delay between consecutive shots in milliseconds</param>
- void multipleShoot(int ms, int count, int delayMs) override;
-
- /// <summary>
- /// Gets the current focus press state.
- /// </summary>
- /// <returns>True if focus is currently pressed, false otherwise</returns>
- bool getFocusPressedState() const;
- };
- #endif // SHUTTER_CONTROLLER_H
|