Bare Metal Programming Tool Kit
|
input-output port interface More...
#include <ports.h>
Public Types | |
enum | { type = type_port_in_out } |
identify this type as a type_port_in_out | |
enum | { features = has_none } |
this type has no additional fatures | |
Static Public Member Functions | |
static void | init () |
initialize the port as input | |
static int | n_pins () |
the number of pins in the port, can be 0..32. | |
static void | direction_set_input () |
set the direction of the port to input | |
static void | direction_set_output () |
set the direction of the port to output | |
static void | set (unsigned int d) |
set the curret level on the pins in the port | |
static unsigned int | get () |
get the current values of the pins in the port | |
input-output port interface
This class defines the interface of a port, that can be used as input and as output, which consists (at least conceptually) of 0..32 output pins (each as defined by the pin_out interface).
This class is to be used as parent class for classes that provide the port_in_out interface.
|
static |
set the direction of the port to input
This method call sets the direction of the pin in the port to input. The init() method must have been called first.
|
static |
set the direction of the port to output
This method call sets the direction of the pin in the port to output. The init() method must have been called first.
|
static |
get the current values of the pins in the port
This method returns the current level on the pins that make up the port, encoded in the bits in the returned value. The value pin of pin N is returned in the Nth bit.When the level is a logic one (high voltage, Vdd) the bit in the returned value is 1, otherwise (logic zero, low level, Vss) the bit is 0.The init() method must be called first. After that, set_direction_input() (or the equivalent set_direction(input)) must have been called, after the last set_direction_output() (or set_direction(output)) call.
|
static |
initialize the port as input
This method initializes all pins of the port as input pins. This might involve configuring the pins as gpio, and disabling analog or other special functions. Note that this method does not set the direction, for that must call set_direction(d), set_direction_input() or set_direction_output().
|
static |
the number of pins in the port, can be 0..32.
|
static |
set the curret level on the pins in the port
This method sets the current level output by each pin that makes up the port, encoded in the bits in parameter value. The value pin of pin N is determined by the Nth bit.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 that, set_direction_output() (or set_direction(output)) must have been called, after the last set_direction_input() (or set_direction(input)) call.