FastLED 3.9.15
Loading...
Searching...
No Matches
digital_pin.cpp.hpp
Go to the documentation of this file.
1
2#include "fl/stl/stdint.h"
3
4#include "fl/ui/ui.h"
5#include "fl/stl/shared_ptr.h" // For make_shared
6
8
9// Include fl/pin.h for pin API (includes platform implementations)
10#include "fl/system/pin.h"
11#include "fl/stl/noexcept.h"
12
13namespace fl {
14
16 public:
17 DigitalPinImpl(int pin) : mPin(pin) {}
19
20 void setPinMode(DigitalPin::Mode mode) {
22 switch (mode) {
25 break;
28 break;
31 break;
34 break;
35 default:
36 return;
37 }
39 }
40
41 bool high() {
43 }
44
48
49 private:
50 int mPin;
51};
52
53
58DigitalPin::DigitalPin(const DigitalPin &other) = default;
59
60DigitalPin& DigitalPin::operator=(const DigitalPin &other) FL_NOEXCEPT = default;
61
63 mImpl->setPinMode(mode);
64}
65
66bool DigitalPin::high() const {
67 return mImpl->high();
68}
69
70void DigitalPin::write(bool is_high) {
71 mImpl->write(is_high);
72}
73
74} // namespace fl
void write(bool is_high)
void setPinMode(Mode mode)
DigitalPinImplPtr mImpl
Definition digital_pin.h:33
bool high() const
~DigitalPin() FL_NOEXCEPT
void setPinMode(DigitalPin::Mode mode)
void write(bool value)
~DigitalPinImpl() FL_NOEXCEPT=default
constexpr int type_rank< T >::value
@ Low
Logic low (0V / GND)
Definition pin.h:50
@ High
Logic high (3.3V / 5V, platform-dependent)
Definition pin.h:51
shared_ptr< T > make_shared(Args &&... args) FL_NOEXCEPT
Definition shared_ptr.h:414
void pinMode(int pin, PinMode mode)
Set pin mode (input, output, pull-up, pull-down)
Definition pin.cpp.hpp:378
PinValue digitalRead(int pin)
Read digital value from pin.
Definition pin.cpp.hpp:55
void digitalWrite(int pin, PinValue val)
Write digital value to pin.
Definition pin.cpp.hpp:51
PinMode
Pin mode configuration.
Definition pin.h:41
@ Output
Digital output (push-pull)
Definition pin.h:43
@ Input
Digital input (high impedance)
Definition pin.h:42
@ InputPullup
Digital input with internal pull-up resistor.
Definition pin.h:44
@ InputPulldown
Digital input with internal pull-down resistor.
Definition pin.h:45
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
Aggregator header for the fl/ui/ family of per-element UI types.