10#pragma GCC diagnostic push
11#pragma GCC diagnostic ignored "-Wignored-qualifiers"
14#pragma GCC diagnostic ignored "-Wpragmas"
15#pragma GCC diagnostic ignored "-Wvolatile"
44#if !defined(FASTLED_NO_PINMAP)
57 mPort = (
volatile RwReg*)portOutputRegister(digitalPinToPort(
mPin));
58 mInPort = (
volatile RoReg*)portInputRegister(digitalPinToPort(
mPin));
140 volatile RwReg *
mPort;
160 void setPin(
int pin) {
mPin = pin;
_init(); }
168 inline void hi() __attribute__ ((always_inline)) { *
mPort |=
mPinMask; }
185 virtual void select()
override {
hi(); }
186 virtual void release()
override {
lo(); }
216#ifdef FASTLED_FORCE_SOFTWARE_PINS
222#if !defined(FASTLED_NO_PINMAP)
224 sPort = portOutputRegister(digitalPinToPort(
PIN));
225 sInPort = portInputRegister(digitalPinToPort(
PIN));
275template<u
int8_t PIN>
class FastPin {
282 constexpr static bool validpin() {
return false; }
283 constexpr static bool LowSpeedOnlyRecommended() {
289 static_assert(validpin(),
"Invalid pin specified");
291 static void _init() { }
303 inline static void hi() __attribute__ ((always_inline)) { }
305 inline static void lo() __attribute__ ((always_inline)) { }
308 inline static void strobe() __attribute__ ((always_inline)) { }
311 inline static void toggle() __attribute__ ((always_inline)) { }
333 static port_t hival() __attribute__ ((always_inline)) {
return 0; }
335 static port_t loval() __attribute__ ((always_inline)) {
return 0;}
337 static port_ptr_t port() __attribute__ ((always_inline)) {
return NULL; }
339 static port_t mask() __attribute__ ((always_inline)) {
return 0; }
370#define _FL_DEFINE_PORT(L, BASE) template<> struct __FL_PORT_INFO<L> { \
371 static bool hasPort() { return 1; } \
372 static const char *portName() { return #L; } \
373 typedef BASE __t_baseType; \
374 static const void *portAddr() { return (void*)&__t_baseType::r(); } };
386#define _FL_DEFINE_PORT3(L, LC, BASE) template<> struct __FL_PORT_INFO<LC> { \
387 static bool hasPort() { return 1; } \
388 static const char *portName() { return #L; } \
389 typedef BASE __t_baseType; \
390 static const void *portAddr() { return (void*)&__t_baseType::r(); } };
394#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.
#define FASTLED_REGISTER
Helper macro to replace the deprecated 'register' keyword if we're using modern C++ where it's been r...
Determines which platform system definitions to include.
#define FASTLED_NAMESPACE_END
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)