Main Page | Directories | File List | Globals | Examples

bsOCOutputDevice.h File Reference

interface to the open collector output device BM7002. More...

#include <bluemelon/types.h>
#include <bluesense/external/bsDeviceTable.h>

Typedefs

typedef _bsOCOutputDevice_specificsStruct * bsOCOutputDevice_specifics_t

Enumerations

enum  bsOCOutputDevice_portEnum

Functions

DECLSPEC bsOCOutputDevice_specifics_t bsOCOutputDevice_getDeviceSpecifics (bsDeviceTable_deviceInfo_t deviceInstancePtr)
DECLSPEC uint8_t bsOCOutputDevice_getCurrentPWMDutyCycle (bsOCOutputDevice_specifics_t oco, bsOCOutputDevice_portEnum port)
DECLSPEC void bsOCOutputDevice_getCurrentPWMDutyCycles (bsOCOutputDevice_specifics_t oco, uint8_t *dutyCycles)
DECLSPEC uint8_t bsOCOutputDevice_getCurrentOutput (bsOCOutputDevice_specifics_t oco, bsOCOutputDevice_portEnum port)
DECLSPEC uint16_t bsOCOutputDevice_getCurrentOutputs (bsOCOutputDevice_specifics_t oco)
DECLSPEC uint8_t bsOCOutputDevice_requestGetOutputs (bsOCOutputDevice_specifics_t oco)
DECLSPEC uint8_t bsOCOutputDevice_getRequestGetOutputsDone (bsOCOutputDevice_specifics_t oco)
DECLSPEC uint8_t bsOCOutputDevice_getRequestSetOutputsDone (bsOCOutputDevice_specifics_t oco)
DECLSPEC uint8_t bsOCOutputDevice_requestSetOutputs (bsOCOutputDevice_specifics_t oco, uint16_t relevantBits, uint16_t outputs)
DECLSPEC uint8_t bsOCOutputDevice_requestSetOutput (bsOCOutputDevice_specifics_t oco, bsOCOutputDevice_portEnum port, uint8_t output)
DECLSPEC uint8_t bsOCOutputDevice_requestSetPWMDutyCycle (bsOCOutputDevice_specifics_t oco, bsOCOutputDevice_portEnum port, uint8_t dutyCycle)
DECLSPEC uint8_t bsOCOutputDevice_requestSetPWMDutyCycles (bsOCOutputDevice_specifics_t oco, uint16_t relevantPWMDutyCycles, uint8_t *dutyCycles)
DECLSPEC uint16_t bsOCOutputDevice_getPendingOutputs (bsOCOutputDevice_specifics_t oco)
DECLSPEC uint8_t bsOCOutputDevice_getPendingOutput (bsOCOutputDevice_specifics_t oco, bsOCOutputDevice_portEnum port)
DECLSPEC uint8_t bsOCOutputDevice_getPendingPWMDutyCycle (bsOCOutputDevice_specifics_t oco, bsOCOutputDevice_portEnum port)
void bsOCOutputDevice_getPendingPWMDutyCycles (bsOCOutputDevice_specifics_t oco, uint8_t *dutyCycles)
DECLSPEC void bsOCOutputDevice_setTimeOutUs (bsOCOutputDevice_specifics_t oco, uint32_t timeOutUs)
DECLSPEC uint32_t bsOCOutputDevice_getTimeOutUs (bsOCOutputDevice_specifics_t oco)
DECLSPEC void bsOCOutputDevice_reset (bsOCOutputDevice_specifics_t oco)


Detailed Description

interface to the open collector output device BM7002.

The BM7002 enables you to switch so called 'open collector' outputs. This opens up possibilities to directly switch small lights, relays, solenoids or other components which have their own power supply. By routing positive voltage connection of your own power supply to the board you can use the boards internal diodes. This allows you to switch an inductive load, for example a relay without any components!


Typedef Documentation

typedef struct _bsOCOutputDevice_specificsStruct* bsOCOutputDevice_specifics_t
 

This (opaque) structure represents the device specific data of an OCOutputDevice

Examples:
analogue_in.c, blink_output.c, set_ocoutput.c, and set_ocoutputpwm.c.


Enumeration Type Documentation

enum bsOCOutputDevice_portEnum
 

Enumeration describing the open collector output ports


Function Documentation

DECLSPEC uint8_t bsOCOutputDevice_getCurrentOutput bsOCOutputDevice_specifics_t  oco,
bsOCOutputDevice_portEnum  port
 

Returns the state of an output pin 'port'

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
port the port to read.

DECLSPEC uint16_t bsOCOutputDevice_getCurrentOutputs bsOCOutputDevice_specifics_t  oco  ) 
 

Returns the multiplexed states of the outputs

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
Examples:
set_ocoutput.c, and set_ocoutputpwm.c.

DECLSPEC uint8_t bsOCOutputDevice_getCurrentPWMDutyCycle bsOCOutputDevice_specifics_t  oco,
bsOCOutputDevice_portEnum  port
 

Firmware: version 2+ Returns the PWM duty cycle of a 'port'

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
port the port to read.
Returns:
the duty cycle of the PWM signal. 0 means that PWM is disabled on this port
Examples:
set_ocoutputpwm.c.

DECLSPEC void bsOCOutputDevice_getCurrentPWMDutyCycles bsOCOutputDevice_specifics_t  oco,
uint8_t *  dutyCycles
 

Firmware: version 2+ Returns the PWM duty cycles of the PWM signals

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
dutyCycles an array with enough space for all output pins.
See also:
BLUESENSE_OCOUTPUT_OUTPUTCOUNT

