Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
PWMGPO Class Reference

General Purpose Output specialization of a PWM Bit. More...

#include <PWM.hxx>

Inheritance diagram for PWMGPO:
Gpio

Public Member Functions

 PWMGPO (PWM *instance, uint32_t on_counts, uint32_t off_counts)
 Constructor.
 
void write (Value new_state) const override
 Writes a GPO pin (set or clear to a specific state).
 
Value read () const override
 Retrieves the current Value of a GPO output sate (requested).
 
void set () const override
 Sets the GPO pin to high.
 
void clr () const override
 Clears the GPO pin to low.
 
void set_direction (Gpio::Direction dir) const override
 Sets the GPO direction (does nothing).
 
Direction direction () const override
 Gets the GPO direction.
 
uint32_t get_on_counts () const
 
uint32_t get_off_counts () const
 
- Public Member Functions inherited from Gpio
constexpr Gpio ()
 Constructor.
 
void write (bool new_state) const
 Writes a GPIO output pin (set or clear to a specific state).
 
bool is_set () const
 Tests the GPIO input pin to see if it is set.
 
bool is_clr () const
 Tests the GPIO input pin to see if it is clear.
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (PWMGPO)
 

Private Attributes

PWMinstance_
 PWM instance.
 
uint32_t onCounts_
 PWM counts for when the GPO is "on".
 
uint32_t offCounts_
 PWM counts for when the GPO is "off".
 

Additional Inherited Members

- Public Types inherited from Gpio
enum  Value : bool { CLR = false , SET = true , VLOW = CLR , VHIGH = SET }
 Defines the options for GPIO level. More...
 
enum class  Direction { DINPUT , DOUTPUT }
 Defines the options for GPIO direction. More...
 

Detailed Description

General Purpose Output specialization of a PWM Bit.

Definition at line 100 of file PWM.hxx.

Constructor & Destructor Documentation

◆ PWMGPO()

PWMGPO::PWMGPO ( PWM instance,
uint32_t  on_counts,
uint32_t  off_counts 
)
inline

Constructor.

Parameters
instancereference to the chip
on_countsPWM count for the "on" state
off_countsPWM count for the "off" state

Definition at line 107 of file PWM.hxx.

◆ ~PWMGPO()

virtual PWMGPO::~PWMGPO ( )
inlinevirtual

Definition at line 115 of file PWM.hxx.

Member Function Documentation

◆ clr()

void PWMGPO::clr ( ) const
inlineoverridevirtual

Clears the GPO pin to low.

Implements Gpio.

Definition at line 140 of file PWM.hxx.

◆ direction()

Direction PWMGPO::direction ( ) const
inlineoverridevirtual

Gets the GPO direction.

Returns
always returns OUTPUT

Implements Gpio.

Definition at line 154 of file PWM.hxx.

◆ get_off_counts()

uint32_t PWMGPO::get_off_counts ( ) const
inline

Definition at line 164 of file PWM.hxx.

◆ get_on_counts()

uint32_t PWMGPO::get_on_counts ( ) const
inline

Definition at line 159 of file PWM.hxx.

◆ read()

Value PWMGPO::read ( ) const
inlineoverridevirtual

Retrieves the current Value of a GPO output sate (requested).

Returns
SET if currently high, CLR if currently low

Implements Gpio.

Definition at line 128 of file PWM.hxx.

◆ set()

void PWMGPO::set ( ) const
inlineoverridevirtual

Sets the GPO pin to high.

Implements Gpio.

Definition at line 134 of file PWM.hxx.

◆ set_direction()

void PWMGPO::set_direction ( Gpio::Direction  dir) const
inlineoverridevirtual

Sets the GPO direction (does nothing).

Parameters
dirINPUT or OUTPUT

Implements Gpio.

Definition at line 147 of file PWM.hxx.

◆ write()

void PWMGPO::write ( Value  new_state) const
inlineoverridevirtual

Writes a GPO pin (set or clear to a specific state).

Parameters
new_statethe desired output state. See Value.

Implements Gpio.

Definition at line 121 of file PWM.hxx.

Member Data Documentation

◆ instance_

PWM* PWMGPO::instance_
private

PWM instance.

Definition at line 171 of file PWM.hxx.

◆ offCounts_

uint32_t PWMGPO::offCounts_
private

PWM counts for when the GPO is "off".

Definition at line 177 of file PWM.hxx.

◆ onCounts_

uint32_t PWMGPO::onCounts_
private

PWM counts for when the GPO is "on".

Definition at line 174 of file PWM.hxx.


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