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

open_collector input-output pin interface More...

#include <pins.h>

Inheritance diagram for bmptk::hardware::pin_oc:
bmptk::hardware::pin_oc_from< pin >

Public Types

enum  { type = type_pin_oc }
 identify this type as a type_pin_oc
 
enum  { features = has_none }
 this type has no additional fatures
 

Static Public Member Functions

static void init ()
 initialize the pin
 
static void set (bool x)
 set the current level on the pin
 
static bool get ()
 get the current level on the pin
 

Detailed Description

open_collector input-output pin interface

This class defines the interface of a pin that can only sink (not source) current, and can be an input too. Such a pin is typically used on a multi-drop bus with a pull-up resistor.

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

Definition at line 166 of file pins.h.

Member Function Documentation

static bool bmptk::hardware::pin_oc::get ( )
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.

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

static void bmptk::hardware::pin_oc::init ( )
static

initialize the pin

This method initializes the pin as an open-collector/input 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 level, but in general microcontroller pins will default to input after a reset, which corresponds to a high level for an open-collector pin with an external pull-up resistor.

static void bmptk::hardware::pin_oc::set ( bool  x)
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.

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: