libHartwer - Documentation
Data Structures | Enumerations | Functions

bcs_io.h File Reference

Routines for reading and modifying digital I/O as well as A/D ports. More...

Go to the source code of this file.

Data Structures

struct  BCS_IO_ad
 This struct is used when using analog inputs. More...

Enumerations

enum  BCS_IO_pinconfig
 

This enum is used for configuring port pins as in- or output.

More...
enum  BCS_IO_state { BCS_IO_LOW, BCS_IO_HIGH, BCS_IO_ERROR }
 

This enum defines possible return values when checking a special pin.

More...

Functions

void BCS_IO_closePort (BCS_ioport *filedescriptor)
 Closes the connection to a given port.
BCS_ERROR BCS_IO_getAnalogvalues (BCS_ioport *fd, BCS_IO_ad *ad)
 Measures voltage at all analog input ports and writes the calculated value into ad.
BCS_IO_state BCS_IO_getPinstatus (BCS_ioport *filedescriptor, UInt8 pin)
 Reads the status of a special pin - non blocking.
UInt8 BCS_IO_getStatus (BCS_ioport *filedescriptor)
 Reads the bitmask of a whole port - non blocking.
BCS_ERROR BCS_IO_openAnalog (BCS_ioport *fd)
 Opens available Analog Input ports.
BCS_ERROR BCS_IO_openAsInput (BCS_ioport *fd, const void *device)
 Opens a given deviceport for reading and configures the port as input.
BCS_ERROR BCS_IO_openConfigured (BCS_ioport *fd, const void *device, UInt8 outputs)
 Opens a given deviceport.
BCS_IO_state BCS_IO_pinTriggered (BCS_ioport *filedescriptor, UInt8 pin)
 Returns the status of a selected pin.
BCS_ERROR BCS_IO_setPinstatus (BCS_ioport *fd, UInt8 pin, BCS_IO_state s)
 Sets the given pin of a port to the given bitmask.
BCS_ERROR BCS_IO_setStatus (BCS_ioport *fd, UInt8 mask)
 Sets the given port to the given bitmask.

Detailed Description

Date:
20.03.2009
Author:
Elefant Racing This file is providing functions to get status of digital inputs

Enumeration Type Documentation

Give an ored value to set as output

Enumerator:
BCS_IO_LOW 

Requested Pin is low.

BCS_IO_HIGH 

Requested Pin is high.

BCS_IO_ERROR 

An error occured while reading pin value.


Function Documentation

void BCS_IO_closePort ( BCS_ioport filedescriptor)
Parameters:
filedescriptor
BCS_ERROR BCS_IO_getAnalogvalues ( BCS_ioport fd,
BCS_IO_ad ad 
)

Current accuracy is 10 bits.

Parameters:
fdfiledescriptor for opened analog ports
adpointer to a BCS_IO_ad variable which will contain all values
BCS_IO_state BCS_IO_getPinstatus ( BCS_ioport filedescriptor,
UInt8  pin 
)
Parameters:
filedescriptor
pinthe pin you want to check, minimum is 0, maximum 7
Returns:
BCS_IO_state value
UInt8 BCS_IO_getStatus ( BCS_ioport filedescriptor)
Parameters:
filedescriptor
Returns:
byte whoms bits represent the pins of a port. 1 is high, 0 is low.
BCS_ERROR BCS_IO_openAnalog ( BCS_ioport fd)
Parameters:
fdunused filedescriptor variable
Returns:
BCS_ERR_GENERAL, BCS_ERR_OK
BCS_ERROR BCS_IO_openAsInput ( BCS_ioport fd,
const void *  device 
)
Parameters:
fdPointer to an unused BCS Filedescriptor
devicestring of device
Returns:
BCS_ERR_OK, BCS_ERR_GENERAL
BCS_ERROR BCS_IO_openConfigured ( BCS_ioport fd,
const void *  device,
UInt8  outputs 
)

If the selected port is an I/O port, each pin can be configured as input as well as output. Use enum BCS_IO_pinconfig to configure them.

WARNING: Please be aware, that port 1 cannot be configured as output!

Parameters:
fdPointer to an unused BCS Filedescriptor
devicestring of device
outputsan ored selection of enum BCS_IO_pinconfig to configure them as output. All other pins will be configured as input automatically.
Returns:
BCS_ERR_OK, BCS_ERR_GENERAL
BCS_IO_state BCS_IO_pinTriggered ( BCS_ioport filedescriptor,
UInt8  pin 
)

In contrast to the other functions this one will ensure that the pin is really triggered and not put high by accident (e.g. flickering) or still put high from last check - non blocking

Parameters:
filedescriptor
pinthe pin you want to check, minimum is 0, maximum 7
Returns:
BCS_IO_state value
BCS_ERROR BCS_IO_setPinstatus ( BCS_ioport fd,
UInt8  pin,
BCS_IO_state  s 
)
Parameters:
fdpointer to a filedescriptor describing a port configured as output
pinselection of the used pin
sstate to set the pin to
Returns:
BCS_ERR_OK, BCS_ERR_GENERAL
BCS_ERROR BCS_IO_setStatus ( BCS_ioport fd,
UInt8  mask 
)
Parameters:
fdpointer to a filedescriptor describing a port configured as output
maskthe port will be set to
Returns:
BCS_ERR_OK, BCS_ERR_GENERAL

Generated on Fri Feb 11 2011 18:25:46 for libHartwer by Doxygen 1.7.3
Content © 2009-2011 Elefant Racing Bayreuth & MLBA (About) – Design © 2010 Emzeat. All Rights reserved.