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 | ) |
|
Current accuracy is 10 bits.
- Parameters:
-
fd | filedescriptor for opened analog ports |
ad | pointer to a BCS_IO_ad variable which will contain all values |
- Parameters:
-
filedescriptor | |
pin | the pin you want to check, minimum is 0, maximum 7 |
- Returns:
- BCS_IO_state value
- Parameters:
-
- Returns:
- byte whoms bits represent the pins of a port. 1 is high, 0 is low.
- Parameters:
-
fd | unused filedescriptor variable |
- Returns:
- BCS_ERR_GENERAL, BCS_ERR_OK
- Parameters:
-
fd | Pointer to an unused BCS Filedescriptor |
device | string of device |
- Returns:
- BCS_ERR_OK, BCS_ERR_GENERAL
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:
-
fd | Pointer to an unused BCS Filedescriptor |
device | string of device |
outputs | an 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
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 | |
pin | the pin you want to check, minimum is 0, maximum 7 |
- Returns:
- BCS_IO_state value
- Parameters:
-
fd | pointer to a filedescriptor describing a port configured as output |
pin | selection of the used pin |
s | state to set the pin to |
- Returns:
- BCS_ERR_OK, BCS_ERR_GENERAL
- Parameters:
-
fd | pointer to a filedescriptor describing a port configured as output |
mask | the port will be set to |
- Returns:
- BCS_ERR_OK, BCS_ERR_GENERAL