Bare Metal Programming Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Types | Static Public Member Functions | List of all members
bmptk::hardware::port_buffer_in_out< channel > Class Template Reference

template for a buffered 8-bit input-output port More...

#include <ports.h>

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

Public Types

typedef single_pin< 0 > pin_0
 pin 0, input-output
 
typedef single_pin< 1 > pin_1
 pin 1, input-output
 
typedef single_pin< 2 > pin_2
 pin 2, input-output
 
typedef single_pin< 3 > pin_3
 pin 3, input-output
 
typedef single_pin< 4 > pin_4
 pin 4, input-output
 
typedef single_pin< 5 > pin_5
 pin 5, input-output
 
typedef single_pin< 6 > pin_6
 pin 6, input-output
 
typedef single_pin< 7 > pin_7
 pin 7, input-output
 
- Public Types inherited from bmptk::hardware::port_in_out
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 void set (unsigned int x)
 set the curret level on the pins in the port
 
static int n_pins ()
 return the number of pins in this port (8)
 
static unsigned int get ()
 get the current values of the pins in the port
 
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 Public Member Functions inherited from bmptk::hardware::port_in_out
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

template<typename channel>
class bmptk::hardware::port_buffer_in_out< channel >

template for a buffered 8-bit input-output port

This template must be instantiated with a port_buffered_in_out_channel that implements the access to the chip that has the pins.

Definition at line 738 of file ports.h.

Member Function Documentation

template<typename channel >
static void bmptk::hardware::port_buffer_in_out< channel >::direction_set_input ( )
inlinestatic

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.

Definition at line 814 of file ports.h.

template<typename channel >
static void bmptk::hardware::port_buffer_in_out< channel >::direction_set_output ( )
inlinestatic

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.

Definition at line 820 of file ports.h.

template<typename channel >
static unsigned int bmptk::hardware::port_buffer_in_out< channel >::get ( )
inlinestatic

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.

Definition at line 808 of file ports.h.

template<typename channel >
static void bmptk::hardware::port_buffer_in_out< channel >::init ( )
inlinestatic

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().

Definition at line 792 of file ports.h.

template<typename channel >
static void bmptk::hardware::port_buffer_in_out< channel >::set ( unsigned int  x)
inlinestatic

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.

Definition at line 797 of file ports.h.


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