ELEC-C7222
Libraries for ELEC C7222 Course Work
Loading...
Searching...
No Matches
c7222::GpioOut Class Reference

GPIO output-only wrapper with output configuration and drive strength. More...

#include <gpio.hpp>

Inheritance diagram for c7222::GpioOut:
Inheritance graph
Collaboration diagram for c7222::GpioOut:
Collaboration graph

Classes

struct  Config
 Configuration structure for output GPIO setup. More...
 

Public Member Functions

 GpioOut (uint32_t pin)
 Create a GPIO output with default configuration.
 
virtual ~GpioOut ()
 Destructor.
 
 GpioOut (uint32_t pin, const Config &config)
 Create a GPIO output with the given configuration.
 
void Configure (const Config &config)
 Apply a new configuration.
 
void Write (bool value)
 Write an output value.
 
void Toggle ()
 Toggle the pin output.
 
uint32_t GetPin () const
 Return the GPIO number.
 
Config GetConfig () const
 Return the cached configuration.
 
- Public Member Functions inherited from c7222::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 
- Public Member Functions inherited from c7222::NonMovable
 NonMovable (const NonMovable &)=default
 
NonMovableoperator= (const NonMovable &)=default
 
 NonMovable (NonMovable &&)=delete
 
NonMovableoperator= (NonMovable &&)=delete
 

Protected Member Functions

void ApplyConfig ()
 Apply internal configuration to the hardware.
 
- Protected Member Functions inherited from c7222::NonCopyableNonMovable
 NonCopyableNonMovable ()=default
 
 ~NonCopyableNonMovable ()=default
 
- Protected Member Functions inherited from c7222::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 
- Protected Member Functions inherited from c7222::NonMovable
 NonMovable ()=default
 
 ~NonMovable ()=default
 

Protected Attributes

uint32_t pin_
 GPIO pin number managed by this instance.
 
Config config_
 Cached configuration used to (re)apply platform settings.
 

Detailed Description

GPIO output-only wrapper with output configuration and drive strength.

This class owns an output pin configuration and exposes Write()/Toggle(). Output configuration includes output type (push-pull vs. open-drain), pull mode, drive strength, and the initial output state.

Constructor & Destructor Documentation

◆ GpioOut() [1/2]

c7222::GpioOut::GpioOut ( uint32_t  pin)
inlineexplicit

Create a GPIO output with default configuration.

◆ ~GpioOut()

virtual c7222::GpioOut::~GpioOut ( )
virtual

Destructor.

Platform backends may use this to unregister the pin from internal maps.

◆ GpioOut() [2/2]

c7222::GpioOut::GpioOut ( uint32_t  pin,
const Config config 
)
explicit

Create a GPIO output with the given configuration.

Parameters
pinGPIO number.
configInitial configuration.

Member Function Documentation

◆ ApplyConfig()

void c7222::GpioOut::ApplyConfig ( )
protected

Apply internal configuration to the hardware.

Implemented by the platform backend.

◆ Configure()

void c7222::GpioOut::Configure ( const Config config)

Apply a new configuration.

Parameters
configNew configuration.

◆ GetConfig()

Config c7222::GpioOut::GetConfig ( ) const
inline

Return the cached configuration.

◆ GetPin()

uint32_t c7222::GpioOut::GetPin ( ) const
inline

Return the GPIO number.

◆ Toggle()

void c7222::GpioOut::Toggle ( )

Toggle the pin output.

◆ Write()

void c7222::GpioOut::Write ( bool  value)

Write an output value.

Parameters
valueLogic level to drive.

Member Data Documentation

◆ config_

Config c7222::GpioOut::config_
protected

Cached configuration used to (re)apply platform settings.

◆ pin_

uint32_t c7222::GpioOut::pin_
protected

GPIO pin number managed by this instance.


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