NetBurner 3.5.8
PDF Version

Fast GPIO Pin Class. More...

#include <cpu_pins.h>

Public Member Functions

void set (bool b=TRUE)
 Drive a value on the pin(s), forcing the pin to a GPIO Output.
bool read () const
 Read the line state of the pin(s), configuring the pin as a GPIO Input first.
void function (int ft)
 Set the pin function for the managed pin(s); see PinIO::function().
void setFn (int ft)
 Set the pin function for the managed pin(s); alias of function().
int getFunction ()
 Get the pin function currently assigned to the managed pin(s).
 operator int ()
 Read the line state of the pin(s) as an int.
 operator BOOL ()
 Read the line state of the pin(s) as a BOOL.
bool readBack () const
 Read the pin(s) line state without changing the pin function or direction.
void multidrv (bool enable) const
 Configure the multidrive/open-drain driver for the pin(s).
void setHighStrength (bool bHighDrive)
 Configure the drive strength of the output driver for the pin(s).
void PullUp (bool enable) const
 Configure the pad Pull Up resistor for the pin(s).
void PullDown (bool enable) const
 Configure the pad Pull Down resistor for the pin(s).
uint16_t analogRead () const
 Read the pin's analog value as a raw ADC count; see PinIO::analogRead(). Only available for pins connected to the ADC.
void readyAnalog ()
 Prepare the pin for analog usage (ADC or ACMP); see PinIO::readyAnalog().
constexpr uint32_t analogMaxValue ()
 The full-scale analog reading: 0xFFF (12-bit ADC).
uint32_t n ()
 Read the pin's analog value as a raw ADC count; see PinIO::n().
double v ()
 Read the pin's analog value as a voltage; see PinIO::v().
double volts ()
 Read the pin's analog value as a voltage; alias of v().
uint32_t analogRead ()
 Read the pin's analog value as a raw ADC count; alias of n().
void analogEnableSampleWait (bool bWaitForSample)
 Select whether analog reads of this pin wait for a fresh conversion; see PinIO::analogEnableSampleWait().
void set ()
 Set the output latch for the pin(s) High. Does not change the pin function.
void clr ()
 Set the output latch for the pin(s) Low. Does not change the pin function.
bool tgl ()
 Toggle the driven value for the pin(s).
bool toggle ()
 Toggle the driven value for the pin(s).
bool read ()
 Read the line state of the pin(s).
void setPull (PinIO::pull_t pull)
 Configure the pad Pull resistor for the pin(s).
void PullUp ()
 Enable a medium impedance pad Pull Up resistor for the pin(s).
void PullDown ()
 Enable a weak pad Pull Down resistor for the pin(s).
PinIO::pull_t getPull ()
 Get the configured pad Pull resistor setting for the pin(s).
void setSlew (uint8_t slew)
 Set the output pad slew rate (0 = slow, lower EMI; 1 = fast); see PinIO::setSlew().
void setSpeed (uint8_t speed)
 Set the output pad speed/bandwidth; see PinIO::setSpeed() for platform applicability.
void setStrength (uint8_t strength)
 Set the output driver drive strength; see PinIO::setStrength() for the per-platform scale.
void setOpenDrain (bool enable)
 Enable/disable open-drain output for the pin(s); see PinIO::setOpenDrain().
void setHyst (bool enable)
 Enable/disable the input hysteresis (Schmitt trigger); see PinIO::setHyst() for platform applicability.
uint8_t getSlew ()
 Get the configured slew rate (0 = slow, 1 = fast).
uint8_t getSpeed ()
 Get the configured pad speed field; see PinIO::getSpeed().
uint8_t getStrength ()
 Get the configured drive strength; see PinIO::getStrength() for the per-platform scale.
bool getOpenDrain ()
 Get the open-drain enable state for the pin(s).
bool getHyst ()
 Get the input hysteresis (Schmitt trigger) state for the pin(s).
void setSchmidt (bool enable)
 Enable/disable the input hysteresis (Schmitt trigger); alias of setHyst().
bool getSchmidt ()
 Get the input hysteresis (Schmitt trigger) state; alias of getHyst().
void HystOn ()
 Enable the input hysteresis (Schmitt trigger) for the pin(s).
void HystOff ()
 Disable the input hysteresis (Schmitt trigger) for the pin(s).
void SchmidtOn ()
 Enable the input hysteresis (Schmitt trigger) for the pin(s).
void SchmidtOff ()
 Disable the input hysteresis (Schmitt trigger) for the pin(s).
void multidrv (bool enable)
 Configure the open-drain (multidrive) driver; alias of setOpenDrain().
void hiz ()
 Set the GPIO direction of the pin(s) to Input (high impedance). Writes the GPIO direction register directly; the pin must already be muxed as a GPIO (see setFn()).
void drive ()
 Set the GPIO direction of the pin(s) to Output, without modifying the driven value. Writes the GPIO direction register directly; the pin must already be muxed as a GPIO (see setFn()).
