MCPcopy Create free account
hub / github.com/FastLED/FastLED / pinMode

Function pinMode

src/platforms/arm/sam/pin_sam.hpp:58–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58inline void pinMode(int pin, PinMode mode) FL_NOEXCEPT {
59 u32 mask;
60 Pio* pio = detail::getPioController(pin, mask);
61 if (!pio) return;
62
63 // Enable PIO control of the pin
64 pio->PIO_PER = mask;
65
66 switch (mode) {
67 case PinMode::Output:
68 pio->PIO_OER = mask; // Enable output
69 pio->PIO_PUDR = mask; // Disable pull-up
70 break;
71 case PinMode::Input:
72 pio->PIO_ODR = mask; // Disable output (input mode)
73 pio->PIO_PUDR = mask; // Disable pull-up
74 break;
75 case PinMode::InputPullup:
76 pio->PIO_ODR = mask; // Disable output (input mode)
77 pio->PIO_PUER = mask; // Enable pull-up
78 break;
79 case PinMode::InputPulldown:
80 // SAM3X8E does not support internal pull-down resistors
81 // Fall back to standard input mode
82 pio->PIO_ODR = mask; // Disable output (input mode)
83 pio->PIO_PUDR = mask; // Disable pull-up
84 break;
85 }
86}
87
88inline void digitalWrite(int pin, PinValue val) FL_NOEXCEPT {
89 u32 mask;

Callers 5

setOutputMethod · 0.70
setInputMethod · 0.70
setOutputMethod · 0.70
setInputMethod · 0.70
writeBitMethod · 0.70

Calls 1

getPioControllerFunction · 0.85

Tested by

no test coverage detected