Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Types | Static Public Member Functions | List of all members
bmptk::hardware::pin_in_out Struct Reference

input-output pin interface More...

#include <pins.h>

Inheritance diagram for bmptk::hardware::pin_in_out:
bmptk::hardware::pin_in_out_from< pin >

Public Types

enum  { type = type_pin_in_out }
 identify this type as a type_pin_in_out
 
enum  { features = has_none }
 this type has no additional fatures
 

Static Public Member Functions

static void init ()
 initialize the pin
 
static void direction_set_input ()
 set the direction of the pin to input
 
static void direction_set_output ()
 set the direction of the pin to output
 
static bool get ()
 get the current level on the pin
 
static void set (bool x)
 set the current level on the pin
 

Detailed Description

input-output pin interface

This class defines the interface of a pin that can be configured for use as either input or output.

This class is to be used as parent class for classes that provide the pin_in_out interface.

Definition at line 113 of file pins.h.

Member Function Documentation

static void bmptk::hardware::pin_in_out::direction_set_input ( )
static

set the direction of the pin to input

This method call sets the direction of the pin to input. The init() method must have been called first.

static void bmptk::hardware::pin_in_out::direction_set_output ( )
static

set the direction of the pin to output

This method call sets the direction of the pin to output. The init() method must have been called first.

static bool bmptk::hardware::pin_in_out::get ( )
static

get the current level on the pin

This method returns the current level on the input pin. When the level is a logic one (high voltage, Vdd) the returned value is true, otherwise (logic zero, low level, Vss) the value false is returned.The init() method must be called first. After calling init(), the direction must be set to input by calling direction_set_input().

static void bmptk::hardware::pin_in_out::init ( )
static

initialize the pin

This method initializes the pin as an input/output pin. This might involve configuring the pin as gpio, and disabling analog or other special functions. Note that it does not involve setting the pin to a known direction, but in general microcontroller pins will default to input after a reset.

static void bmptk::hardware::pin_in_out::set ( bool  x)
static

set the current level on the pin

This method sets the current level output by the pin. When the value is true a logic one (high voltage, Vdd) will appear on the pin, when the value if false a the pin will output a logic zero (low voltage, Vss).The init() method must be called first. After calling init(), the direction must be set to output by calling direction_set_output().

Note that a set() call on a pin that is not yet set to output might not have any effect.


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