NetBurner 3.5.0
PDF Version
 
PinIO Class Reference

GPIO Pin Class. More...

#include <cpu_pins.h>

Public Types

enum  pin_fn_t {
}
 
enum  pin_fn_t {
}
 Pin Function modes to configure the managed pin(s). More...
 

Public Member Functions

 PinIO ()
 Construct an empty PinIO. Exists for bootstrap compatibility; not intended for general use.
 
constexpr PinIO (uint32_t port, uint32_t pin)
 Construct a PinIO for a specific cpu pin.
 
constexpr PinIO (const PinIO &rhs)
 Construct a copy of another PinIO.
 
void setFn (pin_fn_t fn) const
 Set the pin function for the managed pin(s).
 
int8_t getFn ()
 Get the pin function for the managed pin(s).
 
void function (pin_fn_t fn) const
 Set the pin function for the managed pin(s).
 
void hiz () const
 Configure the pin(s) to Input.
 
void drive () const
 Configure the pin(s) to Output, without modifying the driven value.
 
void set () const
 Drive the pin(s) High.
 
void clr () const
 Drive the pin(s) Low.
 
bool tgl () const
 Toggle the driven value for the pin(s).
 
bool toggle () const
 Toggle the driven value for the pin(s).
 
bool readBack () const
 Read the state of the pin(s) line state without changing the pin function or direction.
 
bool read () const
 Configure the pin as an input then return the line state.
 
bool operator= (bool val)
 Assign a driven value to the pin(s).
 
PinIOoperator= (const PinIO &rhs)
 Assign a driven value to the pin(s) based on the line state of another pin(s).
 
 operator bool () const
 Read the line state of the pin(s).
 
bool operator! () const
 Return the opposite of the driven value of the pin(s).
 
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 an analog voltage on the given Pin. Only available for pins connected to the ADC.
 

Public Attributes

volatile Pio & pio
 
uint32_t mask
 

Detailed Description

GPIO Pin Class.

Member Enumeration Documentation

◆ pin_fn_t [1/2]

Enumerator
PIN_FN_IN 

Input.

PIN_FN_OUT 

Output.

PIN_FN_IN 

Input.

PIN_FN_OUT 

Output.

PIN_FN_A 

Peripheral A.

PIN_FN_B 

Peripheral B.

PIN_FN_C 

Peripheral C.

PIN_FN_D 

Peripheral D.

◆ pin_fn_t [2/2]

Pin Function modes to configure the managed pin(s).

Enumerator
PIN_FN_IN 

Input.

PIN_FN_OUT 

Output.

PIN_FN_IN 

Input.

PIN_FN_OUT 

Output.

PIN_FN_A 

Peripheral A.

PIN_FN_B 

Peripheral B.

PIN_FN_C 

Peripheral C.

PIN_FN_D 

Peripheral D.

Constructor & Destructor Documentation

◆ PinIO() [1/2]

constexpr PinIO::PinIO ( uint32_t port,
uint32_t pin )
inlineconstexpr

Construct a PinIO for a specific cpu pin.

Parameters
portThe zero-indexed numeric instance number of the desired Pio module. (PIOA=0, PIOB=1, PIOC=2, etc.)
pinThe zero-indexed pin number within the requested port that the new PinIO is to manage.

Example usage for pin 'PIOD_24'

PinIO LED1(3, 24);
GPIO Pin Class.
Definition coldfire/cpu/MCF5441X/include/cpu_pins.h:14

◆ PinIO() [2/2]

constexpr PinIO::PinIO ( const PinIO & rhs)
inlineconstexpr

Construct a copy of another PinIO.

Parameters
rhsThe PinIO to construct a copy of.

Member Function Documentation

◆ function()

void PinIO::function ( pin_fn_t fn) const
inline

Set the pin function for the managed pin(s).

Parameters
fnThe pin function to be assigned to the managed pin(s).

◆ getFn()

int8_t PinIO::getFn ( )
inline

Get the pin function for the managed pin(s).

Returns
The pin function as a pin_fn_t of the managed pin(s). Returns -1 if pin is not an I/O (ex: GND, VCC)

◆ multidrv()

void PinIO::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()

PinIO::operator bool ( ) const
inline

Read the line state of the pin(s).

Returns
The line state of the pin(s): true = High, false = Low

◆ operator!()

bool PinIO::operator! ( ) const
inline

Return the opposite of the driven value of the pin(s).

Returns
The opposite of the driven value of the pin(s).

◆ operator=() [1/2]

bool PinIO::operator= ( bool val)
inline

Assign a driven value to the pin(s).

Parameters
valThe value to be driven on the pin(s): true = High, false = Low
Returns
The driven value for the pin(s).

◆ operator=() [2/2]

PinIO & PinIO::operator= ( const PinIO & rhs)
inline

Assign a driven value to the pin(s) based on the line state of another pin(s).

Parameters
rhsThe pin(s) who's line state will be assigned to this pin.
Returns
A copy of the PinIO being assigned to.

◆ PullDown()

void PinIO::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.

◆ PullUp()

void PinIO::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.

◆ read()

bool PinIO::read ( ) const
inline

Configure the pin as an input then return the line state.

Returns
The line state of the pin(s).

◆ readBack()

bool PinIO::readBack ( ) const
inline

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

Returns
The line state of the pin(s).

◆ setFn()

void PinIO::setFn ( pin_fn_t fn) const
inline

Set the pin function for the managed pin(s).

Parameters
fnThe pin function to be assigned to the managed pin(s).

◆ setHighStrength()

void PinIO::setHighStrength ( bool bHighDrive)
inline

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

Parameters
bHighDriveTrue: configure the output driver for High Drive strength. False: configure the output driver for Low Drive strength.

◆ tgl()

bool PinIO::tgl ( ) const
inline

Toggle the driven value for the pin(s).

Returns
The previously driven value for the pin(s).

◆ toggle()

bool PinIO::toggle ( ) const
inline

Toggle the driven value for the pin(s).

Returns
The previously driven value for the pin(s).

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