2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
DebouncedDigitalInput.h
Go to the documentation of this file.
1
4
25
26
#pragma once
27
28
#include <stdint.h>
29
30
#include "
MiscConstants.h
"
31
32
class
DebouncedDigitalInput
{
33
public
:
34
DebouncedDigitalInput
() =
delete
;
35
explicit
DebouncedDigitalInput
(uint8_t pinNumber,
bool
usePullup =
false
);
36
DebouncedDigitalInput
(uint8_t pinNumber, uint8_t groundPin,
bool
usePullup =
false
);
37
DebouncedDigitalInput
(uint8_t pinNumber, uint8_t groundPin, uint16_t debounceSamples,
bool
usePullup =
false
);
38
39
DebouncedDigitalInput
&
operator=
(
const
DebouncedDigitalInput
&) =
delete
;
40
41
void
Initialize
();
42
43
bool
Update
();
44
45
bool
GetValue
()
const
;
46
47
bool
GetRawValue
()
const
;
48
49
void
Reset
(
bool
newValue =
false
);
50
51
void
SetDebounceCount
(uint16_t newCount);
52
53
private
:
54
const
uint8_t
m_readPin
;
55
const
uint8_t
m_groundPin
;
56
const
bool
m_usePullup
;
57
uint16_t
m_debounceSamples
;
58
bool
m_initialized
;
59
uint16_t
m_debounceCount
;
60
bool
m_rawValue
;
61
bool
m_debouncedValue
;
62
};
MiscConstants.h
Miscellaneous constants for the operator controller.
DebouncedDigitalInput
Definition
DebouncedDigitalInput.h:32
DebouncedDigitalInput::GetValue
bool GetValue() const
Definition
DebouncedDigitalInput.cpp:88
DebouncedDigitalInput::m_debounceCount
uint16_t m_debounceCount
Number of samples that do not match the current debounced value.
Definition
DebouncedDigitalInput.h:59
DebouncedDigitalInput::DebouncedDigitalInput
DebouncedDigitalInput()=delete
DebouncedDigitalInput::operator=
DebouncedDigitalInput & operator=(const DebouncedDigitalInput &)=delete
DebouncedDigitalInput::Update
bool Update()
Definition
DebouncedDigitalInput.cpp:68
DebouncedDigitalInput::m_usePullup
const bool m_usePullup
True uses Arduino internal pullup resistor.
Definition
DebouncedDigitalInput.h:56
DebouncedDigitalInput::GetRawValue
bool GetRawValue() const
Definition
DebouncedDigitalInput.cpp:92
DebouncedDigitalInput::Initialize
void Initialize()
Definition
DebouncedDigitalInput.cpp:55
DebouncedDigitalInput::m_initialized
bool m_initialized
True once initialization has completed.
Definition
DebouncedDigitalInput.h:58
DebouncedDigitalInput::m_debouncedValue
bool m_debouncedValue
Active debounced value.
Definition
DebouncedDigitalInput.h:61
DebouncedDigitalInput::SetDebounceCount
void SetDebounceCount(uint16_t newCount)
Definition
DebouncedDigitalInput.cpp:102
DebouncedDigitalInput::Reset
void Reset(bool newValue=false)
Definition
DebouncedDigitalInput.cpp:96
DebouncedDigitalInput::m_readPin
const uint8_t m_readPin
Arduino pin number for this input.
Definition
DebouncedDigitalInput.h:54
DebouncedDigitalInput::m_rawValue
bool m_rawValue
Latest read value without debouncing.
Definition
DebouncedDigitalInput.h:60
DebouncedDigitalInput::m_groundPin
const uint8_t m_groundPin
Arduino pin number used as a ground source.
Definition
DebouncedDigitalInput.h:55
DebouncedDigitalInput::m_debounceSamples
uint16_t m_debounceSamples
Number of samples new value must be held before debounced value changes.
Definition
DebouncedDigitalInput.h:57
src
OperatorController
DebouncedDigitalInput.h
Generated by
1.9.8