Doxygen with github
Loading...
Searching...
No Matches
src
ksf
comp
ksResetButton.h
1
/*
2
* Copyright (c) 2021-2023, Krzysztof Strehlau
3
*
4
* This file is a part of the ksIotFramework library.
5
* All licensing information can be found inside LICENSE.md file.
6
*
7
* https://github.com/cziter15/ksIotFrameworkLib/blob/master/LICENSE
8
*/
9
10
#pragma once
11
12
#include <Arduino.h>
13
#include "../ksComponent.h"
14
15
namespace
ksf::comps
16
{
25
class
ksResetButton
:
public
ksComponent
26
{
27
KSF_RTTI_DECLARATIONS(
ksResetButton
,
ksComponent
)
28
29
protected
:
30
uint8_t
pin
{0};
31
uint8_t
triggerState
{0};
32
uint8_t
lastState
{0};
33
uint8_t
mode
{INPUT};
34
uint32_t
pressedTime
{0};
35
uint32_t
releasedTime
{0};
36
37
public
:
44
ksResetButton
(uint8_t
pin
, uint8_t
triggerState
, uint8_t
mode
);
45
51
bool
init
(
ksApplication
* app)
override
;
52
58
bool
loop
(
ksApplication
* app)
override
;
59
64
uint8_t
getPin
()
const
{
return
pin
; }
65
69
virtual
~ksResetButton
();
70
};
71
}
ksf::comps::ksResetButton
A component that implements reset button functionality.
Definition
ksResetButton.h:26
ksf::comps::ksResetButton::triggerState
uint8_t triggerState
State that triggers reset logic.
Definition
ksResetButton.h:31
ksf::comps::ksResetButton::loop
bool loop(ksApplication *app) override
Handles the reset button component logic.
Definition
ksResetButton.cpp:41
ksf::comps::ksResetButton::getPin
uint8_t getPin() const
Retrieves pin number assigned to the button.
Definition
ksResetButton.h:64
ksf::comps::ksResetButton::pin
uint8_t pin
Cached pin number.
Definition
ksResetButton.h:30
ksf::comps::ksResetButton::releasedTime
uint32_t releasedTime
Release timestamp (milliseconds since boot).
Definition
ksResetButton.h:35
ksf::comps::ksResetButton::ksResetButton
ksResetButton(uint8_t pin, uint8_t triggerState, uint8_t mode)
Constructs the reset button component.
Definition
ksResetButton.cpp:30
ksf::comps::ksResetButton::mode
uint8_t mode
Cached pin mode.
Definition
ksResetButton.h:33
ksf::comps::ksResetButton::pressedTime
uint32_t pressedTime
Press timestamp (milliseconds since boot).
Definition
ksResetButton.h:34
ksf::comps::ksResetButton::~ksResetButton
virtual ~ksResetButton()
Destructs ksResetButton, restoring INPUT pin state.
Definition
ksResetButton.cpp:72
ksf::comps::ksResetButton::lastState
uint8_t lastState
Previous state (for debouncing).
Definition
ksResetButton.h:32
ksf::comps::ksResetButton::init
bool init(ksApplication *app) override
Initializes the reset button component.
Definition
ksResetButton.cpp:34
ksf::ksApplication
A class that is a base for user-defined application.
Definition
ksApplication.h:43
ksf::ksComponent
Base component class.
Definition
ksComponent.h:51
Generated by
1.12.0