Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
SN74HC595GPO< N > Class Template Reference

General Purpose Output (GPO) instance on the 74HC595. More...

#include <SN74HC595GPO.hxx>

Inheritance diagram for SN74HC595GPO< N >:
Gpio

Public Member Functions

constexpr SN74HC595GPO (SN74HC595< N > *instance, uint8_t chip_index, uint8_t bit)
 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.
 
- 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 (SN74HC595GPO)
 

Private Attributes

SN74HC595< N > *const instance_
 reference to chip instance
 
const uint8_t chipIndex_
 index on the bus for the chip
 
const uint8_t bit_
 bit number representative of the bit
 

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

template<uint8_t N>
class SN74HC595GPO< N >

General Purpose Output (GPO) instance on the 74HC595.

Template Parameters
Nnumber of chips on the bus, starting at 1

Definition at line 164 of file SN74HC595GPO.hxx.

Constructor & Destructor Documentation

◆ SN74HC595GPO()

template<uint8_t N>
constexpr SN74HC595GPO< N >::SN74HC595GPO ( SN74HC595< N > *  instance,
uint8_t  chip_index,
uint8_t  bit 
)
inlineconstexpr

Constructor.

Parameters
instanceparrent 74HC595 instance that "owns" the interface.
chip_indexindex on the bus for the chip, starting at 0.
bitbit index (0 through 7) of the output.

Definition at line 171 of file SN74HC595GPO.hxx.

Member Function Documentation

◆ clr()

template<uint8_t N>
void SN74HC595GPO< N >::clr ( ) const
inlineoverridevirtual

Clears the GPO pin to low.

Implements Gpio.

Definition at line 210 of file SN74HC595GPO.hxx.

◆ direction()

template<uint8_t N>
Direction SN74HC595GPO< N >::direction ( ) const
inlineoverridevirtual

Gets the GPO direction.

Returns
always returns DOUTPUT

Implements Gpio.

Definition at line 228 of file SN74HC595GPO.hxx.

◆ read()

template<uint8_t N>
Value SN74HC595GPO< N >::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 193 of file SN74HC595GPO.hxx.

◆ set()

template<uint8_t N>
void SN74HC595GPO< N >::set ( ) const
inlineoverridevirtual

Sets the GPO pin to high.

Implements Gpio.

Definition at line 200 of file SN74HC595GPO.hxx.

◆ set_direction()

template<uint8_t N>
void SN74HC595GPO< N >::set_direction ( Gpio::Direction  dir) const
inlineoverridevirtual

Sets the GPO direction (does nothing).

Parameters
dirDINPUT or DOUTPUT

Implements Gpio.

Definition at line 221 of file SN74HC595GPO.hxx.

◆ write()

template<uint8_t N>
void SN74HC595GPO< N >::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 186 of file SN74HC595GPO.hxx.

Member Data Documentation

◆ bit_

template<uint8_t N>
const uint8_t SN74HC595GPO< N >::bit_
private

bit number representative of the bit

Definition at line 241 of file SN74HC595GPO.hxx.

◆ chipIndex_

template<uint8_t N>
const uint8_t SN74HC595GPO< N >::chipIndex_
private

index on the bus for the chip

Definition at line 238 of file SN74HC595GPO.hxx.

◆ instance_

template<uint8_t N>
SN74HC595<N>* const SN74HC595GPO< N >::instance_
private

reference to chip instance

Definition at line 235 of file SN74HC595GPO.hxx.


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