Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
CC3200Gpio< GPIO_BASE, GPIO_PIN > Class Template Reference

Generic GPIO class implementation. More...

#include <CC3200GPIO.hxx>

Inheritance diagram for CC3200Gpio< GPIO_BASE, GPIO_PIN >:
Gpio

Public Member Functions

constexpr CC3200Gpio ()
 This constructor is constexpr which ensures that the object can be initialized in the data section.
 
void write (Value new_state) const OVERRIDE
 Writes a GPIO output pin (set or clear to a specific state).
 
void set () const OVERRIDE
 Sets the GPIO output pin to high.
 
void clr () const OVERRIDE
 Clears the GPIO output pin to low.
 
Value read () const OVERRIDE
 Retrieves the current Value of a GPIO input pin.
 
void set_direction (Direction dir) const OVERRIDE
 Sets the GPIO direction.
 
Direction direction () const OVERRIDE
 Gets the GPIO 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

constexpr volatile uint8_t * pin_address () const
 Computes the memory address where the bit referring to this pin can be accessed.
 

Static Private Attributes

static const CC3200Gpio instance_
 Static instance variable that can be used for libraries expectiong a generic Gpio pointer.
 

Friends

template<class Defs , bool SAFE_VALUE>
struct GpioOutputPin
 
template<class Defs >
struct GpioInputPin
 

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<unsigned GPIO_BASE, unsigned GPIO_PIN>
class CC3200Gpio< GPIO_BASE, GPIO_PIN >

Generic GPIO class implementation.

Definition at line 74 of file CC3200GPIO.hxx.

Constructor & Destructor Documentation

◆ CC3200Gpio()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
constexpr CC3200Gpio< GPIO_BASE, GPIO_PIN >::CC3200Gpio ( )
inlineconstexpr

This constructor is constexpr which ensures that the object can be initialized in the data section.

Definition at line 79 of file CC3200GPIO.hxx.

Member Function Documentation

◆ clr()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
void CC3200Gpio< GPIO_BASE, GPIO_PIN >::clr ( ) const
inlinevirtual

Clears the GPIO output pin to low.

See note at the top of the file about barriers.

Implements Gpio.

Definition at line 97 of file CC3200GPIO.hxx.

◆ direction()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
Direction CC3200Gpio< GPIO_BASE, GPIO_PIN >::direction ( ) const
inlinevirtual

Gets the GPIO direction.

Returns
INPUT or OUTPUT

Implements Gpio.

Definition at line 121 of file CC3200GPIO.hxx.

◆ pin_address()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
constexpr volatile uint8_t * CC3200Gpio< GPIO_BASE, GPIO_PIN >::pin_address ( ) const
inlineconstexprprivate

Computes the memory address where the bit referring to this pin can be accessed.

This address is bit-masked to the single individual pin, so only ever one bit can be read to be non-zero, and setting any other bit than the desired has no effect. This allows write with 0xff and 0x00 to set/clear and read != 0 to test.

Returns
memory address.

Definition at line 150 of file CC3200GPIO.hxx.

◆ read()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
Value CC3200Gpio< GPIO_BASE, GPIO_PIN >::read ( ) const
inlinevirtual

Retrieves the current Value of a GPIO input pin.

Returns
SET if currently high, CLR if currently low.

Implements Gpio.

Definition at line 104 of file CC3200GPIO.hxx.

◆ set()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
void CC3200Gpio< GPIO_BASE, GPIO_PIN >::set ( ) const
inlinevirtual

Sets the GPIO output pin to high.

See note at the top of the file about barriers.

Implements Gpio.

Definition at line 90 of file CC3200GPIO.hxx.

◆ set_direction()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
void CC3200Gpio< GPIO_BASE, GPIO_PIN >::set_direction ( Direction  dir) const
inlinevirtual

Sets the GPIO direction.

Parameters
dirINPUT or OUTPUT

Implements Gpio.

Definition at line 109 of file CC3200GPIO.hxx.

◆ write()

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
void CC3200Gpio< GPIO_BASE, GPIO_PIN >::write ( Value  new_state) const
inlinevirtual

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

Parameters
new_statethe desired output state. See Value.

See note at the top of the file about barriers.

Implements Gpio.

Definition at line 83 of file CC3200GPIO.hxx.

Friends And Related Symbol Documentation

◆ GpioInputPin

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
template<class Defs >
friend struct GpioInputPin
friend

Definition at line 137 of file CC3200GPIO.hxx.

◆ GpioOutputPin

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
template<class Defs , bool SAFE_VALUE>
friend struct GpioOutputPin
friend

Definition at line 136 of file CC3200GPIO.hxx.

Member Data Documentation

◆ instance_

template<unsigned GPIO_BASE, unsigned GPIO_PIN>
const CC3200Gpio< GPIO_BASE, GPIO_PIN > CC3200Gpio< GPIO_BASE, GPIO_PIN >::instance_
staticprivate

Static instance variable that can be used for libraries expectiong a generic Gpio pointer.

Defines the linker symbol for the wrapped Gpio instance.

This instance variable will be initialized by the linker and (assuming the application developer initialized the hardware pins in hw_preinit) is accessible, including virtual methods at static constructor time.

Definition at line 143 of file CC3200GPIO.hxx.


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