Main Page | Directories | File List | Globals | Examples

bsSwitchInputDevice.h File Reference

Interface to the switchInputDevice BM7001. More...

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

Defines

#define SWITCH_INPUT_COUNT   12

Typedefs

typedef _bsSwitchInputDevice_specificsStruct * bsSwitchInputDevice_specifics_t

Enumerations

enum  bsSwitchInputDevice_portEnum
enum  bsSwitchInputDevice_rotaryEnum

Functions

DECLSPEC bsSwitchInputDevice_specifics_t bsSwitchInputDevice_getDeviceSpecifics (bsDeviceTable_deviceInfo_t deviceInstancePtr)
DECLSPEC uint8_t bsSwitchInputDevice_requestGetInputs (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint8_t bsSwitchInputDevice_getRequestGetInputsDone (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint32_t bsSwitchInputDevice_getSampleCount (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint8_t bsSwitchInputDevice_getLastSampledInput (bsSwitchInputDevice_specifics_t switchIn, bsSwitchInputDevice_portEnum port)
DECLSPEC uint16_t bsSwitchInputDevice_getLastSampledInputs (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC int32_t bsSwitchInputDevice_getLastSampledRotary (bsSwitchInputDevice_specifics_t switchIn, bsSwitchInputDevice_rotaryEnum rport)
DECLSPEC uint32_t bsSwitchInputDevice_getLastSampledCounter (bsSwitchInputDevice_specifics_t switchIn, bsSwitchInputDevice_portEnum port)
DECLSPEC uint8_t bsSwitchInputDevice_getRequestSetConfigDone (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint8_t bsSwitchInputDevice_getRequestGetConfigDone (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint8_t bsSwitchInputDevice_configPending (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint8_t bsSwitchInputDevice_usesBooleans (bsSwitchInputDevice_specifics_t switchIn, uint8_t side)
DECLSPEC uint8_t bsSwitchInputDevice_requestNeedsBooleans (bsSwitchInputDevice_specifics_t switchIn, uint8_t side, uint8_t needs)
DECLSPEC uint8_t bsSwitchInputDevice_usesRotary (bsSwitchInputDevice_specifics_t switchIn, bsSwitchInputDevice_rotaryEnum rport)
DECLSPEC uint8_t bsSwitchInputDevice_requestNeedsRotary (bsSwitchInputDevice_specifics_t switchIn, bsSwitchInputDevice_rotaryEnum rport, uint8_t needs)
DECLSPEC uint8_t bsSwitchInputDevice_usesCounter (bsSwitchInputDevice_specifics_t switchIn, bsSwitchInputDevice_portEnum port)
DECLSPEC uint8_t bsSwitchInputDevice_requestNeedsCounter (bsSwitchInputDevice_specifics_t switchIn, bsSwitchInputDevice_portEnum port, uint8_t needs)
DECLSPEC uint8_t bsSwitchInputDevice_requestSetConfiguration (bsSwitchInputDevice_specifics_t switchIn, uint8_t booleansMask, uint16_t rotaryMask, uint16_t counterMask)
uint8_t bsSwitchInputDevice_requestGetConfiguration (bsSwitchInputDevice_specifics_t switchIn)
void bsSwitchInputDevice_reset (bsSwitchInputDevice_specifics_t switchIn)
void bsSwitchInputDevice_setTimeOutUs (bsSwitchInputDevice_specifics_t switchIn, uint32_t timeOutUs)
DECLSPEC uint32_t bsSwitchInputDevice_getTimeOutUs (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint16_t bsSwitchInputDevice_getChangedInputsMask (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint16_t bsSwitchInputDevice_getChangedRotariesMask (bsSwitchInputDevice_specifics_t switchIn)
DECLSPEC uint16_t bsSwitchInputDevice_getChangedCountersMask (bsSwitchInputDevice_specifics_t switchIn)


Detailed Description

Interface to the switchInputDevice BM7001.

The BM7001 allows you to measure the state of 12 different switches. Besides 12 normal switch the device has been programmed with special software to support automatic measurement of up to six rotary encoders. This means that you don't have to write complicated code anymore. The device simply outputs a number which determines the state of the rotary encoder. Each input can have a configured counter which counts the number of switch state changes. Because these features have been implemented in the device itself you can be sure that your software won't miss any information.


Define Documentation

#define SWITCH_INPUT_COUNT   12
 

The number of switch input ports of a switchInputDevice


Typedef Documentation

typedef struct _bsSwitchInputDevice_specificsStruct* bsSwitchInputDevice_specifics_t
 

This (opaque) structure represents the device specific data of a switchInputDevice

Examples:
counter.c, rotary.c, and switch.c.


Enumeration Type Documentation

enum bsSwitchInputDevice_portEnum
 

This enumeration describes the swith output ports and counters. Eg. pA_1 is pin 1 on side A, pB_4 is pin 4 on side B.

enum bsSwitchInputDevice_rotaryEnum
 

This enumeration describes the rotary ports Eg. rA_1_2 is a rotary encoder connected to side A, pins 1 and 2.


Function Documentation

DECLSPEC uint8_t bsSwitchInputDevice_configPending bsSwitchInputDevice_specifics_t  switchIn  ) 
 

Checks if a configuration is being currently being set or being retrieved

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
Returns:
1 if busy, 0 if done

DECLSPEC uint16_t bsSwitchInputDevice_getChangedCountersMask bsSwitchInputDevice_specifics_t  switchIn  ) 
 

In the case of an event getChangedInputsMask returns an 8 bit value indicating which counters have changed. The mask is set to zero after calling this function. bit 0 set --> counter pA_1 changed

Parameters:
switchIn a pointer to the switchInput's instance specific data
Returns:
the mask

DECLSPEC uint16_t bsSwitchInputDevice_getChangedInputsMask bsSwitchInputDevice_specifics_t  switchIn  ) 
 

In the case of an event getChangedInputsMask returns an 8 bit value indicating which inputs have changed. The mask is set to zero after calling this function. bit 0 set --> input pA_1 changed

Parameters:
switchIn a pointer to the switchInput's instance specific data
Returns:
the mask

DECLSPEC uint16_t bsSwitchInputDevice_getChangedRotariesMask bsSwitchInputDevice_specifics_t  switchIn  ) 
 

In the case of an event getChangedInputsMask returns an 8 bit value indicating which rotary values have changed. The mask is set to zero after calling this function. bit 0 set --> rotary rA1_2 changed

Parameters:
switchIn a pointer to the switchInput's instance specific data
Returns:
the mask

DECLSPEC bsSwitchInputDevice_specifics_t bsSwitchInputDevice_getDeviceSpecifics bsDeviceTable_deviceInfo_t  deviceInstancePtr  ) 
 

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

Returns:
the instance of an SwitchInput Interface. Or null if the device is inaccessible (eg. wrong type, not found).
Examples:
counter.c, rotary.c, and switch.c.

DECLSPEC uint32_t bsSwitchInputDevice_getLastSampledCounter bsSwitchInputDevice_specifics_t  switchIn,
bsSwitchInputDevice_portEnum  port
 

returns the last received counter value

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
port at which the counter was installed.
See also:
bsSwitchInputDevice_portEnum
Returns:
the value of the counter.
Examples:
counter.c.

DECLSPEC uint8_t bsSwitchInputDevice_getLastSampledInput bsSwitchInputDevice_specifics_t  switchIn,
bsSwitchInputDevice_portEnum  port
 

returns the last taken bit sample on a specific port

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
port the swith port.
See also:
bsSwitchInputDevice_portEnum
Returns:
1 if port activated, 0 if inactive
Examples:
switch.c.

DECLSPEC uint16_t bsSwitchInputDevice_getLastSampledInputs bsSwitchInputDevice_specifics_t  switchIn  ) 
 

returns the last taken multiplexed bit sample. A multiplexed sample is built as: port[0]+port[1]*2+port[2]*4+port[3]*8+...+port[11]*2048

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
Returns:
the multiplexed sample containing the port states.

DECLSPEC int32_t bsSwitchInputDevice_getLastSampledRotary bsSwitchInputDevice_specifics_t  switchIn,
bsSwitchInputDevice_rotaryEnum  rport
 

returns the last received rotary value

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
rport the rotary port.
See also:
bsSwitchInputDevice_rotaryEnum
Returns:
the value of the rotary encoder, this value can be negative
Examples:
rotary.c.

DECLSPEC uint8_t bsSwitchInputDevice_getRequestGetConfigDone bsSwitchInputDevice_specifics_t  switchIn  ) 
 

Checks if the configuration request is finished

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
Returns:
1 if configuration was retrieved, 0 if still busy

DECLSPEC uint8_t bsSwitchInputDevice_getRequestGetInputsDone bsSwitchInputDevice_specifics_t  switchIn  ) 
 

Checks if an 'input values' request is finished

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
Returns:
1 if done, 0 if still busy

DECLSPEC uint8_t bsSwitchInputDevice_getRequestSetConfigDone bsSwitchInputDevice_specifics_t  switchIn  ) 
 

