Automatic Curtain  MVP
Software repository for an automatic curtain using stepper motor, TMC2209 and ESP32
ManualInteraction Class Reference

#include <manual_interaction.h>

Public Member Functions

 ManualInteraction (int freq_to_run_deque_analyser, std::shared_ptr< Logging > &logging)
 ManualInteraction class constructor Setup pinmode and interrupt. More...
 
 ~ManualInteraction ()
 ManualInteraction class destructor Destroy the ManualInteraction object. More...
 
void StopButtonDequeAnalyserFn ()
 Stop button deque analyser function set_button_deque_analyser varible to ture so it stops the threaded function. More...
 
void StartButtonDequeAnalyserFn ()
 start button deque analyser function thread start button deque analyser function thread More...
 
std::tuple< CONFIG_SET::MANUAL_PUSH, CONFIG_SET::time_varGetManualActionAndTime ()
 Get the Manual Action And Time object. More...
 

Static Public Member Functions

static void s_IntrAddToButtonDequeUp ()
 Hardware Interrrupt for up [red colored] button check for valid interrupt by software debouncing,switch state cheking and adds it to the button deque up. More...
 
static void s_IntrAddToButtonDequeDown ()
 Hardware Interrrupt for down [black colored] button check for valid interrupt by software debouncing,switch state cheking and adds it to the button deque down. More...
 

Private Member Functions

void ButtonstateDequeAnalyser ()
 thread function to check the deque status and identify the manual interaction mode Function will check state and time of occurance for objects in deque for determining mode More...
 
void SetCurrentButtonState (std::deque< std::pair< bool, CONFIG_SET::time_var >> &button_press_deque_, CONFIG_SET::BUTTON_PRESS &button_state, CONFIG_SET::time_var &time)
 Set the CurrentButtonState object Function to sets the current buttonstate [0 ->NO_PUSH, 1->LONGPRESS, 2->DOUBLETAP]. More...
 
void SetManualActionAndTime (CONFIG_SET::BUTTON_PRESS &button_1_state, CONFIG_SET::BUTTON_PRESS &button_2_state, CONFIG_SET::time_var &time_button_1, CONFIG_SET::time_var &time_button_2)
 Set the Manual Action And Time object sets manual_action_ and manual_action_time_. More...
 

Private Attributes

CONFIG_SET::MANUAL_PUSH manual_action_ = CONFIG_SET::MANUAL_PUSH::NO_PUSH
 
CONFIG_SET::time_var manual_action_time_
 
bool stop_button_deque_analyser_ = true
 
std::unique_ptr< std::thread > deque_analyser_ {nullptr}
 
std::shared_ptr< Logginglogger_ {nullptr}
 
const int freq_to_run_deque_analyser_
 
int delay_to_run_deque_analyser_
 

Static Private Attributes

static std::deque< std::pair< bool, CONFIG_SET::time_var > > s_button_state_deque_up_
 
static std::deque< std::pair< bool, CONFIG_SET::time_var > > s_button_state_deque_down_
 
static bool s_class_setup_flag_ = false
 
static std::mutex s_deque_mutex_
 

Constructor & Destructor Documentation

◆ ManualInteraction()

ManualInteraction::ManualInteraction ( int  freq_to_run_deque_analyser,
std::shared_ptr< Logging > &  logging 
)

ManualInteraction class constructor Setup pinmode and interrupt.

Here is the call graph for this function:

◆ ~ManualInteraction()

ManualInteraction::~ManualInteraction ( )

ManualInteraction class destructor Destroy the ManualInteraction object.

Here is the call graph for this function:

Member Function Documentation

◆ ButtonstateDequeAnalyser()

void ManualInteraction::ButtonstateDequeAnalyser ( )
private

thread function to check the deque status and identify the manual interaction mode Function will check state and time of occurance for objects in deque for determining mode

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetManualActionAndTime()

std::tuple< CONFIG_SET::MANUAL_PUSH, CONFIG_SET::time_var > ManualInteraction::GetManualActionAndTime ( )

