Prusa MINI Firmware overview
DigitalPin< PinNumber > Class Template Reference

Fast digital port I/O. More...

#include <softspi.h>

Public Member Functions

 DigitalPin ()
 
 DigitalPin (bool pinMode)
 
 DigitalPin (bool mode, bool level)
 
FORCE_INLINE DigitalPinoperator= (bool value)
 
FORCE_INLINE operator bool () const
 
FORCE_INLINE void config (bool mode, bool level)
 
FORCE_INLINE void high ()
 
FORCE_INLINE void low ()
 
FORCE_INLINE void mode (bool pinMode)
 
FORCE_INLINE bool read () const
 
FORCE_INLINE void toggle ()
 
FORCE_INLINE void write (bool value)
 

Detailed Description

template<uint8_t PinNumber>
class DigitalPin< PinNumber >

Fast digital port I/O.

Constructor & Destructor Documentation

◆ DigitalPin() [1/3]

template<uint8_t PinNumber>
DigitalPin< PinNumber >::DigitalPin ( )

Constructor

572 {}

◆ DigitalPin() [2/3]

template<uint8_t PinNumber>
DigitalPin< PinNumber >::DigitalPin ( bool  pinMode)
explicit

Constructor

Parameters
[in]pinModeif true set output mode else input mode.
578 { mode(pinMode); }
Here is the call graph for this function:

◆ DigitalPin() [3/3]

template<uint8_t PinNumber>
DigitalPin< PinNumber >::DigitalPin ( bool  mode,
bool  level 
)

Constructor

Parameters
[in]modeIf true set output mode else input mode
[in]levelIf mode is output, set level high/low. If mode is input, enable or disable the pin's 20K pullup.
586 { config(mode, level); }
Here is the call graph for this function:

Member Function Documentation

◆ operator=()

template<uint8_t PinNumber>
FORCE_INLINE DigitalPin& DigitalPin< PinNumber >::operator= ( bool  value)

Assignment operator

Parameters
[in]valueIf true set the pin's level high else set the pin's level low.
Returns
This DigitalPin instance.
595 { write(value); return *this; }
Here is the call graph for this function:

◆ operator bool()

template<uint8_t PinNumber>
FORCE_INLINE DigitalPin< PinNumber >::operator bool ( ) const

Parentheses operator

Returns
Pin's level
601 { return read(); }
Here is the call graph for this function:

◆ config()

template<uint8_t PinNumber>
FORCE_INLINE void DigitalPin< PinNumber >::config ( bool  mode,
bool  level 
)

Set pin configuration

Parameters
[in]modeIf true set output mode else input mode
[in]levelIf mode is output, set level high/low. If mode is input, enable or disable the pin's 20K pullup.
609 { fastPinConfig(PinNumber, mode, level); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ high()

template<uint8_t PinNumber>
FORCE_INLINE void DigitalPin< PinNumber >::high ( )

Set pin level high if output mode or enable 20K pullup if input mode.

614 { write(true); }
Here is the call graph for this function:

◆ low()

template<uint8_t PinNumber>
FORCE_INLINE void DigitalPin< PinNumber >::low ( )

Set pin level low if output mode or disable 20K pullup if input mode.

619 { write(false); }
Here is the call graph for this function:

◆ mode()

template<uint8_t PinNumber>
FORCE_INLINE void DigitalPin< PinNumber >::mode ( bool  pinMode)

Set pin mode

Parameters
[in]pinModeif true set output mode else input mode.

mode() does not enable or disable the 20K pullup for input mode.

627 { fastPinMode(PinNumber, pinMode); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

template<uint8_t PinNumber>
FORCE_INLINE bool DigitalPin< PinNumber >::read ( void  ) const
Returns
Pin's level
630 { return fastDigitalRead(PinNumber); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toggle()

template<uint8_t PinNumber>
FORCE_INLINE void DigitalPin< PinNumber >::toggle ( )

Toggle a pin If the pin is in output mode toggle the pin's level. If the pin is in input mode toggle the state of the 20K pullup.

637 { fastDigitalToggle(PinNumber); }
Here is the call graph for this function:

◆ write()

template<uint8_t PinNumber>
FORCE_INLINE void DigitalPin< PinNumber >::write ( bool  value)

Write the pin's level.

Parameters
[in]valueIf true set the pin's level high else set the pin's level low.
644 { fastDigitalWrite(PinNumber, value); }
Here is the call graph for this function:
Here is the caller graph for this function:
fastDigitalToggle
static FORCE_INLINE void fastDigitalToggle(uint8_t pin)
Definition: softspi.h:519
fastPinConfig
static FORCE_INLINE void fastPinConfig(uint8_t pin, bool mode, bool level)
Definition: softspi.h:558
fastPinMode
static FORCE_INLINE void fastPinMode(uint8_t pin, bool mode)
Definition: softspi.h:544
DigitalPin::mode
FORCE_INLINE void mode(bool pinMode)
Definition: softspi.h:627
DigitalPin::read
FORCE_INLINE bool read() const
Definition: softspi.h:630
fastDigitalRead
static FORCE_INLINE bool fastDigitalRead(uint8_t pin)
Definition: softspi.h:507
fastDigitalWrite
static FORCE_INLINE void fastDigitalWrite(uint8_t pin, bool level)
Definition: softspi.h:532
DigitalPin::config
FORCE_INLINE void config(bool mode, bool level)
Definition: softspi.h:609
pinMode
void pinMode(uint32_t ulPin, uint32_t ulMode)
Definition: wiring_digital.c:22
DigitalPin::write
FORCE_INLINE void write(bool value)
Definition: softspi.h:644