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_oc Struct Reference

open-collector port interface More...

#include <ports.h>

Inheritance diagram for bmptk::hardware::port_oc:
bmptk::hardware::port_buffer_oc< channel > bmptk::hardware::port_oc_from_pins<> bmptk::hardware::port_buffer_oc< pcf8574x_channel< bus, 0x40, address > > bmptk::hardware::port_buffer_oc< pcf8574x_channel< bus, 0x70, address > > bmptk::chips::pcf8574< bus, address > bmptk::chips::pcf8574a< bus, address >

Public Types

enum  { type = type_port_oc }
 identify this type as a type_port_oc
 
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 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

open-collector port interface

This class defines the interface of a port which consists (at least conceptually) of 0..32 open-collector pins (each as defined by the pin_oc interface).

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

Definition at line 185 of file ports.h.

Member Function Documentation

static unsigned int bmptk::hardware::port_oc::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.

Note that after setting a pin low(0) the pin will in all probability read as 0, so this call only makes realy sense for pins set high (1) call.

static void bmptk::hardware::port_oc::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.

static int bmptk::hardware::port_oc::n_pins ( )
static

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

static void bmptk::hardware::port_oc::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.

Setting the pin to 0 causes the pin to be pulled low. Setting a pin to 1 causes the pin to float.


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