DECLSPEC bsOCOutputDevice_specifics_t bsOCOutputDevice_getDeviceSpecifics bsDeviceTable_deviceInfo_t  deviceInstancePtr  ) 
 

Returns a OCOutput device instance from a device info pointer (obtained from the device table).

Returns:
the instance of an OCOutput Interface. Or null if the device is inaccessible (eg. wrong type, not found).
Examples:
analogue_in.c, blink_output.c, set_ocoutput.c, and set_ocoutputpwm.c.

DECLSPEC uint8_t bsOCOutputDevice_getPendingOutput bsOCOutputDevice_specifics_t  oco,
bsOCOutputDevice_portEnum  port
 

Returns the 'tobe set' state of an output

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
port the output port.
Returns:
1 if the output will be activated, or 0 when it will be deactivated.

DECLSPEC uint16_t bsOCOutputDevice_getPendingOutputs bsOCOutputDevice_specifics_t  oco  ) 
 

Returns a bitmask containing which outputs are be set after the request finishes

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
Returns:
an uint16_t containing for each output a bit. If the bit is 1, then the output will be set when the request is completed

DECLSPEC uint8_t bsOCOutputDevice_getPendingPWMDutyCycle bsOCOutputDevice_specifics_t  oco,
bsOCOutputDevice_portEnum  port
 

Firmware: version 2+ Returns the PWM duty cycle of a 'port' which will be used when the request finishes

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
port the port to read.
Returns:
the duty cycle of the PWM signal. 0 means that PWM is disabled on this port

void bsOCOutputDevice_getPendingPWMDutyCycles bsOCOutputDevice_specifics_t  oco,
uint8_t *  dutyCycles
 

Firmware: version 2+ Returns the PWM duty cycles of the PWM signals which are cyrrently in the process of being sent to the module.

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
dutyCycles an array with enough space for all output pins.
See also:
BLUESENSE_OCOUTPUT_OUTPUTCOUNT

DECLSPEC uint8_t bsOCOutputDevice_getRequestGetOutputsDone bsOCOutputDevice_specifics_t  oco  ) 
 

Checks if the output/pwm get request is finished

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
Returns:
1 if request finished, 0 if request still busy

DECLSPEC uint8_t bsOCOutputDevice_getRequestSetOutputsDone bsOCOutputDevice_specifics_t  oco  ) 
 

Checks if the output/pwm set request is finished

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
Returns:
1 if request finished, 0 if request still busy

DECLSPEC uint32_t bsOCOutputDevice_getTimeOutUs bsOCOutputDevice_specifics_t  oco  ) 
 

Returns the current set time out delay. The time out delay is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
Returns:
the time out value in microseconds.

DECLSPEC uint8_t bsOCOutputDevice_requestGetOutputs bsOCOutputDevice_specifics_t  oco  ) 
 

Sends a request to retrieve the current set output/pwm states

Parameters:
oco a pointer to the OCOutputDevice's instance specific data

DECLSPEC uint8_t bsOCOutputDevice_requestSetOutput bsOCOutputDevice_specifics_t  oco,
bsOCOutputDevice_portEnum  port,
uint8_t  output
 

Sends a request to set a single output to a new state

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
port the output port to set.
output the new state of the output. 1 activates, 0 disables.
Examples:
blink_output.c, and set_ocoutput.c.

DECLSPEC uint8_t bsOCOutputDevice_requestSetOutputs bsOCOutputDevice_specifics_t  oco,
uint16_t  relevantBits,
uint16_t  outputs
 

Sends a request to update the output states of the device.

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
relevantBits a bit mask indicating which outputs to update
outputs an uint16_t bit mask containing the new output states. Only those outputs will be updated for which a bit is set in the relevantBits parameter

DECLSPEC uint8_t bsOCOutputDevice_requestSetPWMDutyCycle bsOCOutputDevice_specifics_t  oco,
bsOCOutputDevice_portEnum  port,
uint8_t  dutyCycle
 

Firmware: version 2+ Returns the PWM frequency of a 'port'

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
port the port to read.
dutyCycle the duty cycle of the PWM signal. 0 means that PWM is disabled on this port
Examples:
set_ocoutputpwm.c.

DECLSPEC uint8_t bsOCOutputDevice_requestSetPWMDutyCycles bsOCOutputDevice_specifics_t  oco,
uint16_t  relevantPWMDutyCycles,
uint8_t *  dutyCycles
 

Firmware: version 2+ Returns the PWM frequency of a 'port'

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
relevantPWMDutyCycles a bit mask indicating which dutycycles to update
dutyCycles an array of size BLUESENSE_OCOUTPUT_OUTPUTCOUNT containing dutycycle values. A duty cycle of 0 means that PWM is disabled on the corresponding port.
See also:
BLUESENSE_OCOUTPUT_OUTPUTCOUNT

DECLSPEC void bsOCOutputDevice_reset bsOCOutputDevice_specifics_t  oco  ) 
 

Resets the device proxy to its initial state. The the actual device settings are requested from the module.

Parameters:
oco a pointer to the OCOutputDevice's instance specific data

DECLSPEC void bsOCOutputDevice_setTimeOutUs bsOCOutputDevice_specifics_t  oco,
uint32_t  timeOutUs
 

Sets the time out value which is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
oco a pointer to the OCOutputDevice's instance specific data
timeOutUs the value in microseconds which is the maximum duraion between a request and its answer.


Generated on Mon Jan 21 17:51:55 2008 for BlueSense by  doxygen 1.4.4