Checks if the configuration set request is finished

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

DECLSPEC uint32_t bsSwitchInputDevice_getSampleCount bsSwitchInputDevice_specifics_t  switchIn  ) 
 

returns the total number of samples taken since the start of the application

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
Returns:
the number of taken samples

DECLSPEC uint32_t bsSwitchInputDevice_getTimeOutUs bsSwitchInputDevice_specifics_t  switchIn  ) 
 

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:
switchIn a pointer to the switchInputdevice's instance specific data
Returns:
the time out value in microseconds.

uint8_t bsSwitchInputDevice_requestGetConfiguration bsSwitchInputDevice_specifics_t  switchIn  ) 
 

Request to obtain the configuration settings from a adcInput Device.

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data

DECLSPEC uint8_t bsSwitchInputDevice_requestGetInputs bsSwitchInputDevice_specifics_t  switchIn  ) 
 

Send a request to obtain the values of the switch inputs

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data

DECLSPEC uint8_t bsSwitchInputDevice_requestNeedsBooleans bsSwitchInputDevice_specifics_t  switchIn,
uint8_t  side,
uint8_t  needs
 

Sends a request: request that the device should not/should send boolean states

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
side if 0, side A selected, if 1 side B selected.
needs if 1, device should send boolean states, 0 device should not send boolean states
Examples:
switch.c.

DECLSPEC uint8_t bsSwitchInputDevice_requestNeedsCounter bsSwitchInputDevice_specifics_t  switchIn,
bsSwitchInputDevice_portEnum  port,
uint8_t  needs
 

Sends a request: request that the device should not/should send counter states

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
port port ot the counter.
See also:
bsSwitchInputDevice_portEnum
Parameters:
needs if 1, device should send counter value, 0 device should not send counter value
Examples:
counter.c.

DECLSPEC uint8_t bsSwitchInputDevice_requestNeedsRotary bsSwitchInputDevice_specifics_t  switchIn,
bsSwitchInputDevice_rotaryEnum  rport,
uint8_t  needs
 

Sends a request: request that the device should not/should send rotary encoder states

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
rport ports of the rotary encoder.
See also:
bsSwitchInputDevice_rotaryEnum
Parameters:
needs if 1, device should send rotary states, 0 device should not send rotary states
Examples:
rotary.c.

DECLSPEC uint8_t bsSwitchInputDevice_requestSetConfiguration bsSwitchInputDevice_specifics_t  switchIn,
uint8_t  booleansMask,
uint16_t  rotaryMask,
uint16_t  counterMask
 

Request the switchnput device to set port types

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
booleansMask receive switch data from side A (bit 0) and/or side B(bit 1)
rotaryMask receive rotary data from pin 1,2 (bit 0), pin 3,4 (bit 1), pin 5,6 (bit 2)...
counterMask receiver counter values from pin 1 (bit 0), pin 2 (bit 1), pin 3 (bit 2)....

void bsSwitchInputDevice_reset bsSwitchInputDevice_specifics_t  switchIn  ) 
 

Resets the pc-side of the switchInput device software and requests the settings from the device.

void bsSwitchInputDevice_setTimeOutUs bsSwitchInputDevice_specifics_t  switchIn,
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:
switchIn a pointer to the switchInputdevice's instance specific data
timeOutUs the value in microseconds which is the maximum duraion between a request and its answer.

DECLSPEC uint8_t bsSwitchInputDevice_usesBooleans bsSwitchInputDevice_specifics_t  switchIn,
uint8_t  side
 

Find out if we receive the boolean states of hardware side A or B.

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
side if 0, check if side A booleans are received, if 1 check if side B booleans are received.
Returns:
1 if states are received, 0 if boolean states are currently disabled (and will not be received).

DECLSPEC uint8_t bsSwitchInputDevice_usesCounter bsSwitchInputDevice_specifics_t  switchIn,
bsSwitchInputDevice_portEnum  port
 

Find out if we receive counter states.

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
port port of the counter.
See also:
bsSwitchInputDevice_portEnum
Returns:
1 if states are received, 0 if states are currently disabled (and will not be received).

DECLSPEC uint8_t bsSwitchInputDevice_usesRotary bsSwitchInputDevice_specifics_t  switchIn,
bsSwitchInputDevice_rotaryEnum  rport
 

Find out if we receive rotary states.

Parameters:
switchIn a pointer to the switchInputdevice's instance specific data
rport ports of the rotary encoder.
See also:
bsSwitchInputDevice_rotaryEnum
Returns:
1 if states are received, 0 if states are currently disabled (and will not be received).


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