12#pragma GCC diagnostic push
13#pragma GCC diagnostic ignored "-Wignored-qualifiers"
16#pragma GCC diagnostic ignored "-Wpragmas"
17#pragma GCC diagnostic ignored "-Wvolatile"
46#if !defined(FASTLED_NO_PINMAP)
59 mPort = (
volatile RwReg*)portOutputRegister(digitalPinToPort(
mPin));
60 mInPort = (
volatile RoReg*)portInputRegister(digitalPinToPort(
mPin));
144 volatile RwReg *
mPort;
164 void setPin(
int pin) {
mPin = pin;
_init(); }
173 inline void hi() __attribute__ ((always_inline)) { *
mPort |=
mPinMask; }
190 virtual void select()
override {
hi(); }
191 virtual void release()
override {
lo(); }
221#ifdef FASTLED_FORCE_SOFTWARE_PINS
227#if !defined(FASTLED_NO_PINMAP)
229 sPort = portOutputRegister(digitalPinToPort(
PIN));
230 sInPort = portInputRegister(digitalPinToPort(
PIN));
280template<u
int8_t PIN>
class FastPin {
287 constexpr static bool validpin() {
return false; }
288 constexpr static bool LowSpeedOnlyRecommended() {
294 static_assert(validpin(),
"Invalid pin specified");
296 static void _init() { }
308 inline static void hi() __attribute__ ((always_inline)) { }
310 inline static void lo() __attribute__ ((always_inline)) { }
313 inline static void strobe() __attribute__ ((always_inline)) { }
316 inline static void toggle() __attribute__ ((always_inline)) { }
338 static port_t hival() __attribute__ ((always_inline)) {
return 0; }
340 static port_t loval() __attribute__ ((always_inline)) {
return 0;}
342 static port_ptr_t port() __attribute__ ((always_inline)) {
return NULL; }
344 static port_t mask() __attribute__ ((always_inline)) {
return 0; }
375#define _FL_DEFINE_PORT(L, BASE) template<> struct __FL_PORT_INFO<L> { \
376 static bool hasPort() { return 1; } \
377 static const char *portName() { return #L; } \
378 typedef BASE __t_baseType; \
379 static const void *portAddr() { return (void*)&__t_baseType::r(); } };
391#define _FL_DEFINE_PORT3(L, LC, BASE) template<> struct __FL_PORT_INFO<LC> { \
392 static bool hasPort() { return 1; } \
393 static const char *portName() { return #L; } \
394 typedef BASE __t_baseType; \
395 static const void *portAddr() { return (void*)&__t_baseType::r(); } };
399#pragma GCC diagnostic pop
central include file for FastLED, defines the CFastLED class/object
static volatile RoReg * sInPort
static port_t hival()
Gets the state of the port with this pin HIGH
RwReg port_t
type for a pin read/write register, non-volatile
static void toggle()
Toggle the pin.
static void hi(FASTLED_REGISTER port_ptr_t port)
Set the same pin on another port to HIGH
static port_t loval()
Gets the state of the port with this pin LOW
static void lo(FASTLED_REGISTER port_ptr_t port)
Set the same pin on another port to LOW
static void set(FASTLED_REGISTER port_t val)
Set the state of the output register.
static volatile RwReg * sPort
static port_t mask()
Get the pin mask.
volatile RwReg * port_ptr_t
type for a pin read/write register, volatile
static void lo()
Set the pin state to LOW
static void setOutput()
Set the pin mode as OUTPUT
static void strobe()
Toggle the pin twice to create a short pulse.
static void fastset(FASTLED_REGISTER port_ptr_t port, FASTLED_REGISTER port_t val)
Set the state of a port.
static void hi()
Set the pin state to HIGH
static void setInput()
Set the pin mode as INPUT
FastPin implementation for bit-banded access.
The simplest level of Pin class.
OutputPin(int pin)
Constructor.
I/O pin initially set to OUTPUT.
volatile RwReg * mPort
Output register for the pin.
void fastset(FASTLED_REGISTER port_ptr_t port, FASTLED_REGISTER port_t val)
Set the state of a port.
void lo(FASTLED_REGISTER port_ptr_t port)
Set the same pin on another port to LOW
void setOutput()
Set the pin mode as OUTPUT
void set(FASTLED_REGISTER port_t val)
Set the state of the output register.
port_t loval()
Gets the state of the port with this pin LOW
void setInput()
Set the pin mode as INPUT
virtual bool isSelected() override
Checks if the pin is currently HIGH
void _init()
Initialize the class by retrieving the register pointers and bitmask.
void hi()
Set the pin state to HIGH
void toggle()
Toggle the pin.
void hi(FASTLED_REGISTER port_ptr_t port)
Set the same pin on another port to HIGH
virtual void release() override
Set the pin state to LOW
void lo()
Set the pin state to LOW
volatile RoReg * mInPort
Input register for the pin.
RwReg mPinMask
Bitmask for the pin within its register.
volatile RwReg * port_ptr_t
type for a pin read/write register, volatile
RwReg port_t
type for a pin read/write register, non-volatile
port_t mask()
Get the pin mask.
uint8_t mPin
Arduino digital pin number.
port_ptr_t port()
Get the output state of the port.
void strobe()
Toggle the pin twice to create a short pulse.
port_t hival()
Gets the state of the port with this pin HIGH
virtual void select() override
Set the pin state to HIGH
Naive fallback solution for low level pin access.
virtual void release()=0
Release this object.
virtual void select()=0
Select this object.
virtual bool isSelected()=0
Check if this object is currently selected.
Abstract class for "selectable" things.
volatile uint32_t * ptr_reg32_t
Pointer to a 32-bit register, volatile.
volatile uint32_t & reg32_t
Reference to a 32-bit register, volatile.
Determines which platform system definitions to include.
#define FASTLED_NAMESPACE_END
#define FASTLED_REGISTER
Helper macro to replace the deprecated 'register' keyword if we're using modern C++ where it's been r...
static const void * portAddr()
Gets the raw address of the port.
static bool hasPort()
Checks whether a port exists.
static const char * portName()
Gets the name of the port, as a C-string.
Utility template for tracking down information about pins and ports.
#define FASTLED_UNUSED(x)