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::port_in_out Struct Reference

input-output port interface More...

#include <ports.h>

Inheritance diagram for bmptk::hardware::port_in_out:
bmptk::hardware::port_buffer_in_out< channel > bmptk::hardware::port_in_out_from_pins<>

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
 

Detailed Description

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.

Definition at line 132 of file ports.h.

Member Function Documentation

static void bmptk::hardware::port_in_out::direction_set_input ( )
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 void bmptk::hardware::port_in_out::direction_set_output ( )
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 unsigned int bmptk::hardware::port_in_out::get ( )
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 void bmptk::hardware::port_in_out::init ( )
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 int bmptk::hardware::port_in_out::n_pins ( )
static

the number of pins in the port, can be 0..32.

static void bmptk::hardware::port_in_out::set ( unsigned int  d)
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.


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