Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

SPI Digital I/O
[Device Driver API.]

SPI controlled digital input and output ports. More...

Functions

void SpiDigitalInit (u_char *inputs, u_char *outputs)
 Initialize the digital I/O interface.

u_long SpiDigitalGet (u_char num)
 Query digital inputs and outputs.

void SpiDigitalSet (u_char num, u_long bits)
 Set digital outputs.


Detailed Description

SPI controlled digital input and output ports.

This simple driver supports digital I/O ports like relay outputs and optocoupler inputs.


Function Documentation

u_long SpiDigitalGet u_char    num
 

Query digital inputs and outputs.

If both inputs and outputs are installed, typically the inputs are represented by the most signigficant bits.

SpiDigitalInit() must have been called by the application before calling this function.

Parameters:
num  Number of bits to query, either 8, 16, 24 or 32.
Returns:
Binary value of the requested inputs.
Examples:
optoin/optoin.c, and relays/relays.c.

void SpiDigitalInit u_char   inputs,
u_char   outputs
 

Initialize the digital I/O interface.

Automatically detects the number of digital inputs and outputs.

Parameters:
inputs  Pointer to an 8-bit value, where the number of detected inputs will be stored.
outputs  Pointer to an 8-bit value, where the number of detected outputs will be stored.
Examples:
optoin/optoin.c, and relays/relays.c.

void SpiDigitalSet u_char    num,
u_long    bits
 

Set digital outputs.

Although possible, it makes no sense to set digital inputs.

SpiDigitalInit() must have been called by the application before calling this function.

Parameters:
num  Number of bits to set, either 8, 16, 24 or 32.
bits  The bit value to be set
Examples:
relays/relays.c.


© 2000-2002 by egnite Software GmbH - visit http://www.ethernut.de/