FastLED
3.9.15
Loading...
Searching...
No Matches
dc_blocker_impl.h
Go to the documentation of this file.
1
#pragma once
2
3
namespace
fl
{
4
namespace
detail
{
5
6
// DC offset removal filter.
7
// y[n] = x[n] - x[n-1] + R * y[n-1]
8
// R controls the cutoff: closer to 1.0 = lower cutoff frequency.
9
// Default R = 0.995 gives ~1.6 Hz cutoff at 1 kHz sample rate.
10
template
<
typename
T>
11
class
DCBlockerImpl
{
12
public
:
13
explicit
DCBlockerImpl
(T r = T(0.995f))
14
:
mR
(r),
mX1
(T(0)),
mY
(T(0)) {}
15
16
T
update
(T input) {
17
T output = input -
mX1
+
mR
*
mY
;
18
mX1
= input;
19
mY
= output;
20
return
output;
21
}
22
23
void
setR
(T r) {
mR
= r; }
24
T
value
()
const
{
return
mY
; }
25
void
reset
() {
mX1
=
mY
= T(0); }
26
27
private
:
28
T
mR
;
29
T
mX1
;
30
T
mY
;
31
};
32
33
}
// namespace detail
34
}
// namespace fl
fl::detail::DCBlockerImpl::mR
T mR
Definition
dc_blocker_impl.h:28
fl::detail::DCBlockerImpl::update
T update(T input)
Definition
dc_blocker_impl.h:16
fl::detail::DCBlockerImpl::value
T value() const
Definition
dc_blocker_impl.h:24
fl::detail::DCBlockerImpl::reset
void reset()
Definition
dc_blocker_impl.h:25
fl::detail::DCBlockerImpl::setR
void setR(T r)
Definition
dc_blocker_impl.h:23
fl::detail::DCBlockerImpl::DCBlockerImpl
DCBlockerImpl(T r=T(0.995f))
Definition
dc_blocker_impl.h:13
fl::detail::DCBlockerImpl::mX1
T mX1
Definition
dc_blocker_impl.h:29
fl::detail::DCBlockerImpl::mY
T mY
Definition
dc_blocker_impl.h:30
fl::detail
Compile-time linker keep-alive hook for a single fl::Bus.
Definition
bus_traits.h:48
fl
Base definition for an LED controller.
Definition
crgb.hpp:179
fl
math
filter
dc_blocker_impl.h
Generated on Tue Jun 16 2026 00:06:59 for FastLED by
1.13.2