Bare Metal Programming Tool Kit
|
input-output pin interface More...
#include <pins.h>
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 | |
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.
|
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 |
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 |
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 |
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 |
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.