Get the Manual Action And Time object.

Returns
std::tuple<CONFIG_SET::MANUAL_PUSH, CONFIG_SET::time_var>

◆ s_IntrAddToButtonDequeDown()

void ManualInteraction::s_IntrAddToButtonDequeDown ( )
static

Hardware Interrrupt for down [black colored] button check for valid interrupt by software debouncing,switch state cheking and adds it to the button deque down.

Here is the caller graph for this function:

◆ s_IntrAddToButtonDequeUp()

void ManualInteraction::s_IntrAddToButtonDequeUp ( )
static

Hardware Interrrupt for up [red colored] button check for valid interrupt by software debouncing,switch state cheking and adds it to the button deque up.

Here is the caller graph for this function:

◆ SetCurrentButtonState()

void ManualInteraction::SetCurrentButtonState ( std::deque< std::pair< bool, CONFIG_SET::time_var >> &  button_press_deque_,
CONFIG_SET::BUTTON_PRESS button_state,
CONFIG_SET::time_var time 
)
private

Set the CurrentButtonState object Function to sets the current buttonstate [0 ->NO_PUSH, 1->LONGPRESS, 2->DOUBLETAP].

Parameters
[in]button_press_deque_deque to analyse and set button_state
[out]button_staterefrence to button_state passed
[out]timerefrence to time variable for change of button_state
Here is the caller graph for this function:

◆ SetManualActionAndTime()

void ManualInteraction::SetManualActionAndTime ( CONFIG_SET::BUTTON_PRESS button_1_state,
CONFIG_SET::BUTTON_PRESS button_2_state,
CONFIG_SET::time_var time_button_1,
CONFIG_SET::time_var time_button_2 
)
private

Set the Manual Action And Time object sets manual_action_ and manual_action_time_.

Parameters
[in]button_1_statecurrent button state 1 [red]
[in]button_2_statecurrent button state 2 [black]
[in]time_button_1time the current button state 1 was set
[in]time_button_2time the current button state 2 was set
Here is the caller graph for this function:

◆ StartButtonDequeAnalyserFn()

void ManualInteraction::StartButtonDequeAnalyserFn ( )

start button deque analyser function thread start button deque analyser function thread

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StopButtonDequeAnalyserFn()

void ManualInteraction::StopButtonDequeAnalyserFn ( )

Stop button deque analyser function set_button_deque_analyser varible to ture so it stops the threaded function.

Here is the caller graph for this function:

Member Data Documentation

◆ delay_to_run_deque_analyser_

int ManualInteraction::delay_to_run_deque_analyser_
private

◆ deque_analyser_

std::unique_ptr<std::thread> ManualInteraction::deque_analyser_ {nullptr}
private

◆ freq_to_run_deque_analyser_

const int ManualInteraction::freq_to_run_deque_analyser_
private

◆ logger_

std::shared_ptr<Logging> ManualInteraction::logger_ {nullptr}
private

◆ manual_action_

CONFIG_SET::MANUAL_PUSH ManualInteraction::manual_action_ = CONFIG_SET::MANUAL_PUSH::NO_PUSH
private

◆ manual_action_time_

CONFIG_SET::time_var ManualInteraction::manual_action_time_
private

◆ s_button_state_deque_down_

std::deque< std::pair< bool, CONFIG_SET::time_var > > ManualInteraction::s_button_state_deque_down_
staticprivate

◆ s_button_state_deque_up_

std::deque< std::pair< bool, CONFIG_SET::time_var > > ManualInteraction::s_button_state_deque_up_
staticprivate

◆ s_class_setup_flag_

bool ManualInteraction::s_class_setup_flag_ = false
staticprivate

◆ s_deque_mutex_

std::mutex ManualInteraction::s_deque_mutex_
staticprivate

◆ stop_button_deque_analyser_

bool ManualInteraction::stop_button_deque_analyser_ = true
private

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