void setFn (PinIO::pin_fn_t fn)
 Set the pin function for the managed pin(s).
PinIO::pin_fn_t getFn ()
 Get the pin function for the managed pin(s).
void function (PinIO::pin_fn_t fn)
 Set the pin function for the managed pin(s).
bool operator= (bool val)
 Assign a driven value to the pin(s).
FastIOoperator= (const FastIO &rhs)
 Assign a driven value to the pin(s) based on the line state of another pin(s).

Static Public Member Functions

static void analogSetAveraging (PinIO::analogAveraging_t count)
 Configure ADC hardware averaging for analog reads (ADC-wide); see PinIO::analogSetAveraging().

Friends

class PinIOPortAArray
class PinIOPortBArray
class PinIOPortCArray
class PinIOPortDArray
class PinIOPortEArray
class PinIOPortFArray
class PinIOPortGArray
class PinIOPortHArray
class PinIOPortIArray
class PinIOPortJArray
class PinIOPortKArray
class _PinVector
class _FastPinVector

Detailed Description

Fast GPIO Pin Class.

A minimal-overhead variant of PinIO. State accesses write the GPIO data registers directly without validity checks or pin function updates, so it is suited to performance-critical pin twiddling once the pin has been configured.

Member Function Documentation

◆ function()

void FastIO::function ( int ft)
inline

Set the pin function for the managed pin(s); see PinIO::function().

Parameters
ftThe pin function to assign, as a pin_fn_t value.

◆ getFunction()

int FastIO::getFunction ( )
inline

Get the pin function currently assigned to the managed pin(s).

Returns
The pin function as a pin_fn_t value.

◆ multidrv()

void FastIO::multidrv ( bool enable) const
inline

Configure the multidrive/open-drain driver for the pin(s).

Parameters
enableTrue: configure the output driver as Open Drain. False: configure the output driver as Push-Pull.

◆ operator=()

bool FastIO::operator= ( bool val)
inline

Assign a driven value to the pin(s).

Parameters
valtrue = High, false = Low

◆ PullDown()

void FastIO::PullDown ( bool enable) const
inline

Configure the pad Pull Down resistor for the pin(s).

Parameters
enableTrue: enable the pad Pull Down. False: disable the pad Pull Down.
Note
Available on MODM7AE70 / SBE70LC (SAME70) only.

◆ PullUp()

void FastIO::PullUp ( bool enable) const
inline

Configure the pad Pull Up resistor for the pin(s).

Parameters
enableTrue: enable the pad Pull Up. False: disable the pad Pull Up.
Note
Available on MODM7AE70 / SBE70LC (SAME70) only.

◆ read() [1/2]

bool FastIO::read ( )
inline

Read the line state of the pin(s).

Returns
true = High, false = Low

◆ read() [2/2]

bool FastIO::read ( ) const

Read the line state of the pin(s), configuring the pin as a GPIO Input first.

Returns
The line state of the pin(s): true = High, false = Low.
Note
MOD5441X and MODM7AE70/SBE70LC behavior; on i.MX RT platforms the non-const read() samples the pad without changing the pin function.

◆ readBack()

bool FastIO::readBack ( ) const
inline

Read the pin(s) line state without changing the pin function or direction.

Samples the PIO pin data status register, which reflects the actual voltage on the pin – including when the pin is driven as an output or assigned to a peripheral. Use this instead of read() when the pin must stay in its current mode.

Returns
The line state of the pin(s): true = High, false = Low
Note
Available on MODM7AE70 / SBE70LC (SAME70) only; on i.MX RT platforms read() already samples without changing the pin mode.

◆ set()

void FastIO::set ( bool b = TRUE)

Drive a value on the pin(s), forcing the pin to a GPIO Output.

Parameters
bThe value to drive: TRUE (default) = High, FALSE = Low.
Note
MOD5441X family interface. When the pin is in (emulated) open-drain mode, a High releases the pin to a high-impedance input instead of driving it.

◆ setFn()

void FastIO::setFn ( int ft)
inline

Set the pin function for the managed pin(s); alias of function().

Parameters
ftThe pin function to assign, as a pin_fn_t value.

◆ setHighStrength()

void FastIO::setHighStrength ( bool bHighDrive)
inline

Configure the drive strength of the output driver for the pin(s).

Use High Drive for heavy loads or fast edges into long traces; use Low Drive to reduce overshoot and EMI on light loads.

Parameters
bHighDriveTrue: configure the output driver for High Drive strength. False: configure the output driver for Low Drive strength.
Note
Available on MODM7AE70 / SBE70LC (SAME70) only; on i.MX RT platforms use setStrength().

◆ tgl()

bool FastIO::tgl ( )
inline

Toggle the driven value for the pin(s).

Returns
The new driven value.

◆ toggle()

bool FastIO::toggle ( )
inline

Toggle the driven value for the pin(s).

Returns
The new driven value.

The documentation for this class was generated from the following files: