Main Page   File List   Sources   File Members  

pinapi.c File Reference

PINAPI - implementation. More...


Functions

void init_pins ()
Enable programmable chip selects for Pin 0-6 and does an initialization for Pin 7.

bool getPinStatus (int pin)
Returns the status of the given pin. More...

byte getAllPinStatus ()
Returns the status of all pins as a byte value. More...

char* getAllPinStatus_string ()
Returns the status of all pins as a string. More...

void setPin (int pin, bool set)
Sets the given pin to the given logical value. More...

void setAllPins (byte set)
Sets the status of all pins through the given number. More...

void setAllPins_string (char* setString)
An easy function for setting the pins. More...


Variables

char pinstring [9]
saves the actual on/off states of the pins for returning by getAllPinStatus_string function. More...

int init
shows wether the init_pins func was called before. More...


Detailed Description

PINAPI - implementation.

Author(s):
Christian Decker (cdecker@teco.edu)

Development System: Turbo C++ 3.0

Licence: GPL

This API was developed for easy handling the IO pins of the IPC of the SC12 from Beck GmbH. The code was inspired from a snippet which I found in the examples delivered with the original API descriptions from Beck.

This API contains functions for set the pins to the On/Off status and for query their status.

Thanks to Jonny Jonas (jonas@timecontrol.de) and Marc-Rene Seeberger (Marc-Rene.Seeberger@ascom.ch) for their DK40 code snippets for controlling the IO pin 7.

This version runs under BIOS 0.66 and 0.67.

See also:
http://www.beck-ipc.com/ , http://www.teco.edu/~cdecker/ , cdecker@teco.edu

Definition in file pinapi.c.


Function Documentation

void init_pins ()

Enable programmable chip selects for Pin 0-6 and does an initialization for Pin 7.

Definition at line 52 of file pinapi.c.

bool getPinStatus (int pin)

Returns the status of the given pin.

Parameters:
pin   is a number between 0 and 7
Returns:
greater 0 if voltage is so high as the webchip need to recognize a logical 1, otherwise 0

Definition at line 66 of file pinapi.c.

byte getAllPinStatus ()

Returns the status of all pins as a byte value.

For example: Assume that pin 0 and 1 are set to logical 1 and all others are set to 0. So you got with this function an byte 3 (00000011b).

Returns:
returns the status of all pins as byte value.

Definition at line 84 of file pinapi.c.

char * getAllPinStatus_string ()

Returns the status of all pins as a string.

Within the string 1 means pinset and 0 means pinunset. The first char in the string means pin0, the second pin2,...

Returns:
the pinstatus as a string.

Definition at line 93 of file pinapi.c.

void setPin (int pin, bool set)

Sets the given pin to the given logical value.

Parameters:
pin   is a number between 0 and 7
set   give 0 for setting a logical 0 or give 1 for setting a logical 1

Definition at line 119 of file pinapi.c.

void setAllPins (byte set)

Sets the status of all pins through the given number.

For example: If you want to set pin 0 and 1 to a logical 1 and all others to 0, you will give a 3 as parameter.

Parameters:
set   the mask as byte number for setting the pins

Definition at line 159 of file pinapi.c.

void setAllPins_string (char * setString)

An easy function for setting the pins.

You can give the logical 1 or 0 for every pin as char 0 or 1. For example you want to set pin 0 and 1 to logical 1 and all others to logical 0 then you define the setString as "11000000". That ist easier for humans I think. If you want to set pins in binary format you can use the setAllPins function.

Parameters:
setString   with first char is the first pin and so on

Definition at line 178 of file pinapi.c.


Variable Documentation

char pinstring[9] [static]

saves the actual on/off states of the pins for returning by getAllPinStatus_string function.

See also:
getAllPinStatus_string()

Definition at line 40 of file pinapi.c.

int init [static]

shows wether the init_pins func was called before.

See also:
init_pins()

Definition at line 46 of file pinapi.c.


Generated at Fri Aug 4 18:43:33 2000 for PINAPI by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999